[R-sig-ME] How to use nlmer on a dataset with multiple fixed and random effects

Ben Bolker bbolker at gmail.com
Wed May 9 23:07:13 CEST 2012


Lauren Hooton <lauren.hooton at ...> writes:

> 
> 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)

  A quick question: can you use a quadratic function of one or
more of your continuous predictors in your model?  That is nonlinear
in terms of the original predictor, but it is still a linear *model*
(i.e. it is linear in terms of the parameters of the model).  You can
use either (e.g.) Pressure + I(Pressure^2), or (more numerically
stable and statistically sounder but possibly harder to interpret)
poly(Pressure,2) to add a quadratic term in Pressure ...

  (Sorry if this isn't relevant, I'm posting in a hurry)



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