[R-sig-ME] Function sim() from the arm package
David Atkins
datkins at u.washington.edu
Wed Jan 12 05:13:03 CET 2011
Murray--
I don't get any errors:
> # Example 2
> u.full <- u[group]
> E2 <- lmer (y ~ x + u.full + (1 | group))
> display(E2)
lmer(formula = y ~ x + u.full + (1 | group))
coef.est coef.se
(Intercept) 1.26 2.63
x -3.21 0.70
u.full 2.65 1.28
Error terms:
Groups Name Std.Dev.
group (Intercept) 2.58
Residual 6.30
---
number of obs: 120, groups: group, 15
AIC = 796, DIC = 796.2
deviance = 791.1
> E2.sim <- sim (E2)
>
> E2.sim
An object of class "sim.mer"
Slot "fixef":
(Intercept) x u.full
[1,] -3.6238231 -1.651003 2.97416811
[2,] 5.5573135 -4.345756 1.65055163
[3,] 2.5591835 -4.159338 3.08245982
[4,] -1.3003909 -2.638501 3.65089192
[5,] 0.4542183 -3.897383 4.03465437
Perhaps updating to current R and relevant packages? (sessionInfo below)
cheers, Dave
> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] splines stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] foreign_0.8-41 arm_1.3-08 car_2.0-9
survival_2.36-2
[5] nnet_7.3-1 abind_1.3-0 R2WinBUGS_2.1-16
coda_0.14-2
[9] lme4_0.999375-37 Matrix_0.999375-47 lattice_0.19-17
MASS_7.3-9
loaded via a namespace (and not attached):
[1] grid_2.12.1 nlme_3.1-97 stats4_2.12.1 tools_2.12.1
I am getting unexpected behaviour from the sim() function of the arm
package for the book "Data Analysis Using Regression and
Multilevel/Hierarchical Models" by Gelman & Hill:
Running the example all is fine until
> # Example 2
> u.full <- u[group]
> E2 <- lmer (y ~ x + u.full + (1 | group))
> display(E2)
lmer(formula = y ~ x + u.full + (1 | group))
coef.est coef.se
(Intercept) 0.73 0.16
x -0.28 0.04
u.full 0.16 0.08
Error terms:
Groups Name Std.Dev.
group (Intercept) 0.16
Residual 0.37
---
number of obs: 120, groups: group, 15
AIC = 131.9, DIC = 98.3
deviance = 110.1
> E2.sim <- sim (E2)
Called from: getAugmentedDesignMatrix(model)
Browse[1]> 3+4
[1] 7
Browse[1]> #
Browse[1]>
>
The output
Called from: getAugmentedDesignMatrix(model)
and the change of the prompt to
Browse[1]>
are unexpected and seem to interfere with the running of some scripts
associated with the book, in particular those connected with the
earnings versus height data set.
I am running R 2.11.1 on Windows XP but I think the packages are at 2.10.1.
Murray
--
Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: maj at waikato.ac.nz Fax 7 838 4155
Phone +64 7 838 4773 wk Home +64 7 825 0441 Mobile 021 0200 8350
--
Dave Atkins, PhD
Research Associate Professor
Department of Psychiatry and Behavioral Science
University of Washington
datkins at u.washington.edu
Center for the Study of Health and Risk Behaviors (CSHRB)
1100 NE 45th Street, Suite 300
Seattle, WA 98105
206-616-3879
http://depts.washington.edu/cshrb/
(Mon-Wed)
Center for Healthcare Improvement, for Addictions, Mental Illness,
Medically Vulnerable Populations (CHAMMP)
325 9th Avenue, 2HH-15
Box 359911
Seattle, WA 98104
http://www.chammp.org
(Thurs)
More information about the R-sig-mixed-models
mailing list