Hi
I am hoping to use Zelig to estimate a GAM model. I have run into some
problems in generating predicted values. Specifically, the predictions I get
using Zelig don't make substantive sense and are different from predictions
I get using the mgcv package.
I have created an example of the problem using the turnout data set:
data(turnout)
#######################################
## Using Zelig
zel.out<-zelig(vote~s(age) +educate +income, sp=c(.001),
model="probit.gam", data=turnout)
pred.zel.out<-cbind(rep(NA,63), rep(NA,63))
for(i in 18:80){
x.out<-setx(zel.out, age=i)
s.out<-sim(zel.out, x=x.out)
pred.zel.out[i-17,2]<-summary(s.out)$qi.stats$pr[1]
pred.zel.out[i-17,1]<-i
}
pred.zel.out
#Note: I used a loop since the usual command (see next line) does not
work:
x.out<-setx(zel.out, age=18:80)
#######################################
#######################################
## Using MGCV:
wood<-gam(vote~s(age) +educate +income, sp=c(.001),
family=binomial(link=probit), data=turnout)
pred.wood.in<-as.data.frame(matrix(NA, 63, 3))
names(pred.wood.in)<-c("educate", "income", "age")
pred.wood.in$age<-18:80
pred.wood.in$educate<-x.out$educate
pred.wood.in$income<-x.out$income
pred.wood.out<-predict.gam(wood, pred.wood.in, se.fit=TRUE,
type="response") #######################################
## Compare coeff estimates from MGCV and Zelig: (Coefficients are the same)
wood$coef
zel.out$coef
wood$coef==zel.out$coef
## Compare predicted values using MGCV and Zelig:
par(mfrow=c(1,2))
plot(pred.zel.out)
lines(pred.zel.out)
plot(pred.wood.in$age, pred.wood.out$fit)
lines(pred.wood.in$age, pred.wood.out$fit)
#######################################
-
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/
Hi,
I'm using Zelig 3.3-1 in R 2.7.1 for Mac (OS 10.5.4), and there seems
to be a problem with mixed-effects models. This is the output I get
when I run the examples given in the Zelig manual for logit.mixed and
ls.mixed:
> library(Zelig)
> data(voteincome)
> z.out1 <- zelig(vote ~ education + age + female + tag(1 | state),
data=voteincome, model="logit.mixed")
Error in checkSlotAssignment(object, name, value) :
"terms" is not a slot in class "mer"
>
> z.out1 <- zelig(income ~ education + age + female + tag(1 | state),
data=voteincome, model = "ls.mixed")
Error in checkSlotAssignment(object, name, value) :
"terms" is not a slot in class "mer"
>
Is this possibly linked to the recent update of the lme4 package? I
have installed the latest version, namely 0.999375-20.
Thanks a lot,
Fabrizio
---------------------------------------------------------
Fabrizio Gilardi
Weatherhead Center for International Affairs
Harvard University
1737 Cambridge Street
Cambridge, MA 02138 (USA)
Phone +1 617 495 1467
Fax +1 617 495 8292
fgilardi(a)wcfia.harvard.edu
www.fabriziogilardi.org
---------------------------------------------------------
-
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/
I'm wondering if there is a simple way to use Zelig to compare changes in
the differences between two groups across conditions. I have two groups, I
can easily determine that the difference between them in condition1 is
signfiicant and also that the difference between them in condition2 is
significant. But I am wondering wether the change in the difference is
signfiicant -- that is, does the change from condition1 to condition2 make
them significantly more or less alike?
Donald Braman
http://www.law.gwu.edu/Faculty/profile.aspx?id=10123http://research.yale.edu/culturalcognitionhttp://ssrn.com/author=286206