0

Long-time lurker, first time poster. Been helped many times by searching through old questions, but this time my google-fu has failed me. I'm doing habitat selection research on a large mammal, using a logistic regression model to compare used locations to a random sample of available habitat. My model, using lme4:

GLM <- glmer(u ~ hab * season + hab * sex + hab * location + feeding * hab + feeding:season:hab + location:season:hab + hab:season:location:sex + Z.dist_road * location + (1|bison), family=binomial, data=subset(bison_KDE,bison_KDE$dataquality!="Poor"))

The factors:

u=1 for used locations, 0 for available

hab = habitat, 6 levels

season = Summer or winter

location = 3 different study areas

feeding = Whether an individual is supplementarily fed during winter or not

sex = Male or female

Z.dist_road = distance in meter to nearest road, standardised. The only continuous variable.

Model runs fine, output is huge though due to the many interactions between factors. What I would like to do next is produce bar graphs with standard deviations showing the differences in what habitats are selected depending on the other factors, for example producing a graph similar to this: What i want to accomplish, except with error bars!

I was suggested to try using the ez package and the ezPredict function. First I set up a dataframe with every combination of factors possible

tp<-expand.grid(unique(bison_KDE$sex), unique(bison_KDE$location), unique(bison_KDE$season), unique(bison_KDE$feeding), unique(bison_KDE$hab))

then i fed it to ezPredicts to_predict argument

ezPredict(GLM, to_predict=tp) Error in mm %*% f : non-conformable arguments

Which is where I'm at currently. I'm rather new to R (and not super-experienced in the statistics neither), is there perhaps a more reasonable approach to what I'm trying to accomplish? Any help is greatly appreciated!

Also, I can't post the dataset since it's huge (500000 rows) and confidential. Thank you for your time! /C

Domo-Kun
  • 1
  • 1
  • How about an [anonymized subset](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/6699112#6699112) of your data? – alexforrence Feb 27 '15 at 12:33
  • And have you seen the example at http://glmm.wikidot.com/faq using the `predict` function from `lme4`? – alexforrence Feb 27 '15 at 12:38
  • I had not seen that example even though I had previously skimmed that faq! Seems to be exactly what i want, I'll try it out. Thank you! If I can't get it to work I'll look into posting an anonymized subset of the data. – Domo-Kun Feb 27 '15 at 14:56

0 Answers0