Good day, All. I would like to run ReLogit in Zelig using a large number of time dummy
variables (to account for duration dependence), but I get an error when I try to include
all of the temporal dummies. Does anyone have any ideas as to why this might be
occurring?
The script below creates a data set that approximates the data that I'm actually
using and replicates the error that I've been experiencing. A note: the Zelig model
represented by object "b" below returns an error message that the model does not
converge. In the real data it actually does converge. The real problem is with object
"c", and I suspect it has something to do with the large number of variables,
since when I reduce the number of variables to around 40 or 50, everything if fine (or, at
least I have results that need interpreting).
Thank you very much,
Nathan
-----begin script-----
## Creating the mock data set:
# time variable:
time<-rep(c(1:150),50)
# caseid variable:
q<-c(1:50)
caseid<-rep(q,each=150)
# dependent variable:
y<-rep(0,times=7500)
y[40]<-1
y[209]<-1
y[556]<-1
y[1980]<-1
y[2297]<-1
y[2806]<-1
y[3345]<-1
y[4025]<-1
y[5567]<-1
y[6983]<-1
# independent variable:
x1<-rep(0,times=7500)
x1[27:150]<-1
x1[101:300]<-1
x1[307:450]<-1
x1[547:600]<-1
x1[1020:1050]<-1
x1[1287:1350]<-1
x1[1355:1500]<-1
x1[2333:2400]<-1
x1[2536:2550]<-1
x1[3051:3150]<-1
x1[3501:3600]<-1
x1[4408:4500]<-1
x1[5361:5400]<-1
x1[6573:6600]<-1
x1[6727:6750]<-1
x1[7159:7200]<-1
x1[7422:7500]<-1
# 150 time dummy variables:
r<-as.data.frame(matrix(0,nrow=150,ncol=150))
for(i in 1:150){r[i,i]<-1}
r$time<-c(1:150)
# joining the variables together:
X<-as.data.frame(cbind(time,caseid,y,x1))
X<-merge(X,r,by="time",all.x=T,all.y=F)
## Replicating error in Zelig
library(Zelig)
a<-zelig(y~x1,
model="relogit",robust=F,data=X)
b<-zelig(y~x1+
X[,1]+X[,2]+X[,3]+X[,4]+X[,5]+X[,6]+X[,7]+X[,8]+X[,9]+X[,10]+
X[,11]+X[,12]+X[,13]+X[,14]+X[,15]+X[,16]+X[,17]+X[,18]+X[,19]+X[,20]+
X[,21]+X[,22]+X[,23]+X[,24]+X[,25]+X[,26]+X[,27]+X[,28]+X[,29]+X[,30],
model="relogit",robust=F,data=X)
c<-zelig(y~x1+
X[,1]+X[,2]+X[,3]+X[,4]+X[,5]+X[,6]+X[,7]+X[,8]+X[,9]+X[,10]+
X[,11]+X[,12]+X[,13]+X[,14]+X[,15]+X[,16]+X[,17]+X[,18]+X[,19]+X[,20]+
X[,21]+X[,22]+X[,23]+X[,24]+X[,25]+X[,26]+X[,27]+X[,28]+X[,29]+X[,30]+
X[,31]+X[,32]+X[,33]+X[,34]+X[,35]+X[,36]+X[,37]+X[,38]+X[,39]+X[,40]+
X[,41]+X[,42]+X[,43]+X[,44]+X[,45]+X[,46]+X[,47]+X[,48]+X[,49]+X[,50]+
X[,51]+X[,52]+X[,53]+X[,54]+X[,55]+X[,56]+X[,57]+X[,58]+X[,59]+X[,60]+
X[,61]+X[,62]+X[,63]+X[,64]+X[,65]+X[,66]+X[,67]+X[,68]+X[,69]+X[,70]+
X[,71]+X[,72]+X[,73]+X[,74]+X[,75]+X[,76]+X[,77]+X[,78]+X[,79]+X[,80]+
X[,81]+X[,82]+X[,83]+X[,84]+X[,85]+X[,86]+X[,87]+X[,88]+X[,89]+X[,90]+
X[,91]+X[,92]+X[,93]+X[,94]+X[,95]+X[,96]+X[,97]+X[,98]+X[,99]+X[,100]+
X[,101]+X[,102]+X[,103]+X[,104]+X[,105]+X[,106]+X[,107]+X[,108]+X[,109]+X[,110]+
X[,111]+X[,112]+X[,113]+X[,114]+X[,115]+X[,116]+X[,117]+X[,118]+X[,119]+X[,120]+
X[,121]+X[,122]+X[,123]+X[,124]+X[,125]+X[,126]+X[,127]+X[,128]+X[,129]+X[,130]+
X[,131]+X[,132]+X[,133]+X[,134]+X[,135]+X[,136]+X[,137]+X[,138]+X[,139]+X[,140]+
X[,141]+X[,142]+X[,143]+X[,144]+X[,145]+X[,146]+X[,147]+X[,148]+X[,149]+X[,150],
model="relogit",robust=F,data=X)
-----end script-----
Nathan W. Toronto, Ph.D.
Foreign Military Studies Office
731 McClellan Avenue
Fort Leavenworth, KS 66027
913-684-5614 (office)
nathan.toronto(a)us.army.mil
-
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/