[R] mcmcsamp() in lmer

Andrew Gelman gelman at stat.columbia.edu
Thu Jan 19 04:00:53 CET 2006

I am working with lmer() in the latest release of Matrix, doing various 
things including writing a function called mcsamp() that acts as a 
wrapper for mcmcsamp() and automatically runs multiple chains, diagnoses 
convergence, and stores the result as a bugs object so it can be 
plotted.  I recognize that at this point, mcmcsamp() is somewhat of a 
placeholder (since it doesn't work on a lot of models) but I'm sure it 
will continue to be improved so I'd like to be able to work with it, as 
a starting point if necessary.

Anyway, I couldn't get mcmcsamp() to work with the saveb=TRUE option.  
Here's a simple example:

y <- 1:10
group <- rep (c(1,2), c(5,5))
M1 <- lmer (y ~ 1 + (1 | group))   # works fine
mcmcsamp (M1)                         # works fine
mcmcsamp (M1, saveb=TRUE)

This last gives an error message:

Error in "colnames<-"(`*tmp*`, value = c("(Intercept)", "log(sigma^2)",  :
        length of 'dimnames' [2] not equal to array extent

Thanks for your help.

Andrew Gelman
Professor, Department of Statistics
Professor, Department of Political Science
gelman at stat.columbia.edu

Tues, Wed, Thurs:  
  Social Work Bldg (Amsterdam Ave at 122 St), Room 1016
Mon, Fri:
  International Affairs Bldg (Amsterdam Ave at 118 St), Room 711

Mailing address:
  1255 Amsterdam Ave, Room 1016
  Columbia University
  New York, NY 10027-5904
  (fax) 212-851-2164

More information about the R-help mailing list