[R-sig-ME] Questions about porting pedigreemm to the new lme4
Joehanes, Roby (NIH/NHLBI) [F]
roby.joehanes at nih.gov
Wed Apr 4 01:06:49 CEST 2012
Hi Ben and everyone:
I made some semi-working patch here (attached). I tried the examples mentioned in the paper of Vazquez, et al. (J. Anim. Sci. 2010, 88:497-504) and got the first example (fm1) working and the result is the same as the older one:
milk <- within(milk, sdMilk <- milk / sd(milk))
fm1 <- pedigreemm(sdMilk ~ lact + log(dim) + (1|id) + (1|herd), data=milk, pedigree=list(id=pedCowsR))
Result:
----
Linear mixed model fit by REML ['lmerMod']
Formula: sdMilk ~ lact + log(dim) + (1 | id) + (1 | herd)
Data: milk
REML criterion at convergence: 8384.794
Random effects:
Groups Name Variance Std.Dev.
id (Intercept) 0.2780 0.5273
herd (Intercept) 0.2078 0.4559
Residual 0.4833 0.6952
Number of obs: 3397, groups: id, 1359; herd, 57
Fixed effects:
Estimate Std. Error t value
(Intercept) 1.70371 0.26854 6.344
lact -0.10779 0.01232 -8.747
log(dim) 0.73594 0.04380 16.804
Correlation of Fixed Effects:
(Intr) lact
lact -0.296
log(dim) -0.960 0.221
----
However, when I tried the second example (fm2) below, I got an error.
milk <- within(milk, sdMilk <- milk / sd(milk))
milk <- within(milk, idPE <- id)
fm2 <- pedigreemm(sdMilk ~ lact + (1|id) + log(dim) + (1|idPE) + (1|herd), data=milk, pedigree=list(id=pedCows))
The error message is:
Error in .local(x, ...) : previous CHOLMOD factorization was unsuccessful
In addition: Warning message:
In .local(x, ...) :
Cholmod warning 'not positive definite' at file ../Cholesky/t_cholmod_rowfac.c, line 432
I could not get the third example to work either:
fm3 <- pedigreemm(NCM ~ birth + calvingYear + (1|sire) + (1|herd), data=mastitis, pedigree=list(sire=pedSires), family="poisson")
The error message is:
Error in FUN(1:3[[1L]], ...) : Downdated VtV is not positive definite
The fourth example also does not work:
fm4 <- pedigreemm(mastitis ~ birth + calvingYear + (1|sire) + (1|herd), data=mastitis, pedigree=list(sire=pedSires), family="binomial"(link="probit"))
Error message:
Error in FUN(1:3[[1L]], ...) :
step factor reduced below 0.001 without reducing pwrss
I think I messed up somewhere in the internals and got these errors.
Thanks,
Roby
On Apr 3, 2012, at 6:52 PM, Ben Bolker wrote:
> Joehanes, Roby (NIH/NHLBI) [F] <roby.joehanes at ...> writes:
>
>>
>> Hi all:
>>
>> Attached please find the patch to pedigreemm toward using the new lme4 (with
> the patch I submitted
>> earlier). However, the patch does NOT work with the following error:
>> Error in function (value) : Field "Zt" is read-only
>>
>> I believe the error is thrown at this statement:
>> lmf$rho$pp$Zt <- relfac[[i]] %*% Zt
>>
>> I have no idea how to proceed. Any help is appreciated.
>>
>> Thank you,
>> Roby
>
> I will take a look at this as soon as I can.
> Setting components of objects in new-lme4 is tricky because
> the objects are defined as reference classes, so that messing
> with their internals can disrupt existing objects that they
> have been copied from (!!)
>
> Abstracting the equivalent of "mer_finalize" is, I think, a good
> idea. Yes, nAGQ=0 is allowed for [NG]LMMs ... the idea being (I think)
> that for a well-behaved but very large problem one could save time
> by just doing the "zeroth-order" fit (even faster than nAGQ=1,
> which corresponds to Laplace approximation)
>
> Ben Bolker
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: lmer-patch-for-pedigreemm.txt
URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20120403/5d884ed4/attachment-0004.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pedigreemm-patch-v2.txt
URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20120403/5d884ed4/attachment-0005.txt>
More information about the R-sig-mixed-models
mailing list