[R-sig-ME] How to use nlmer on a dataset with multiple fixed and random effects
Lauren Hooton
lauren.hooton at gmail.com
Wed May 9 21:58:46 CEST 2012
Hello,
I am trying to model the effect of weather variables on bat activity
(passes/hour) over three years and multiple geographic locations.
Specifically, the effects are:
Fixed = temperature, wind speed, wind direction, pressure,
precipitation, relative humidity
Random = year, week, detector, hour
(Within each year there were multiple detectors recording bat
activity, and these detectors (locations) changed each year).
I started out using glmer() in lme4, with the following code:
LACI.model.8 <-
glmer(LACI~AvgTemp+AvgSpeed+AvgDirection+Pressure+Precip+RH+(1|year)+(1|weeks_July1)+(1|detector)+(1|GMT_hour),
data=allbatwxstd, family=poisson)
This worked well, but I now want to explore using a non-linear mixed
model instead, since I think that may be more appropriate (when bat
activity is plotted against the environmental effects, the
relationship between the two types of data appears roughly quadratic
in nature (an inverted parabola)). I want to use nlmer() as opposed
to nlme(), since I have crossed random effects, but I am unsure of how
to write it. I have looked in the nlmer help file and tried to
understand the example using the Orange dataset, but I am confused as
to how the Asym, xmid, scal variables fit in, and how to use those in
conjunction with my variables. Also, I don't know how to specify what
the starting values should be (ie:, how do you come up with starting
values?).
Any advice you could give on how to approach nlmer would be greatly appreciated.
Lauren Hooton, M.Sc.
Bat Biologist
More information about the R-sig-mixed-models
mailing list