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,
Another issue with the polynomial time. Maybe it is connected to the previous one, where lmer() and zelig() don't give the same results with polynomial time as random effect.
That time, sim() doesn't work when we specify a polynomial time as random effect. But it works without polynomial time.
The error message is :
Erreur dans .local(object, ...) : Code not written yet
I posted a demo script on pastebin.com under the title "zelig() and sim() don't work with polynomial time".
Merci,
François Maurice, B. Sc., A. Stat.
Candidat à la maîtrise
Département de sociologie
Université de Montréal
Hi,
I found that zelig() and lmer() give different results with polynomial time in random effects part of the formula. But the results are identical without polynomial in random effects part.
Here's lmer() and zelig() without polynomials in the random part:
sleep.lmer <- lmer(Reaction ~ Days + Days2 + Days3 + (Days | Subject), sleepstudy.modified.2)
sleep.zelig <- zelig(Reaction ~ Days + Days2 + Days3 + tag(Days | Subject), sleepstudy.modified.2, model="ls.mixed")
Here's lmer() and zelig() with polynomials in the random part:
sleep.lmer.poly <- lmer(Reaction ~ Days + Days2 + Days3 + (Days + Days2 | Subject), sleepstudy.modified.2)
sleep.zelig.poly <- zelig(Reaction ~ Days + Days2 + Days3 + tag(Days + Days2 | Subject), sleepstudy.modified.2, model="ls.mixed")
I posted a demo script on pastebin.com under the title "zelig() vs lmer() with polynomial time".
The demo uses the sleep study data form lme4 package, wich I modified to add square and cubic time.
If I want to obtain the same results as in lmer() what can I do in zelig() ?
Merci,
François Maurice, B. Sc., A. Stat.
Candidat à la maîtrise
Département de sociologie
Université de Montréal
Hi,
Zelig seems not to pass the 'weights' argument to lmer() when using the ls.mixed model
The weights argument works properly when I use lmer() directly.
Is this a known bug ? Is there a fixe or a workaround ?
Merci,
François Maurice, B. Sc., A. Stat.
Candidat à la maîtrise
Département de sociologie
Université de Montréal
Hi,
I specified the following model in zelig() :
z.out <- zelig(qasbat ~ group + t + t2 + t3 + tag(1 + t + t2 | ID), data=matched.1.mtch.long, model="ls.mixed")
But when it comes to simulate the quantities of interest with sim(), I get the following message :
Error in .local(object, ...) : Code not written yet
Theres is no error message from sim() when I delete t and t2 from the random part in tag(). But I'd like to let the first two polynomial time (t and t2) to be random.
Am I suppose to know how to use lmer() from lme4 package ? Or is it a problem with the way I write the zelig() formula ?
To help analyse my problem I write down my model in two forms :
LEVEL FORM :
Level 1 : qasbatij = π0i + π1itimeij + π2itime2ij + π3itime3ij + εij
Level 2 : π0i = γ00 + γ01groupi + ζ0i
π 1i = γ10 + ζ1i
π 2i = γ20 + ζ2i
π 3i = γ30
ONE FORMULA FORM : Y = [Fixe part] + [Random part]
qasbatij = [γ00 + γ01groupi + γ10timeij + γ20time2ij + γ30time3ij] + [ζ0i + ζ1itimeij + ζ2itime2ij + εij]
Merci beaucoup,
François Maurice, B. Sc., A. Stat.
Candidat à la maîtrise
Département de sociologie
Université de Montréal
Hi,
I'm using ' ls.mixed ' model within Zelig to estimate causal effect of an intervention in a longitudinal study (one intervention and 8 measures after the intervention, one per year). I'm not sure to understand how to write the model in Zelig.
Here's my model in written form :
Level 1 : qasbatij = π0i + π1itimeij + π2itime2ij + π3itime3ij + εij
Level 2 : π0i = γ00 + γ01groupi + ζ0i
π 1i = γ10 + ζ1i
π 2i = γ20 + ζ2i
π 3i = γ30
qasbat is a continous outcome, group is the indicator of the treated and control group, I'm using polynomial time and I let the intercept and the first two polynomials to be random.
In SAS, I write this model like this :
proc mixed data = p_score_long method=ml noclprint covtest;
class id;
model qasbat = t t2 t3 group / s ddfm=bw notest;
random intercept t t2 / subject=id type=un;
In Zelig, I tried many formats, but Zelig seems to stall (the computing never ends). One of this format is this :
z.out <- zelig(qasbat ~ group + tag(1 + t + t*t | ID), data=matched.1.mtch.long, model="ls.mixed")
Within R, the group variable and the ID variable are numeric and the time variable is a factor.
Merci,
François Maurice
Candidat à la maîtrise
Département de sociologie
Université de Montréal
Hi,
I'm using MathcIt with Zelig to estimate a causal effect. How Zelig handle weights created by a matching method ? I try to folllow Example 4 from Zelig's demo(match). The example is about calculating the conditional average treatment effect for the entire sample using subclassification.
The example specify the 'by' argument like this : by="subclass", which is fine. But there is nothing about weights created by the subclassification mehtod.
Is the zelig() function automatically handles weignts created by any matching methods from the MatchIt package ?
If no, how to specify weights within the zelig() function ?
If yes, can I extract the match dataframe before using zelig() and thus specifying the argument 'data=matcheddata' or is it necessary to specify the argument as in the example 4 : 'data=match.data(m.out) ?
Merci,
François Maurice
Candidat à la maîtrise
Département de sociologie
Université de Montréal
Hi--
I'm wondering if mlogit.bayes can utilize complex survey data. I need
a way to account for interviewer clusters and sample weights.
thanks!
Yph
-
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/