[R] Example of mcmcsamp() failing with lmer() output
Douglas Bates
bates at stat.wisc.edu
Sun Apr 29 17:00:36 CEST 2007
On 4/27/07, Michael Kubovy <kubovy at virginia.edu> wrote:
> Hi,
>
> I would appreciate help with the following model
>
> <<1>>=
> gunload <- read.table(hh('datasets/gunload.dat'), header = T)
> gunload$method <- factor(gunload$method, labels = c('new', 'old'))
> gunload$physique <- factor(gunload$group, labels = c('slight',
> 'average', 'heavy'))
> gunload$team9 <- factor(rep(1:9, each = 2))
> @
>
> This is a split plot design with randomly selected teams for each
> physique, which was crossed with two methods.
>
> Following the Oats example in chap. 1 of MEMSS, and adapting to lmer:
>
> <<2>>=
> require(lme4)
> gl.lmer <- lmer(rounds ~ method * physique + (1 | physique/team),
> data = gunload)
> mcmcsamp(gl.lmer)
> @
> lmer runs as expected, but mcmcsamp() gives:
> Error: Leading minor of order 1 in downdated X'X is not positive
> definite
> Error in t(.Call(mer_MCMCsamp, object, saveb, n, trans, verbose,
> deviance)) :
> error in evaluating the argument 'x' in selecting a method for
> function 't'
I think you are overfitting the model - you have a fixed effect for
physique and a random effect for physique. This is not the same as
the Oats example where there is a fixed effect for variety and a
random effect for variety within block, which designates the plot
within the block.
Try fitting the model with the random effects as (1|physique:team)
and you will see that you get the same fitted values but you are able
to run mcmcsamp on this fit.
> I tried:
>
> <<3>>=
> require(nlme)
> gl.lme <- lme(rounds ~ method * physique, random = ~1 | physique/
> team, data = gunload)
> @
> which gave all the expected output except that two p-values were NaN.
>
> Which aspect of the data is making the simulation fail, and is there
> anything to be done about it?
>
> _____________________________
> Professor Michael Kubovy
> University of Virginia
> Department of Psychology
> USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
> Parcels: Room 102 Gilmer Hall
> McCormick Road Charlottesville, VA 22903
> Office: B011 +1-434-982-4729
> Lab: B019 +1-434-982-4751
> Fax: +1-434-982-4766
> WWW: http://www.people.virginia.edu/~mk9y/
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list