However, your definition of crossed random effects is a little narrow. You are not wrong in your understanding of what nested and crossed random effects are in the scenario that you describe. (This is a fairly long answer, there is a summary at the end) Number of obs: 1190, groups: classid:schoolid, 312 schoolid, 107 Number of obs: 1190, groups: classid, 312 schoolid, 107įormula: mathgain ~ (1 | schoolid/classid) Linear mixed model fit by REML įormula: mathgain ~ (1 | schoolid) + (1 | classid) So what is going on here? mydata <- read.csv("") However I have seen other datasets where the two formulas produced different results. However, when I was looking at a particular nested dataset, I noticed that both model formulas gave identical results (code and output below). In lme4, we would write: (1|class) + (1|pupil) For example, there are pupils within classes measured over several years.In lme4 I thought that we represent the random effects for nested data in either of two equivalent ways: (1|class/pupil) # orĬrossed random effects means that a given factor appears in more than one level of the upper level factor. For example, pupils within classes at a fixed point in time.Nested random effects occur when a lower level factor appears only within a particular level of an upper level factor.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |