On Apr 16, 2011, at 04:21 , Nilaya Sharma wrote:

> genetic_evaluation <- read.table(textConnection("
> sire dam adg
> 1  1  2.24
> 1  1  1.85
> 1  2  2.05
> 1  2  2.41
....
> 4  2  1.86
> 4  2  1.79
> 5  1  2.82
> 5  1  2.64
> 5  2  2.58
> 5  2  2.56"), header = TRUE)
> 
> # my R practice codes
> require (lme4)
> lmer(adg ~ 1 + (1|sire) + (1|dam/sire), data=genetic_evaluation)


You're missing the equivalent of the SAS class statement. Grouping variables 
need to be factors:

genetic_evaluation<-transform(genetic_evaluation,
 sire=factor(sire),
 dam=factor(dam))

Also, you probably don't want a random main effect of dam, so

lmer(adg ~ 1 + (1|sire) + (1|dam:sire), data=genetic_evaluation)

or even

lmer(adg ~ 1 + (1|sire/dam), data=genetic_evaluation)


-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd....@cbs.dk  Priv: pda...@gmail.com

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

Reply via email to