Hi I am struggling with nested random effects and hope someone can help. I have individuals (ID) who are nested within families (FAM). I want to model an outcome variable, and take account of the intercorrelation of individuals within each family. I think this amounts to two random effects, one nested within the other. How can I model this in R? So far I have tried using the library(nlme), and then Y~ID, random=~1|ID*FAM, But this isn't working.. Thanks Philip [[alternative HTML version deleted]]
On Wed, 2005-03-23 at 11:58 -0500, Shaw, Philip (NIH/NIMH) wrote:> Hi > > I am struggling with nested random effects and hope someone can help. > > > > I have individuals (ID) who are nested within families (FAM). I want to > model an outcome variable, and take account of the intercorrelation of > individuals within each family. > > I think this amounts to two random effects, one nested within the other. > > How can I model this in R? > > So far I have tried using the library(nlme), and then > > Y~ID, random=~1|ID*FAM, >An interaction random effect/fixed effect is noted as random ~1|random/fixed in your case random =~1|ID/FAM (but I don't uderstand why indiviuals withing families are fixed and and families are random, but there you go). Check out Pinheiro and Bates Ch1, especially pg 23 onwards. Cheers, F -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com
It should be random=~1|FAM/ID indicating individuals are nested within families. -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Federico Calboli Sent: Wednesday, March 23, 2005 12:34 PM To: Shaw, Philip (NIH/NIMH) Cc: r-help Subject: Re: [R] nested random effects On Wed, 2005-03-23 at 11:58 -0500, Shaw, Philip (NIH/NIMH) wrote:> Hi > > I am struggling with nested random effects and hope someone can help. > > > > I have individuals (ID) who are nested within families (FAM). I want > to model an outcome variable, and take account of the intercorrelation> of individuals within each family. > > I think this amounts to two random effects, one nested within theother.> > How can I model this in R? > > So far I have tried using the library(nlme), and then > > Y~ID, random=~1|ID*FAM, >An interaction random effect/fixed effect is noted as random ~1|random/fixed in your case random =~1|ID/FAM (but I don't uderstand why indiviuals withing families are fixed and and families are random, but there you go). Check out Pinheiro and Bates Ch1, especially pg 23 onwards. Cheers, F -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Hello For an unbalanced longitudinal data set with subjects nested within family as the random effect (random= ~1 | FAMILY/ID)-- I am unclear as to why the subject within family random coefficient is not zero when there is only one person in a family with only one data point. Thanks Dede Greenstein