[R-sig-ME] broom package and MCMCglmm estimates

HAJDUK Gabriela G.K.Hajduk at ed.ac.uk
Wed Oct 25 14:27:26 CEST 2017


Hello Dani,

Looks like Ben’s version of broom solves your problem (I haven’t used it, but looks like it does the trick beautifully!), but in case it’s any use (e.g. if you wanted to tweak anything for yourself to adjust the output) I’ve popped a function that I’ve wrote ages ago to pull out information from multiple MCMCglmm model objects for summary/plotting purposes.

You can find the code here:
https://gkhajduk.github.io/2017-10-25-cleanMCMCglmm/

Cheers,
Gabriela


On 24 Oct 2017, at 23:42, dani <orchidn at live.com<mailto:orchidn at live.com>> wrote:

Hello again,


That is fantastic, thank you so much, Dr Bolker!

I had tried earlier today and I got the same error message several times. I tried again after I received your message and I got several other error messages - one of them saying that the broom.rdb was corrupt, so I guess I might have messed up somehow because I was trying different things and I installing many packages. I removed them all and re- installed "broom" as you suggested and it worked nicely for a glmmTMB model as well as for a MCMC model. Now I hope everything goes nicely to visualize them.


I appreciate all your help and all your work in the field and in making everything easier to understand!

This is truly wonderful and I cannot emphasize more how great this mailing list is for me!

Best regards everyone!

________________________________
From: R-sig-mixed-models <r-sig-mixed-models-bounces at r-project.org<mailto:r-sig-mixed-models-bounces at r-project.org>> on behalf of Ben Bolker <bbolker at gmail.com<mailto:bbolker at gmail.com>>
Sent: Tuesday, October 24, 2017 3:04 PM
To: r-sig-mixed-models at r-project.org<mailto:r-sig-mixed-models at r-project.org>
Subject: Re: [R-sig-ME] broom package and MCMCglmm estimates


 There is an MCMCglmm method in my fork of broom :

devtools::install_github("bbolker/broom")
library(broom)
library(MCMCglmm)
data(PlodiaPO)
model1 <- MCMCglmm(PO~1, random=~FSfamily, data=PlodiaPO,
 verbose=FALSE,  nitt=1300, burnin=300, thin=1)
tidy(model1)
##   effect        term estimate  std.error
## 1  fixed (Intercept) 1.162818 0.01656339

 I make no claims as to its completeness, but am happy to accept issues
or pull requests.  Eventually the stuff in my fork will get migrated to
a separate "broom.mixed" (or some such) package.



On 17-10-24 05:56 PM, dani wrote:
Hello Pierre,


Thank you so much for your prompt response, I will follow your advice and report back.


best,

daniNm

________________________________
From: Pierre de Villemereuil <pierre.de.villemereuil at mailoo.org<mailto:pierre.de.villemereuil at mailoo.org>>
Sent: Tuesday, October 24, 2017 1:47 PM
To: r-sig-mixed-models at r-project.org<mailto:r-sig-mixed-models at r-project.org>
Cc: dani
Subject: Re: [R-sig-ME] broom package and MCMCglmm estimates

Hi,

As far as I can see, there is no method to tidy up MCMCglmm output in broom. You can see that by looking at the "tidiers" functions in broom using:
library(help = broom) #No MCMCglmm

However, MCMCglmm output contains "mcmc" class objects that can be tidied up using tidyMCMC():
- fixed effects: tidyMCMC(model$Sol)
- random effects: tidyMCMC(model$VCV)

Look up ?tidyMCMC for more options. I'm afraid it's difficult to get the pMCMC back though. You can get 95% credible intervals are a replacement for those (set conf.int = TRUE).

I have also seen that Ben Bolker is working on a fork/split of broom for mixed models especially, maybe he plans on having a specific tidier for MCMCglmm?

Best,
Pierre.


On Tuesday, 24 October 2017 20:13:53 NZDT dani wrote:
Hi everyone,


I would like to visualize the estimates from a MCMC glmm model and I tried using broom but I received the following message:

Error in as.data.frame.default(mj) :
 cannot coerce class ""MCMCglmm"" to a data.frame
I was wondering what should I do about this?
Thank you in advance for all your help!
Best,
DaniNM

      [[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models at r-project.org<mailto:R-sig-mixed-models at r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
R-sig-mixed-models Info Page - stat.ethz.ch<http://stat.ethz.ch><https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models>
stat.ethz.ch<http://stat.ethz.ch>
Your email address: Your name (optional): You may enter a privacy password below. This provides only mild security, but should prevent others from messing ...



R-sig-mixed-models Info Page - stat.ethz.ch<https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models>
R-sig-mixed-models Info Page - stat.ethz.ch<https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models>
stat.ethz.ch
Your email address: Your name (optional): You may enter a privacy password below. This provides only mild security, but should prevent others from messing ...



stat.ethz.ch
Your email address: Your name (optional): You may enter a privacy password below. This provides only mild security, but should prevent others from messing ...






      [[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
R-sig-mixed-models Info Page - stat.ethz.ch<https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models>
stat.ethz.ch
Your email address: Your name (optional): You may enter a privacy password below. This provides only mild security, but should prevent others from messing ...





_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

[[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20171025/9e9762fe/attachment.ksh>


More information about the R-sig-mixed-models mailing list