Hi Li - I do not have all the answers to these questions, but I can help in a few
instances.
How do I ask zelig to report, combine the results of
odds ratio and its std. error under five datasets ?
This one, I am unsure about.
How do I plug weight variable into Zelig function?
Simply add the weights parameter to your zelig call:
some.weights <- ...
z.out.ft1 <- zelig(tariff ~ polity + pop + gdp.pc, weights = some.weights, data =
freetrade, model = "logit")
Specify the value of the variable "some.weights" with your own values by
replacing the ellipsis on the first line with your own numeric vector.
Also, note that an additional parameter ('weights') has been added to the zelig
function call after the formula (tariff ~ polity + pop + gdp.pc). This convention follows
the format of the 'glm' function.
How can extract the peusudo R-square for models, i.e.,
z.outft1 and z.out.ft2 ?
The "pscl" contains generic methods for computing
pseudo R-squared measures. You can use these methods with Zelig by first installing the
'pscl' package:
install.packages('pscl')
Then adding the following two lines at the appropriate places:
# library ...
library(pscl)
# ...
z.out.ft1 <- zelig(tariff ~ polity + pop + gdp.pc, weights = some.weights, data =
freetrade, model = "logit")
pR2(z.out.ft1)
Under SPSS, there is a step method to run regression
models. It will show the R square(and adjusted Rsquare) change and the significance of
adding additional covariates in subsequent models. Or like Stata, I can use chow test to
test whether second model bring statistically significant explanatory power. Does R or
Zelig package has such function? I know not many people care about R square, but our
professor requires us to report the number in the final table.
I do not know much
about these features of SPSS or Stata, so I can't be of much help here.
On another note, this line:
tariff[freetrade$tariff < 31.65] <- 1; tariff[freetrade$tariff >= 31.65] <-
0
I think, should be:
freetrade$tariff[freetrade$tariff < 31.65] <- 1
freetrade$tariff[freetrade$tariff >= 31.65] <- 0
Note that the latter specifies which column to assign 0 and 1 values to, and the former
does not.
Best,
Matt
Thank you!
Best,
Li Chang
Below is the example:
library(Zelig)
library(Hmisc)
library(Amelia)
data(freetrade)
attach(freetrade)
tariff[freetrade$tariff < 31.65] <- 1; tariff[freetrade$tariff >= 31.65]
<- 0
a.out.freetrade <- amelia(freetrade, m = 5, ts = "year", cs =
"country", noms="tariff")
## I want to know odds ratio and std.error , pseudo R square( it will be great if you can
also tell me how to extract regular R-square and Adjusted R-square without manual
calculation)
z.out.ft1 <- zelig(tariff ~ polity + pop + gdp.pc, data = freetrade, model =
"logit")
summary(z.out.ft1)
## and then under model 2, I want to know the r-square change by adding "year"
and "country"
z.out.ft2 <- zelig(tariff ~ polity + pop + gdp.pc + year + country, data =
freetrade, model = "logit")
summary(z.out.ft2)
Matt
e: mowen(a)iq.harvard.edu
p: 6-6132