An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20140204/6eada5b8/attachment.pl>
pedigreemm number of levels per grouping factor
3 messages · Ben Bolker, Wilson, Alastair
On 14-02-04 06:34 PM, Wilson, Alastair wrote:
I???m trying to fit a pedigree-based mixed model (ie animal model) to estimate a genetic variance and a couple of fixed effects in a simulated data set. I???ve fitted the model using AsReml-R and MCMCglmm. I wanted to try using pedigreemm but get a error Error in checkNlevels(reTrms$flist, n = n, control) : number of levels of each grouping factor must be < number of observations I *think* this is telling me I don???t have multiple observations per factor level (here ID) which is true. However, I shouldn???t need repeat measures to estimate the random effect variance here (i.e. VA), so am assuming I have not got the code (below) right. Any pointers v gratefully received. Alastair
I'm not sure, but I guess that this is one of the cases where individual-level random effects *do* make sense in a LMM context. I don't know whether pedigreemm allows you to pass arguments through to lmer, but if it does you can use control=lmerControl(check.nobs.vs.nlev="ignore") to suppress this check. You might also be able to do this globally via options(lmerControl=list(check.nobs.vs.nlev="ignore")) (The maintainer of the package might want to consider suppressing this check by default, if this is a common issue ...) Ben Bolker
############### library(pedigreemm) setwd("c:/prussia/")
voles<-read.table("voles.txt", header=T)
voles$ID<-as.factor(voles$ID) voles$sex<-as.factor(voles$sex)
volesPED<-read.table("volesPED.txt",header=T)
volesPED2<-pedigree(volesPED$SIRE,volesPED$DAM,volesPED$ID)
model3<-pedigreemm(size~forage+sex+(1|ID),
pedigree=list(ID=volesPED2), data=voles, REML=TRUE)
It would be nice if the example were reproducible ...
Thanks for the suggestion Ben. Sadly it didn't provide a solution. The error message indicates the variance component I am after is unidentifiable, which would not be the case if I have correctly got the random ID effect linked to the pedigree. Error in .sortCsparse(.Call(dtCMatrix_sparse_solve, a, b)) : Dimensions of system to be solved are inconsistent In addition: Warning message: In checkZrank(reTrms$Zt, n = n, control, nonSmall = 1e+06) : number of observations <= rank(Z); variance-covariance matrix will be unidentifiable I'll maybe contact the package maintainer directly unless anyone else has thoughts/experience with pedigreemm. Alastair -----Original Message----- From: r-sig-mixed-models-bounces at r-project.org [mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf Of Ben Bolker Sent: 05 February 2014 18:35 To: r-sig-mixed-models at r-project.org Subject: Re: [R-sig-ME] pedigreemm number of levels per grouping factor
On 14-02-04 06:34 PM, Wilson, Alastair wrote:
I???m trying to fit a pedigree-based mixed model (ie animal model) to estimate a genetic variance and a couple of fixed effects in a simulated data set. I???ve fitted the model using AsReml-R and MCMCglmm. I wanted to try using pedigreemm but get a error Error in checkNlevels(reTrms$flist, n = n, control) : number of levels of each grouping factor must be < number of observations I *think* this is telling me I don???t have multiple observations per factor level (here ID) which is true. However, I shouldn???t need repeat measures to estimate the random effect variance here (i.e. VA), so am assuming I have not got the code (below) right. Any pointers v gratefully received. Alastair
I'm not sure, but I guess that this is one of the cases where individual-level random effects *do* make sense in a LMM context. I don't know whether pedigreemm allows you to pass arguments through to lmer, but if it does you can use control=lmerControl(check.nobs.vs.nlev="ignore") to suppress this check. You might also be able to do this globally via options(lmerControl=list(check.nobs.vs.nlev="ignore")) (The maintainer of the package might want to consider suppressing this check by default, if this is a common issue ...) Ben Bolker
############### library(pedigreemm) setwd("c:/prussia/")
voles<-read.table("voles.txt", header=T)
voles$ID<-as.factor(voles$ID) voles$sex<-as.factor(voles$sex)
volesPED<-read.table("volesPED.txt",header=T)
volesPED2<-pedigree(volesPED$SIRE,volesPED$DAM,volesPED$ID)
model3<-pedigreemm(size~forage+sex+(1|ID),
pedigree=list(ID=volesPED2), data=voles, REML=TRUE)
It would be nice if the example were reproducible ... _______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models