Skip to content

Science Fair data

8 messages · Doug Adams, Christopher David Desjardins, Douglas Bates

#
Thanks; I think that makes sense.  What's the difference between
listing your factors as:

lmer(score ~ division + (1|district/school), data=Age6m)
and
lmer(score ~ division + (1|school) + district, data=Age6m)

since district is another level?  Sorry if that question is quite
'newbie.'   : )

Doug
#
On Mon, Jan 25, 2010 at 9:41 PM, Doug Adams <dougadams53 at gmail.com> wrote:
Well, actually it doesn't.  If you tried that it would fail because
there is no addition operator for factors.
In this model the effects of the district and the school are modeled
with random effects.  The model specification is equivalent to

 lmer(score ~ division + (1|district) + (1|school:district), Age6m)

and, if the levels of school are distinct (i.e. you don't have a
school 1 in both district 1 and district 2 or something like that),
then the specification is equivalent to

lmer(score ~ division + (1|district) + (1|school), Age6m)
In this model the effect of the school is modeled by random effects
but the effect of the district is modeled by fixed-effects parameters.

The choice of fixed effects or random effects depends on the structure
of the data and the type of inferences you wish to make.  If you have
data from only some of the school districts and you wish to form
conclusions about a generic district then random effects are
preferred.  If you have data from all districts and you want to reach
conclusions only about those specific districts then fixed effects are
preferred.  If you want to consider how the variability in the
responses splits into student-to-student variability and
school-to-school variability and district-to-district variability then
random effects are preferred.
#
Douglas Bates wrote:
Sorry I thought that

lmer(score ~ division + (1|district) + (1|school), Age6m)


Was equivalent to:

lmer(score ~ division + (1|school + district), Age6m)
#
I appreciate that, both of you (& that's ok for the mistake Christopher)   :)

So fixed factors as simply listed by themselves (no 1| notation) and
random effects are listed with appropriate nesting...  I do want to
consider schools as random effects; that will give me the information
I'd like to have about the variability (and reliability too?) of the
schools as they fit into the big picture.

When I use fixef & ranef to extract estimates for division and schools
(& maybe districts eventually too now), am I right in thinking that
the 3 numbers given for each level of division (fixef) are the
intercepts for each level -- as if there were individual OLS
regressions performed for each?  And are the random effects for the
schools (ranef) are the slopes associated with those regression lines?

Thanks again everyone   :)

Doug
#
On Tue, Jan 26, 2010 at 10:10 PM, Doug Adams <fog0 at gmx.com> wrote:
Not quite.  They should be labeled "(Intercept)" and something like
division2 and division 3.  (By the way, it helps if you quote the
output when you want to discussion what particular values mean.)  The
(Intercept) coefficient represents the prediction at the first level
of the division factor.  The next two coefficients are the change from
the first to the second level and from the first to the third level.
#
Hi, and thanks again.  That makes sense with the 3 levels of division:

(Intercept) divisionJunior divisionSenior
     80.306526      -3.252372      -2.694055

...so that the Junior and Senior levels are both slightly lower than
the Elementary level.

I'd love to really understand the summary of lmer and what ranef,
fixef, coef and fitted are extracting - so that probably means I don't
understand the basics and nomenclature of HLMing as I thought I might
have.  I took a 1-week class on HLM, and I have the book you (Douglas
Bates) wrote...  Maybe I just need to study up on things a little
better!

Anyway, I appreciate your help very much   : )

Doug
On Wed, Jan 27, 2010 at 8:07 AM, Douglas Bates <bates at stat.wisc.edu> wrote:
#
I'm writing a book about lme4 and lmer.  When it gets to the point
where others can read it without too much frowning and scratching of
heads, I will make chapter drafts available.

For the time being you may find the slides from a short course given
last summer informative.  They are at
http://lme4.R-forge.R-project.org/slides/2009-07-21-Seewiesen/
On Wed, Jan 27, 2010 at 2:53 PM, Doug Adams <fog0 at gmx.com> wrote:
#
That's great!  Thanks!
On Thu, Jan 28, 2010 at 8:35 AM, Douglas Bates <bates at stat.wisc.edu> wrote: