[R-sig-ME] Question on lmer use and commands

hadley wickham h.wickham at gmail.com
Tue Jun 10 17:47:14 CEST 2008

> I am new to R and would appreciate any suggestions to my questions. I am
> modeling factors that influence point counts. My question is regarding the
> use and command lines of lmer. First, I have repeated measures per site
> (10-20 per site),  multiple years, and multiple spatial scales of each
> factor. The counts by day are different within each site but the
> explanatory data are the same and therefore do not vary (e.g., % cover). I
> have few sites with no overlap, even at the largest scales. I followed an
> example of mixed model use with longitudinal data from Faraway 2005 and
> modeled site and year as random effects. Example of my formula was:
> log(response) ~ hab1 + hab2 + (1 | year) + (1 | site). The models
> converged, no warnings, etc. Was this an appropriate model for these data?

What are you trying to do with the model?  Are you interested in
effects over time?  Once you have the model what will you do with it?

What did your exploratory graphics look like?  If you didn't do any,
here are some to get you started:

# Show the path of each site through the 2d covariate space over time
# - are the sites all pretty similar?  are they all different?
# - if there are clusters, you might want to create a categorical variable
# that identifies them
# - are hab1 and hab2 correlated?
qplot(hab1, hab2, data=mydata, geom="path", group = site)

# Show how time varies by site and year
qplot(time, site, data=mydata, facets =  . ~ year)

# Show the trend in response over time
qplot(log(response), year, data=mydata, geom="line", group=site)
qplot(log(response), year, data=mydata, geom="line", group=site) +
geom_point(aes(colour = hab1))
qplot(log(response), year, data=mydata, geom="line", group=site) +
geom_point(aes(colour = hab2))



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