Kusuke and Gary,
As I've been testing out past programs for my upcoming class, I've found
another possible bug in Zelig.
The following worked fine under R 2.1.1. However, it does not work under R
2.3.1.
Here are the commands and output. I can provide the data if you need it.
ShipAccidents <- read.table("C:/Documents and
Settings/B. Dan Wood/My
Documents/My Teaching/Maximum
Likelihood/Data/ShipAccidents.txt",
+ header=TRUE, na.strings=".")
attach(ShipAccidents)
# Let's go ahead and remove the missing values
from the dataset.
detach(ShipAccidents)
ShipAccidents <- na.omit(ShipAccidents)
attach(ShipAccidents)
ShipAccidents$Logmonths <- log(Months)
detach(ShipAccidents)
attach(ShipAccidents)
library(Zelig)
Loading required package: boot
Attaching package: 'boot'
The following object(s) are masked _by_ .GlobalEnv :
logit
The following object(s) are masked from package:car :
logit
##
## Zelig (Version 2.6-3, built: 2006-06-19)
## Please refer to
http://gking.harvard.edu/zelig for full documentation
## or help.zelig() for help with commands and models supported by Zelig.
##
Attaching package: 'Zelig'
The following object(s) are masked _by_ .GlobalEnv :
sim
poisson.out <- zelig(Acc ~ TB + TC + TD + TE +
T6569+ T7074 + T7579 +
O7579 + Logmonths,
+ model = "poisson", data = ShipAccidents)
summary(poisson.out)
Call:
zelig(formula = Acc ~ TB + TC + TD + TE + T6569 + T7074 + T7579 +
O7579 + Logmonths, model = "poisson", data = ShipAccidents)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.657 -0.887 -0.484 0.479 2.744
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -5.619 0.874 -6.43 1.3e-10 ***
TB -0.359 0.270 -1.33 0.1836
TC -0.762 0.338 -2.25 0.0243 *
TD -0.131 0.297 -0.44 0.6582
TE 0.270 0.242 1.11 0.2649
T6569 0.662 0.154 4.30 1.7e-05 ***
T7074 0.760 0.178 4.27 2.0e-05 ***
T7579 0.361 0.247 1.46 0.1438
O7579 0.370 0.118 3.13 0.0018 **
Logmonths 0.906 0.102 8.91 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05
'.' 0.1 ' ' 1
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 614.539 on 33 degrees of freedom
Residual deviance: 38.132 on 24 degrees of freedom
AIC: 156
Number of Fisher Scoring iterations: 5
means.out <- setx(poisson.out)
means.out
(Intercept) TB TC TD TE T6569 T7074 T7579 O7579
Logmonths
1 1 0.2059 0.2059 0.2059 0.1765 0.2941 0.2941 0.1765 0.5882
7.049
fitted.out <- sim(poisson.out, x = means.out)
Error in sim(poisson.out, x = means.out) :
unused argument(s) (x ...)
summary(fitted.out)
Error in summary(fitted.out) : object "fitted.out" not found
Logmonths.low <- setx(poisson.out, Logmonths =
mean(Logmonths))
Logmonths.high <- setx(poisson.out, Logmonths =
mean(Logmonths) +
sd(Logmonths))
fd.Logmonth <- sim(poisson.out, x = Logmonths.low,
x1 = Logmonths.high)
Error in sim(poisson.out, x = Logmonths.low, x1 = Logmonths.high) :
unused argument(s) (x ...)
summary(fd.Logmonth)
Error in summary(fd.Logmonth) : object "fd.Logmonth" not found
Best,
Dan
B. Dan Wood
Professor and University Faculty Fellow
Department of Political Science
Texas A&M University
4348 TAMUS
College Station, TX 77843-4348
Phone Numbers
Office: 979-845-1610
Home: 979-690-0390
Cell: 979-204-9147
FAX: 979-847-8924
Email: bdanwood(a)polisci.tamu.edu
Homepage:
http://www-polisci.tamu.edu/faculty/wood/