Hi,
I'm using Zelig's ls.mixed model, and while there are instructions for how to
use `setx()' and `sim()' in the manual, trying to use sim() returns an error:
Error in .local(object, ...) : Code not written yet.
The list-serves mention similar problems, but no one has mentioned this error
code exactly. Any ideas?
Is it the same problem as lmer()has with mcmcsamp() and "non-trivial Theta"?
https://stat.ethz.ch/pipermail/r-sig-mixed-models/2008q4/001464.html
Code snippet:
#generating example data
x1<-rnorm(1000, 0, 4)
grp<-c(rep("grp1", 250), rep("grp2", 250), rep("grp3",
250), rep("grp4", 250))
createinter<-function(x){
+ if (x=="grp1"){out<-.5}
+ else if (x=="grp2"){out<-0}
+ else if (x=="grp3"){out<- -1}
+ else {out<-1}
+ }
x2<-sapply(grp, FUN=createinter)
x3<-rbinom(1000, 1, .5)
y<-4*x1+x2+2*x3+x3*x1+rnorm(1000, 0, 1)
dat<-as.data.frame(matrix(nrow=1000, ncol=4))
x3<-rbinom(1000, 1, .5)
y<-4*x1+x2+2*x3+x3*x1+rnorm(1000, 0, 1)
dat<-as.data.frame(matrix(nrow=1000, ncol=4))
x<-sim(mod1)
dat[,1:3]<-cbind(x1, x3, y)
dat[,4]<-grp
names(dat)<-c("x1", "x3", "y", "grp")
#actual problem
mod1<-zelig(y ~ x1 + x3 + x1:x3 +tag(1+x3|grp), model="ls.mixed", data=dat)
How to cite this model in Zelig:
Delia Bailey and Ferdinand Alimadhi. 2007. "ls.mixed: Mixed effects linear
model" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's
Statistical
Software,"
http://gking.harvard.edu/zelig
x<-sim(mod1)
Error in .local(object, ...) : Code not written yet
When I run it using only a random intercept (i.e. tag(1|grp)), I get a different
error after trying sim(). The new error is
Error in `[.data.frame`(x, , fTermsNames) : undefined columns selected
Thanks for any help or suggestions.
Michael Donnelly
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options:
http://lists.gking.harvard.edu/?info=zelig
Zelig program information:
http://gking.harvard.edu/zelig/