Hi Bert,

Thanks for the reply.

Height, was just as an example. Perhaps, I should have said 'x' instead of 
height.

Essentially, what I want to do is adjust the data for known effects. After I've 
done this, I can conduct further analysis on the data (for example, if another 
variable 'z' has an effect on sugar). So, if I have to adjust the data for a 
fixed effect (weight) and random effect (height/x), then am I using the model 
correctly?

Thanks again for the reply!








________________________________
From: Bert Gunter <gunter.berton@gene.com>

Cc: r-help@r-project.org
Sent: Thu, September 2, 2010 12:46:13 PM
Subject: Re: [R] Linear models (lme4) - basic question

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


> 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.
>



      
	[[alternative HTML version deleted]]

