Why should height be a random effect? I suspect you may need a tutorial on what a random effect in a mixed model is. I see no obvious reason why one would cluster on height. Perhaps if you clarify, it may become obvious either what your concerns are (and that your model is correct) or that you misunderstand and need a tutorial on random effects in mixed models. Some kind soul on this list may provide that (not me, though) -- or you can talk with your local statistician.
Cheers, Bert On Thu, Sep 2, 2010 at 9:22 AM, James Nead <james_n...@yahoo.com> wrote: > Hi, > > Sorry for a basic questions on linear models. > > I am trying to adjust raw data for both fixed and mixed effects. The data > that I > output should account for these effects, so that I can use the adjusted data > for > further analysis. > > For example, if I have the blood sugar levels for 30 patients, and I know that > 'weight' is a fixed effect and that 'height' is a random effect, what I'd want > as output is blood sugar levels that have been adjusted for these effects. > > > ==================== > library("lme4") > sugar <- c(1:10,sample(1:100,20)) > weight <- 1:30 > height <- rep(sample(1:15,15,replace=F),2) > > lm.adj <- lmer(sugar ~ weight + (1|height)) > > adjusted.sugar <- fitted(lm.adj) > > ===================== > > I'm not sure if I'm doing this right...? > > thanks! > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.