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
1)What exactly does the setx and sim commands do? I understand that
setx sets the different predictors to different levels, and that these
values are used for the simulation. Would this be the same as plugging
the same values into the regression model with their associated betas
and calculate Y using linearhypothesis (from the car-library) or is
the sim command doing something entirely different?
2)Also, How can I do cox regression diagnostics using zelig? I get an
error msg after doing
zelig.p2<-zelig(Surv(month,as.numeric(status))~A+B+C+D+E,model="coxph",data=p.match)
plot(zelig.p2)
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' is a list, but does not have components 'x' and 'y'
3)Also when I try
x0<-setx(zelig.p2,A=0,C=60)
x1<-setx(zelig.p2,B=1,C=60)
sim.a<-sim(zelig.p2,x=x0,x1=x1)
the following happens:
Error in eval(expr, envir, enclos) : object 'B' not found
despite doing
str(p.match$B)
Factor w/ 2 levels "O","P": 1 1 2 1 2 2 2 2 1 1 ...
//M
-
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/
I'm a real R novice, and I'm having trouble grabbing factor scores from a
Bayesian factor analysis and dropping them into my original dataset. I just did
a simple factor analysis on four variables with one hypothesized factor using
the "factor.mix" model. I saved the factor scores and was able to display them
using the summary command. However, at that point I'm stuck. I could obviously
copy and paste the values into Excel and work with them that way, but I'd much
rather script it all. The summary object doesn't seem to be a matrix that I can
work with easily using what few basic R commands I know.
--
Dr. Jason Sorens, Assistant Professor (716) 645-8436
Dept. of Political Science http://www.acsu.buffalo.edu/~jsorens/
University at Buffalo, SUNY
520 Park Hall (North Campus)
Buffalo, NY 14260
-
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,
Zelig makes it very easy to simulate first difference (along with
predicted values, expected values, and risk ratios), is there a
convenient way to simulate second difference? For example, in the
following simple example:
------------------------------------
data(turnout)
z.out <- zelig(vote ~ race*age + educate + income,
model = "logit", data = turnout)
summary(z.out)
x.low <- setx(z.out, educate = 12)
x.high <- setx(z.out, educate = 16)
s.out <- sim(z.out, x = x.low, x1 = x.high)
------------------------------------
Now "s.out" includes the first difference between the two expected
probabilities between people with 12 years of schooling and people
with 16 years of schooling. Now I want to get the second difference
between people with 12 years of schooling and aged 20, people with 12
years of schooling and aged 30, people with 16 years of schooling and
aged 20, and people with 16 years of schooling and aged 30, will the
following code be suffice?
------------------------------------
x.low.low <- setx(z.out, educate = 12, age = 20)
x.low.high <- setx(z.out, educate = 12, age = 30)
x.high.low <- setx(z.out, educate = 16, age = 20)
x.high.high <- setx(z.out, educate = 16, age = 30)
s1 <- sim(z.out, x = x.low.low, x1 = x.low.high)
s2 <- sim(z.out, x = x.high.low, x1 = x.high.high)
did <- s1$qi$fd - s2$qi$fd
------------------------------------
Then I can conduct statistical test on the newly created "did" as
usual, for example "t.test(did)", correct? Are there other ways to do
this?
Many thanks for your input.
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/
Dear All:
I'm running an ordered probit in Zelig:
"totfb.probit <- zelig(as.factor(combined_rating) ~ tot_fb_threeyravg +
lim_go + ln_pop + ln_pci + pc_tax_effort + pc_debt,
model = "oprobit",
data = slack)"
I encounter the following error message:
"Error in svd(X) : infinite or missing values in 'x'"
There are no missing data or infinite values in the dataset, and the
model converges when I run it on sub-samples of the data. Is there a
chance that certain vectors are too large to compute the singular value
decomposition? If so, is there a solution? If something else is wrong,
how can I fix it? Thank you.
Sincerely,
--
Justin Marlowe
jmarlowe(a)washington.edu
Assistant Professor
Evans School of Public Affairs
University of Washington
Box 353055
Seattle, WA 98195-3055
SSRN: http://ssrn.com/author=522146
-
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,
New to zelig here, having a great experience so far--good work! I get
the following error when estimating the model in R with random effects
below:
> model.out <- zelig(y ~ x1 + x2 + tag(1 | FirmID), data = dat, model = "relogit")
Error in eval(expr, envir, enclos) : could not find function "tag"
Is the tag() function included in the zelig R package? I can't seem
to locate any other package that has it. Again, apologies for the
naive question as I think I'm missing something quite elementary here.
Thank you,
Dan
-
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 am getting an error message when I try to use sim() on a bivariate probit model. After setting the explanatory variables, I get the following error message:
> s.out<-sim(z.out,x.out)
Error in UseMethod("vcov") : no applicable method for 'vcov' applied to an object of class "c('vglm', 'vlm', 'vlmsmall')"
Any suggestions?
Thank you,
db
-
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/