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