Hello Zelig, I'm new to the list, so first of all, thank you for
Zelig, it's simply fantastic.
I am creating a web-interface for Zelig, but it kept returning errors
when running sim(). I finally figured out the problem: when the
'model' argument from the zelig() function is specified from a
variable instead of directly, it seems to work fine when fitting the
model, but you run into problems at the simulation step. An example:
library(Zelig);
data(macro);
myModel <- zelig(gdp~year+country,model="normal",data=macro);
x.out <- setx(myModel,country="Japan");
sim(myModel,x.out); #this works OK!
library(Zelig);
data(macro);
modeltype <- "normal";
myModel <- zelig(gdp~year+country,model=modeltype,data=macro); #it
looks like it works fine...
x.out <- setx(myModel,country="Japan"); # still looks OK...
sim(myModel,x.out); #but fails here.
Because the error that is returned by sim is not too helpful ("'match'
requires vector arguments") it is quite confusing what exactly went
wrong. Hopefully it can be fixed, or at least return a more
informative error.
thank you!
Jeroen Ooms
j.c.l.ooms(a)uu.nl
Department of Methodology & Statistics
Utrecht University
-
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/
Hello Zelig people,
I am having difficulty simulating from ls.mixed. My code and errors
are below:
> model <- zelig(y.sn ~
violator.democracy7*duration*violator.ratified +
violator.ratified*victim.ratified + Aerial + Armistice + CBW + POWs +
Civilians + Cultural + HighSeas + powerbal + tag(1 |violatorccode/
victimccode), model="ls.mixed", data=morrow)
>
> x <- setx(model, fn=list(ordered = median, others = mode,
numeric=mean), duration=log(46):log(1182), violator.democracy7=1,
violator.ratified=0)
Warning messages:
1: In FUN(X[[1L]], ...) :
There is more than one mode. The first level is selected.
2: In FUN(X[[1L]], ...) :
There is more than one mode. The first level is selected.
> x1 <- setx(model, fn=list(ordered = median, others = mode,
numeric=mean), duration=log(46):log(1182), violator.democracy7=1,
violator.ratified=1)
Warning messages:
1: In FUN(X[[1L]], ...) :
There is more than one mode. The first level is selected.
2: In FUN(X[[1L]], ...) :
There is more than one mode. The first level is selected.
> s.out1 <- sim(model, x)
(Intercept) violator.democracy7 duration violator.ratified
victim.ratified Aerial Armistice CBW POWs Civilians Cultural HighSeas
powerbal violator.democracy7:duration
violator.democracy7:violator.ratified duration:violator.ratified
violator.ratified:victim.ratified
violator.democracy7:duration:violator.ratified
Error in gammas[[names(rTerms[i])]] %*% t(as.matrix(rTerms[[i]])) :
requires numeric matrix/vector arguments
> s.out2 <- sim(model, x1)
(Intercept) violator.democracy7 duration violator.ratified
victim.ratified Aerial Armistice CBW POWs Civilians Cultural HighSeas
powerbal violator.democracy7:duration
violator.democracy7:violator.ratified duration:violator.ratified
violator.ratified:victim.ratified
violator.democracy7:duration:violator.ratified
Error in gammas[[names(rTerms[i])]] %*% t(as.matrix(rTerms[[i]])) :
requires numeric matrix/vector arguments
When I use a nearly identical specification with plain old least
squares, I do not get the error with sim or the warnings with setx.
It is clearly not a bug with ls.mixed, as I get no errors when I work
through the voteincome example from the manual.
Ideas?
Thanks,
Keith Schnakenberg
-
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/
Dear List Members,
I faced the following Error when experimenting around with the example
given with the ls.mixed function in the zelig manual.
Error in checkSlotAssignment(object, name, value) :
"terms" is not a slot in class "mer"
I use R 2.7.1 with the latest Zelig version 3.3-1.
My next question is about the use of AIC and BIC with imputed datasets I
want to build a mixed model with imputed datasets and obtain the AIC and
BIC for model comparison. Can somebody can give me a example how this
could be accomplished?
Thanks in advance,
Tim
-
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/