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
Hi there,
I may have run into a problem with Zelig and the way it handles
weights with missing data. Here is a minimal working example of the
potential bug:
library(Zelig)
::snip::
##
## Zelig (Version 3.5-1, built: 2011-03-25)
::snip::
data(turnout)
## weights with missingness problem
w <- rep(1/nrow(turnout), times = nrow(turnout))
is.na(turnout$age) <- 1
## doesn't work
z.out1 <- zelig(vote ~ age, model = "logit", data = turnout, weights = w)
Error in model.frame.default(formula = vote ~ age, data = list(race = c(2L, :
variable lengths differ (found for '(weights)')
## works
g.out1 <- glm(vote ~ age, family=binomial(link="logit"), data =
+ turnout, weights=w)
The weights work when there is no missing data and zelig runs fine
with missing data and no weights. I'm on Ubuntu 10.04, but I've
replicated the same output on a Windows machine. Please let me know if
you need any more information.
Cheers,
matt.
~~~~~~~~~~~
Matthew Blackwell
PhD Candidate
Institute for Quantitative Social Science
Department of Government
Harvard University
url: http://people.fas.harvard.edu/~blackwel/
-
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/
Dear All:
I am using R with Zelig and Amelia to do logistic regression for a
dataset (finished Multiple Imputation using Amelia). After
experimenting with my own dataset, I have a bunch of questions as below.
I have provided an executable example FYI.
* How do I ask zelig to report, combine the results of odds ratio
and its std. error under five datasets ?
* How do I plug weight variable into Zelig function?
* How can extract the peusudo R-square for models, i.e., z.outft1
and z.out.ft2 ?
* 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.
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)
I have a problem.
Running demo(ls.mixed)
...
> s.out <- sim(z.out, x = x.low, x1 = x.high)
Error in UseMethod("fixef") :
no applicable method for 'fixef' applied to an object of class "mer"
> traceback()
2: stop(txt, domain = NA)
1: library("multcomp")
I am running
Linux lionel 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64
GNU/Linux
version.string = R version 2.11.1 (2010-05-31)
Malcolm
-
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/
Dear Zelig developpers:
I am using R with Zelig and Amelia to do logistic regression for a
dataset (finished Multiple Imputation using Amelia). After
experimenting with my own dataset, I have a bunch of questions as below.
I have provided an executable example FYI.
* How do I ask zelig to report, combine the results of odds ratio
and its std. error under five datasets ?
* How do I plug weight variable into Zelig function?
* How can extract the peusudo R-square for models, i.e., z.outft1
and z.out.ft2 ?
* 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.
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)