[R] yet another lmer question

Andrew Gelman gelman at stat.columbia.edu
Sat Jan 28 18:09:56 CET 2006


I've been trying to keep track with lmer, and now I have a couple of 
questions with the latest version of Matrix (0.995-4).  I fit 2 very 
similar models, and the results are severely rounded in one case and 
rounded not at all in the other.

 > y <- 1:10
 > group <- rep (c(1,2), c(5,5))
 > M1 <- lmer (y ~ 1 + (1 | group))
 > coef(M1)
$group
  (Intercept)
1         3.1
2         7.9

 > x <- rep (c(1,2), c(3,7))
 > M2 <- lmer (y ~ 1 +  x + (1 + x | group))
 > coef(M2)
$group
  (Intercept)        x
1   -0.755102 2.755102
2    0.616483 3.640738

I can't figure out why everything is rounded for the first model but not 
for the second.  Also, mcmcsamp() works for M1 but not for M2:

 > mcmcsamp(M1)
     (Intercept) log(sigma^2) log(grop.(In))
[1,]    9.099073    0.5711817       3.246981
attr(,"mcpar")
[1] 1 1 1
attr(,"class")
[1] "mcmc"

 > mcmcsamp(M2)
Error: inconsistent degrees of freedom and dimension
Error in t(.Call("mer_MCMCsamp", object, saveb, n, trans, PACKAGE = 
"Matrix")) :
        unable to find the argument 'x' in selecting a method for 
function 't'


-- 
Andrew Gelman
Professor, Department of Statistics
Professor, Department of Political Science
gelman at stat.columbia.edu
www.stat.columbia.edu/~gelman

Tues, Wed, Thurs:  
  Social Work Bldg (Amsterdam Ave at 122 St), Room 1016
  212-851-2142
Mon, Fri:
  International Affairs Bldg (Amsterdam Ave at 118 St), Room 711
  212-854-7075

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




More information about the R-help mailing list