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
I am running a gamma.mixed model on data that requires the use of survey
weights. Is there a way to account for weighting in the gamma.mixed
command?
Thank you,
Alicia
--
Alicia Doyle Lynch
Statistical Trainer
Harvard MIT Data Center
1737 Cambridge Street, K318
Cambridge MA 02138
-
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,
I posted the following on the R discussion group, but this might be
relevant
here as well.
I am trying to estimate the average treatmen effect on the
treated (ATT) using first the MatchIt software to weight the data set and,
after this, the Zelig software as shown in Ho et al. (2007). This is my
source:
http://imai.princeton.edu/research/files/matchit.pdf
I encounter a slight problem when I apply the weights that are produced in
the stage of preprocessing the data. The idea of this is to use the MatchIt
software to preprocess the data and then use the Zelig software to generate
the distribution of ATT. I believe that the main reason for preprocessing
the data is to create weights (depending on the matching technique you use)
so that balance would be achieved for the matching variables between the
treatment and the control group. Then you use these weights in the
regressions that follow in the Zelig library. Copied from the matchit
article, whose link I provide above, the authors say:
"If one chooses options that allow matching with
replacement, or any solution that has different numbers of controls (or
treateds) within each
subclass or strata (such as full matching), then the parametric analysis
following matching
must accomodate these procedures, such as by using fixed effects or weights,
as appropriate.
(Similar procedures can also be used to estimate various other quantities of
interest such
as the average treatment effect by computing it for all observations, but
then one must
be aware that the quantity of interest may change during the matching
procedure as some
control units may be dropped.)"
The following code is for the "lalonde" data set, where I get an error
message in the end. I use the more recent R version (2.12.1) and have
updated
the Zelig and MatchIt libraries.
> update.packages("MatchIt")
> update.packages("Zelig")
> library(Zelig)
> library(MatchIt)
> data(lalonde)
> m.out1 = matchit(treat ~ age + educ + black + hispan + nodegree + married
+
re74 + re75, method = "subclass", subclass=6, data = lalonde)
> z.out1 = zelig(re78 ~ age + educ + black + hispan + nodegree + married +
re74
+ re75, data = match.data(m.out1, "control"), model = "ls",
weights="weights")
> x.out1 = setx(z.out1, data = match.data(m.out1, "treat"), cond = TRUE)
> s.out1 = sim(z.out1, x = x.out1)
Error in model.frame.default(formula = re78 ~ age + educ + black + hispan +
:
variable lengths differ (found for '(weights)')
I was wondering if somebody could tell me how to get around with this
problem?
Also, I have seen people adding the propensity scores in the regression
analysis applied in the Zelig package, i.e.
> z.out1 = zelig(re78 ~ age + educ + black + hispan + nodegree + married +
re74 + re75 + distance, data = match.data(m.out1, "control"), model =
"ls", weights="weights")
Does anyone have a clue of why this can happen?
Kind regards,
Sotiris