Skip to content
Prev 34011 / 398513 Next

NLME Covariates

"Harold Doran" <hdoran at nasdc.org> writes:
There is no distinction between level 1 and level 2 variables in the
fixed-effects part of an lme model.  Once the data are organized in a
composite table (i.e. one table that includes the value of each
covariate for each observation) one simply writes a linear model
expression for the fixed effects.

You need to incorporate the female indicator into your 'datafile' data
frame.  The merge function is a good way to do this (I had forgotten
about the merge function when we spoke about this a few weeks ago).
After that you could fit a model using, say,

model2 <- lme(math ~ year * female, random=~year|schoolid/childid,
              data = datafile)