Good morning
If I run
<<<
susan.lsmixed.out <- zelig(formula = unprot_vag_sex ~ married + age + TREATMENT.ARM*time + highest_grade + income + tag(1|id),
data = susanMI.out$imputations, model = "ls.mixed")
summary(susan.lsmixed.out)
>>>>
I get an error
Error in x$coef : $ operator is invalid for atomic vectors
Searching the archives, I see that others have had similar problems. Is there a workaround?
summary(susan.lsmixed.out[[1]])
works fine; should I then average across the five imputed data sets?
thanks!
Peter
Peter L. Flom, PhD
Statistical Consultant
Website: http://www DOT statisticalanalysisconsulting DOT com/
Writing; http://www.associatedcontent.com/user/582880/peter_flom.html
Twitter: @peterflom
-
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,
I am trying to run a multilevel probit model using Zelig, but keep receiving
the following error message: " in .deparseTag(TT.vars[[vind]]) : wrong use
of tag function!!"
A simplified version of the model I am trying to run is:
z.out <- zelig(formula= list(mu=investment.binary ~ edlevel +
tag(1 + edlevel, gamma | country),
gamma = ~ tag(GDPpc06.full| country)), data=data2006.mod1,
model="probit.mixed")
What I would like to do is allow the intercept and the edlevel variable
listed within the first tag() to vary by country as a function of the
GDPpc06.full variable, all of which are included in the same dataframe. I
followed the syntax here - http://cran.r-project.org/web/packages/Zelig
/vignettes/probit.mixed.pdf - but I think that I am incorrectly specifying
the gamma part of the syntax, which may be causing the error.
I *am* able to get the model to run when I allow the intercept and edlevel
variable to vary using the following syntax:
z.out <- zelig(investment.binary ~ edlevel +
+ tag(1 + edlevel | country),
data=data2006.mod1, model="probit.mixed")
However, this syntax does not allow me to specify that the intercept and
edlevel variable should vary as a function of GDPpc06.full, as in the first
model specified above. I have tried including multiple tags at the
non-group level of the model specification - i.e. one for the intercept and
one for the edlevel variable - but this does not seem to work either.
Do you have any suggestions for how to fix the syntax?
Sincerely,
Jason
--
Jason I. McMann
PhD Student | Department of Politics
Princeton University | jmcmann(a)princeton.edu
Dear all,
I am working on the necessary extensions to Zelig to allow it to use the 'plm' package, which puts TSCS linear models in a more familiar form to economists/political scientists than the lme4/nmle packages do.
I've got everything working, I think, but one thing. In the following output, you can see that the first column of summary results picks up the name of the first case in the data frame. (plm uses a special data.frame method called pdata.frame(), which sets time and cross- sectional indexes within the frame itself.) I've checked the results otherwise, and they appear to be good, so I think that this is a formatting issue, and a cursory examination of the other Zelig code leads me to believe that the Zelig's summary method is just picking up the index of the first case in the data frame. The "Alabama-1970" looks ugly, as well as being potentially confusing.
Is there a way to easily keep Zelig from doing what's immediately below and retain the more default formatting?
(I've also pasted output from a ls model in the Zelig manual below the first pasted text, to give an easy and quick comparison.)
-Nathan
PLM module output:
> > summary(s.plm2)
>
> Model: plm
> Number of simulations: 1000
>
> Values of X
> (Intercept) log(pcap) log(pc) log(emp) unemp
> ALABAMA-1970 1 10.12810 10.97144 7.465713 7.9
>
> Values of X1
> (Intercept) log(pcap) log(pc) log(emp) unemp
> ALABAMA-1970 1 10.12810 10.97144 7.465713 5
>
> Expected Values: E(Y|X)
> mean sd 2.5% 97.5%
> ALABAMA-1970 8.623364 0.1773169 8.288714 8.965831
>
> First Differences in Expected Values: E(Y|X1)-E(Y|X)
> mean sd 2.5% 97.5%
> ALABAMA-1970 0.01523238 0.002951307 0.009241061 0.02127007
Normal OLS Zelig output:
> summary(s.out1)
>
> Model: ls
> Number of simulations: 1000
>
> Values of X
> (Intercept) gdp capmob trade
> 1 1 3.254223 -0.8914286 57.07625
>
> Expected Values: E(Y|X)
> mean sd 2.5% 97.5%
> 1 4.994367 0.1431317 4.704167 5.26888
-----
Nathan Paxton
napaxton(a)gmail.com
(I can) Stand up for hope, faith, love
But while I'm getting over certainty
Stop helping God across the road like a little old lady.
—U2
Dear all,
I ran into some strange results when using Zelig's 'relogit' when using weighting as case correction. The resulting coefficients differed vastly from the ones calculated using normal logistic regression. I believe the problem is in the 'relogit.R' code in the line 70 which is part of the bias correction:
xi <- 0.5 * Qdiag * ((1+w0)*pihat-w0)
At least according to "King & Zeng (2001): Logistic regression in Rare Events Data" the correction should instead be:
xi <- 0.5 * Qdiag * ((1+w1)*pihat-w1)
This is also the way the model has been documented in the Zelig manual (except for a tiny typo in the subscript, there is w-1 instead of w_1).
Is this indeed a bug or have i missed something?
Best,
Ilkka
Ilkka Anttila
Research assistant, Institute of Strategy
Aalto University School of Science
Dear all,
I am using the "by" call to estimate models on subsets of my data
frame. Is there a way to separate the output such that one R object
exists for each factor level?
Ultimately I am trying to use various packages (apsrtable, xtable) to
generate LaTeX-friendly tables. These require a separate object for
each model estimated.
Thanks,
Jack
-
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 All:
I have a basic question about multiple imputation. I have a survey
dataset (16000 cases) with 950 cases having zero weight. Do I need to
keep those cases in my dataset or drop them before MI? Thanks!
Li Chang
2012 M.A. Candidate
Economics and Education
Teachers College, Columbia 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/