 
Hi,
 
My two pence worth: I would agree.  We have used a similar trick when modelling overdispersed poisson counts.  We tried using the quasipoisson family but it didn't give sensible results - it seems to return the mean as the residual variance component.  On that note it would be usefull if the use of quasipoisson was not allowed or a warning was given for the unsuspecting user.
 
Cheers,
Colin.

________________________________

From: r-sig-mixed-models-bounces@r-project.org on behalf of Bolker,Benjamin Michael
Sent: Mon 22/02/2010 22:05
To: Aaron Rendahl; David Duffy
Cc: r-sig-mixed-models@r-project.org
Subject: Re: [R-sig-ME] pedigreemm with one observation per individual




  It would be nice if this could go into the main lme4 (or lme4a?) branch -- even nicer if it could be passed through from [g]lmer -- as mentioned before, there are legitimate cases for this (modeling overdispersion at the individual level ...) ...
________________________________________
From: r-sig-mixed-models-bounces@r-project.org [r-sig-mixed-models-bounces@r-project.org] On Behalf Of Aaron Rendahl [arendahl@stat.umn.edu]
Sent: Monday, February 22, 2010 12:29 PM
To: David Duffy
Cc: r-sig-mixed-models@r-project.org
Subject: Re: [R-sig-ME] pedigreemm with one observation per individual

When trying to fit a mixed model using pedigreemm (which uses lme4)
with only one observation per individual, lme4 gives an error that the
"Number of levels of a grouping factor for the random effects must be
less than the number of observations"; which is not necessarily true
when modeling relationships between the individuals.

David Duffy suggested the kinship package, but in an off-list email,
commented on the need to get pedigreemm working, as kinship is much
slower because it uses nlme instead of lme4.

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)
...



--
Aaron Rendahl, Ph.D.
Statistical Consulting Manager
School of Statistics, University of Minnesota

NEW OFFICE (as of June 2009):
48C McNeal Hall, St. Paul Campus
612-625-1062
www.stat.umn.edu/consulting

_______________________________________________
R-sig-mixed-models@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

_______________________________________________
R-sig-mixed-models@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________



	[[alternative HTML version deleted]]


