[R-sig-ME] Same variable as both fixed and random

Joshua Wiley jwiley.psych at gmail.com
Thu Jul 17 11:24:28 CEST 2014


Hi Stephen,

In your example, I would recommend not including year as both a fixed
and random effect (note that Arrival ~DegreeDays + Year + (1 + Year |
State) --- i.e., allowing the effects of year to differ by state or
some such, would be a different scenario).

You will partial the most variability out of the estimates by
specifying Year as a fixed effect, however, if it is being treated
categorically, this will result in quite a few extra parameters, and
you will also not get an estimate of the overall variability in
intercept by year.  If those specific ten years are not of interest,
and you are controlling for the "key" feature that you expect to
change, namely, DegreeDays, then I would suggest:

lmer(Arrival ~ DegreeDays + Longitude + Latitude + (1 | State) + (1 | Year))

A separate issue is how longitude and latitude are included (e.g.,
depending on the precision of your data, it may be helpful to allow a
stronger similarity between nearby locations, although it may not
matter much if you only have data at the level of State).

Cheers,

Josh


On Wed, Jul 16, 2014 at 2:47 AM, Stephen Mayor <smayor at neoninc.org> wrote:
> Hello,
> When should a variable be specified as both a fixed effect AND as a random effect?  If a single variable is defined as both fixed and random, how does one interpret the coefficients?  Is it 'sloppy' practice to include it as both?  Should one be cautious specifying a variable twice, or is it actually more conservative to do so?
>
> I am interested in your thoughts in general, but here is a simplified example if helpful:
> I am interested in the date of arrival of house wren, a migratory bird, to each state in the US as a response to year, degree days (climate), latitude, longitude, state.  I primarily want to test if there is a temporal trend in earlier arrival in more recent years, as a result of recent climatic warming.
>
> I specified the model as follows, treating state as a random group.  Because I am interested in testing a linear trend across years, I specified Year as a fixed (and continuous) effect.  But I am unsure as to whether I should ALSO specify it as a random factor, because I am interested in making inferences beyond the 10 years of data that I have and I don't have any specific interest in these 10 years over any other period.
>
> lmer(Arrival ~ DegreeDays + Year + Longitude + Latitude + (1|State) )
> OR
> lmer(Arrival ~ DegreeDays + Year + Longitude + Latitude + (1|State) + (1|Year))
>
> Thanks in advance for any help or suggestions,
> Stephen.
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



-- 
Joshua F. Wiley
Ph.D. Student, UCLA Department of Psychology
http://joshuawiley.com/
Senior Analyst, Elkhart Group Ltd.
http://elkhartgroup.com
Office: 260.673.5518



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