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/
Hi everyone,
I'm trying to run a factor analysis with imputed data in Zelig. Here's
my code:
>z.out <- zelig(cbind(simp3, Cert2, Source9, Source7, simp10,Cert10,
Just19, Cert8, Source22, Cert11,simp19, Cert1, Just12, Cert5, simp9,
simp20, Cert3, source5, simp13, simp12, simp1, source17, cert14, cert15,
Just17, source21, Just14, simp15, simp18, Just22, Just25, Just20,
source19, source10, Cert4, source4, Cert9, simp2, simp17, simp7, just24,
just8, Cert13, just16, source11, cert17, Cert18, simp8, just21,
source18, cert12, source16, simp11, source6, just1, just6, just26,
source13, just15, Source1, Cert7, simp14, source8, source15, just3,
source12, just23, source14, just11, simp16, just9, just10, source2,
Cert6, just13, just5, Cert19, just7, just18, simp4, simp6, just2, just4,
cert16, just27, simp5, source20, cert20), factors=5, model=
"factor.bayes", data = mi(outdata1, outdata2, outdata3, outdata4,
outdata5), cite=F)
The problem is that when I try to run this code I get the following
error message:
"Error in cbind(simp3, Cert2, Source9, Source7, simp10, Cert10, Just19, :
object 'simp3' not found"
If I remove variable simp3 it just continues down the list of
variables. I checked and R is reading my data correctly and I did
import the data with "header=TRUE" just to make sure the variable names
would be read. I've looked through the manual, but can't find an
explanation for the error. Any help would be greatly appreciated.
Laura
-
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 zelig for estimating and simulating a mixed effect logit
model. The lme4 package, which Zelig used as the default, yield a
false convergence, while the experimental lme4a package yields
convergence and reasonable estimates. My question is: is it possible
to modify Zelig slightly to use lme4a instead of lme4 as the
underlying estimation engine for generalized linear mixed effect model
for this particular case? Many thanks.
Best,
Shige
-
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/
Sorted it - just needed to insert command:
k.x.out$nasal_ocular[k.x.out$nasal_ocular==1] <- 0
after setx.
Thought I'd post, in case of use to someone else (or more likely myself in a
years time).
> -----Original Message-----
> From: Stephen Kay
> Sent: 11 November 2010 14:31
> To: 'zelig(a)lists.gking.harvard.edu'
> Subject: Calculating conditional ATT using regression ran over full
> sample not just controls
>
> Hi,
>
> I've trying to utilise Matchit and zelig together to produce a
> conditional ATT quantity. Published examples show how to do this when the
> parametric model coefficient estimates are obtained from zelig from
> running the model just over the control units (with suitable weights
> obtained from Matchit). My control sample is really too small to
> accurately estimate these coefficients. My adapted code is below, which
> runs without errors, but produces an estimate that (I think) are too far
> near zero and statistically insignificant. It's certainly much smaller
> than the relevant highly statistically significant treatment coefficient
> in the parametric model.
>
> I've a feeling the actual ATT estimate I'm producing is the average
> difference between the actual dependent outcome value and its predicted
> value in the treated group. Possibly the "sim" command doesn't realise the
> treatment/control binary indicator needs to be set to 0 in the data matrix
> input from the "setx" output to estimate the counterfactual (not sure from
> reading help file)? Any help is much appreciated - especially suggested
> code changes. Many thanks from an R and zelig novice.
>
> In code below "ocular_nasal" is my treatment/control binary indicator
> variable with 1 = treatment; and 0 = control.
>
> k.match.out<- matchit(nasal_ocular ~ m_age + m_bmi + smoke, data = k.gsk,
> distance = "mahalanobis", method = "genetic", discard = "both", ratio =
> 1,pop.size=400, int.seed=3313)
>
> k.z.out <- zelig(RQ_Act ~ nasal_ocular + m_age + m_bmi + smoke, model =
> "ls", data = match.data(k.match.out))
>
> k.x.out <- setx(k.z.out,fn = NULL, data = match.data(k.match.out,
> "treat"), cond = TRUE)
> set.seed(3251)
> k.s.out <- sim(k.z.out, x=k.x.out, num=1000)
> summary(k.s.out)
>
> Many thanks,
> Stephen
> Stephen Kay ¦ Director of Statistics
> for Adelphi Real World (Manchester)
> Adelphi Mill, Bollington, Cheshire SK10 5JB UK
>
>
> Web: http://www.adelphigroup.com/companies/company_real_world.asp
> <http://www.adelphigroup.com/companies/company_real_world.asp>
>
> Adelphi retains ownership of all DSP data and fieldwork materials. In
> accordance with the company's Terms and Conditions, written prior approval
> must be obtained with regard to any use of the data in any items submitted
> for publication or for use in marketing materials.
>
> Please consider the environment before printing this e-mail
>
>
>
DISCLAIMER: The information in this message is confidential and may be
legally privileged. It is intended solely for the addressee. Access to this
message by anyone else is unauthorised. If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful. Please immediately contact the sender if you have received this
message in error. Thank you.
Hi,
I've trying to utilise Matchit and zelig together to produce a conditional
ATT quantity. Published examples show how to do this when the parametric
model coefficient estimates are obtained from zelig from running the model
just over the control units (with suitable weights obtained from Matchit).
My control sample is really too small to accurately estimate these
coefficients. My adapted code is below, which runs without errors, but
produces an estimate that (I think) are too far near zero and statistically
insignificant. It's certainly much smaller than the relevant highly
statistically significant treatment coefficient in the parametric model.
I've a feeling the actual ATT estimate I'm producing is the average
difference between the actual dependent outcome value and its predicted
value in the treated group. Possibly the "sim" command doesn't realise the
treatment/control binary indicator needs to be set to 0 in the data matrix
input from the "setx" output to estimate the counterfactual (not sure from
reading help file)? Any help is much appreciated - especially suggested code
changes. Many thanks from an R and zelig novice.
In code below "ocular_nasal" is my treatment/control binary indicator
variable with 1 = treatment; and 0 = control.
k.match.out<- matchit(nasal_ocular ~ m_age + m_bmi + smoke, data = k.gsk,
distance = "mahalanobis", method = "genetic", discard = "both", ratio =
1,pop.size=400, int.seed=3313)
k.z.out <- zelig(RQ_Act ~ nasal_ocular + m_age + m_bmi + smoke, model =
"ls", data = match.data(k.match.out))
k.x.out <- setx(k.z.out,fn = NULL, data = match.data(k.match.out, "treat"),
cond = TRUE)
set.seed(3251)
k.s.out <- sim(k.z.out, x=k.x.out, num=1000)
summary(k.s.out)
Many thanks,
Stephen
Stephen Kay ¦ Director of Statistics
for Adelphi Real World (Manchester)
Adelphi Mill, Bollington, Cheshire SK10 5JB UK
Web: http://www.adelphigroup.com/companies/company_real_world.asp
<http://www.adelphigroup.com/companies/company_real_world.asp>
Adelphi retains ownership of all DSP data and fieldwork materials. In
accordance with the company's Terms and Conditions, written prior approval
must be obtained with regard to any use of the data in any items submitted
for publication or for use in marketing materials.
Please consider the environment before printing this e-mail
DISCLAIMER: The information in this message is confidential and may be
legally privileged. It is intended solely for the addressee. Access to this
message by anyone else is unauthorised. If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful. Please immediately contact the sender if you have received this
message in error. Thank you.