Re: [R] lme4 problem: model defining and effect estimation ------ question from new bird to R community from SAS community

From: Dieter Menne <dieter.menne_at_menne-biomed.de>
Date: Sat, 16 Apr 2011 00:52:54 -0700 (PDT)

Nilaya Sharma wrote:
>
> I was trying to fit a mixed model in animal experiment but stuck at simple
> point. The following similar example is from SAS mixed model pp 212.
>
>
> genetic_evaluation <- read.table(textConnection("
> sire dam adg
> 1 1 2.24
> 1 1 1.85
> ...
> 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)
>
> ****error message********************************************88
> Error: length(f1) == length(f2) is not TRUE
> In addition: Warning messages:
>

Thanks for providing a self-contained example. The error message is really a bit confusing (anybody around who understands what lme thinks here?), but the solution is simple. Just make sure that dam and sire are factors:

genetic_evaluation$dam = as.factor(genetic_evaluation$dam) genetic_evaluation$sire = as.factor(genetic_evaluation$sire)

I recommend the excellent course notes in the MCMCglmm package as a complementary reading.

Dieter

--
View this message in context: http://r.789695.n4.nabble.com/lme4-problem-model-defining-and-effect-estimation-question-from-new-bird-to-R-community-from-SAS-comy-tp3453530p3453690.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_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.
Received on Sat 16 Apr 2011 - 07:59:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 16 Apr 2011 - 10:20:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive