multivariate mixed models

342 views
Skip to first unread message

Rosemary Hartman

unread,
Mar 16, 2014, 12:35:13 PM3/16/14
to davi...@googlegroups.com
Hello all,

I am trying to run a multivariate mixed model using lme4. Has anyone done this successfully? If not, do you know of any other packages I should try?

The syntax of my model looks like this:

library(lme4)
mixed4 <- glmer(cbind(surface, shallow) ~ type*treatment + (treatment|pop/pop.rep), family="poisson", data=refuge.df4)
summary(mixed4)

It works when I only have a single response variable, but when I try the multivariate version i get this error message;

Error: updateXwts: dimension mismatch

Any advice?

--
Rosemary Hartman
UC Davis Graduate Group in Ecology
Dr. Sharon Lawler's Lab
roseh...@gmail.com
301-538-0136

Michael Levy

unread,
Mar 16, 2014, 12:53:55 PM3/16/14
to davi...@googlegroups.com
Rosie,

I'm not sure, but you may need a specialty package. I was just trying to do this for a logit/probit and ended up using package mvProbit. If one of the general tools can handle this sort of thing (better yet with different predictor sets, a la seemingly unrelated regression), I'd love to know about it.

Michael

-- 
Michael Levy
c: 304-376-4523



--
Check out our R resources at http://www.noamross.net/davis-r-users-group.html
---
You received this message because you are subscribed to the Google Groups "Davis R Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to davis-rug+...@googlegroups.com.
Visit this group at http://groups.google.com/group/davis-rug.
For more options, visit https://groups.google.com/d/optout.

Jaime Ashander

unread,
Mar 16, 2014, 12:54:44 PM3/16/14
to davi...@googlegroups.com
No experience with this (at least that I can recall off hand) but searching archives of r-sig-mixed might turn up some resources 
--

Jaime Ashander

unread,
Mar 16, 2014, 1:06:04 PM3/16/14
to davi...@googlegroups.com, davi...@googlegroups.com
Just remembered I have seen this done in mixed context using package MCMCglmm, which might be a good route anyway given you apparently have count data. Searching sig-mixed should get you some info on this too

Dave Harris

unread,
Mar 16, 2014, 3:20:15 PM3/16/14
to davi...@googlegroups.com
One of my labmates has used MCMCglmm quite a bit.  It mostly worked for him, but he had trouble getting the Markov chains to mix well in certain cases and is now using Stan, I think.  Stan is generally more flexible and faster, but it's probably harder to learn from scratch.

Depending on what assumptions you're willing to make, it's also possible to trick lme4 into modeling this.  The trick is to repeat each row of your data twice and add a column specifying whether the row is describing a surface measurement or a shallow measurement. You can then add correlated random effects and interaction terms as you see fit, so that the model "understands" how you expect the relationship between surface measurements and shallow measurements within a location to work.

Hope this makes sense.

Dave
Reply all
Reply to author
Forward
0 new messages