
Thanks David,

I followed your instructions but I got a different error message:
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'my_lmer_finalize' not found
Timing stopped at: 60.13 0.8 61.37 
I saved my functions and I can see the changes I made are still there, so I don't know what the problem is. Any ideas? 

Thanks in advance.

Regards,

Napo Vargas J.

> Date: Mon, 18 Feb 2013 11:08:11 +1000
> From: David.Duffy@qimr.edu.au
> To: napo_v@hotmail.com
> CC: r-sig-mixed-models@r-project.org
> Subject: Re: [R-sig-ME] Error message in Pedigreemm
> 
> On Mon, 18 Feb 2013, Napo Vargas wrote:
> 
> > Error in function (fr, FL, start, REML, verbose)  :
> >  Number of levels of a grouping factor for the random effects
> > must be less than the number of observations
> 
> Whether you see this (in your case, spurious) error message depends on 
> what version of lme4 you have installed.  A quick hack is
> 
> my_lmer_finalize <- edit(lme4:::lmer_finalize)
> 
> change
> 
>      if (!(length(levels(dm$flist[[1]])) < length(Y)))
>          stop(paste("Number of levels of a grouping factor for the random effects",
>              "must be less than the number of observations", sep = "\n"))
> 
> to
> 
>      if (!(length(levels(dm$flist[[1]])) <= length(Y)))
>          stop(paste("Number of levels of a grouping factor for the random effects",
>              "must be less or equal to the number of observations", sep = "\n"))
> 
> and save.  Then
> 
> my_pedigreemm <- edit(pedigreemm)
> 
> and change the fifth last line from
> 
>     else lmer_finalize, lmf)
> 
> to
> 
>     else my_lmer_finalize, lmf)
> 
> Now,
> 
> system.time(AM1 <-
> my_pedigreemm(WS~WT+Sex+(1|ID),data=cdata, pedigree=list(ID=ped1)))
> 
> should work.  You could alter this check permanently when you install 
> lme4 by editing the appropriate file.
> 
> BTW, with lme4, you can leave all your variables of interest in cdata 
> eg cdata$Sex <- factor(cdata$Sex).
> 
> 
> David Duffy,
 		 	   		  
	[[alternative HTML version deleted]]

