[R-sig-ME] pedigreemm with one observation per individual
Ben Bolker
bbolker at gmail.com
Fri May 9 22:12:04 CEST 2014
Witold Proskura <witold.proskura at ...> writes:
>
>
> I would like to ask how to exactly apply that fix to lme4 and pedigreemm
> packages.
This is a response to a very old thread
<https://stat.ethz.ch/pipermail/r-sig-mixed-models/2010q1/003341.html>,
that refers to old versions of lme4 and pedigreemm.
I started trying to reproduce the old example from the thread, but
there have been enough changes (kinship has given way to kinship2,
the pedigreemm package has changed, etc etc) that I was having trouble.
My guess is that with a modern version of pedigreemm+lme4 you can
specify something like
control=lmerControl(check.nobs.vs.nlev="ignore",
check.nobs.vs.nRE="ignore")
in your pedigreemm call to override this test.
You can either check this yourself, or provide a reproducible
example ...
Ben Bolker
> As I understand i need to call edit(lmer) and edit(pedigreem) to be able
> to fix the problem.
> Please indicate exactly where in the lmer and pedigreemm function codes
> I need to place the solution given below.
>
> Here is a somewhat crude fix; it adds an additional parameter
> (checklevels) to the lmer_finalize and glmer_finalize functions in
> lme4 that turns off the unwanted sanity check. The default is
> checklevels=TRUE, which maintains the previous behavior. The
> pedigreemm function is then changed to set checklevels=FALSE before
> calling the appropriate finalizing function. I'm running these
> changes locally and they seem to work fine.
>
> Comments or suggestions are welcome, as is consideration of this
> change or some variant on it for inclusion in the pedigreemm and lme4
> packages.
>
> ----- in lmer.R in the lme4 package -----
> lmer_finalize <- function(fr, FL, start, REML, verbose,
> checklevels=TRUE)
> {
> ...
> ### This checks that the number of levels in a grouping factor < n
> ### Only need to check the first factor because it is the one with
> ### the most levels.
> IF (CHECKLEVELS & !(LENGTH(LEVELS(DM$FLIST[[1]])) < LENGTH(Y)))
> ...
>
> glmer_finalize <- function(fr, FL, glmFit, start, nAGQ, verbose,
> checklevels=TRUE)
> {
> ...
> ### This checks that the number of levels in a grouping factor < n
> ### Only need to check the first factor because it is the one with
> ### the most levels.
> if (checklevels & !(length(levels(dm$flist[[1]])) < ncol(dm$Zt)))
> ...
>
> ----- in pedigree.R in the pedigreemm package -----
> pedigreemm <-
> function(formula, data, family = NULL, REML = TRUE, pedigree = list(),
> ...
> lmf$checklevels <- FALSE;
> ans <- do.call(if (!is.null(lmf$glmFit)) lme4:::glmer_finalize
> else lme4:::lmer_finalize, lmf)
> ...
>
More information about the R-sig-mixed-models
mailing list