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,
Here is my model:
p.out1.1 <- zelig(protest1 ~ civil1.d + repress1 + repress2 + repress1.civil1.d + repress2.civil1.d + sex + educ + age1 + wealthy + remit + enough + internet + grievance + deprivation + satisfy + support + democracy + corruption + interest + mexico + guatemala + elsalvador + honduras + nicaragua + costarica + panama + colombia + ecuador + bolivia + paraguay + chile + uruguay + brazil + venezuela + argentina + dominicanrep + haiti + jamaica + belize + us + canada, model="probit.survey", data=mydata, weights=~weight, x=TRUE)
x.1 <- setx(p.out1.1, civil1.d=0, repress1=0, repress2=0, repress1.civil1.d=0, repress2.civil1.d=0, sex=1, remit=0, mexico=0, guatemala=0, elsalvador=0, honduras=0, nicaragua=0, costarica=0, panama=0, colombia=0, ecuador=0, bolivia=0, paraguay=0, chile=0, uruguay=0, brazil=0, venezuela=0, argentina=0, dominicanrep=0, haiti=0, jamaica=0, belize=0, us=0, canada=0)
When I display x.1, it looks fine. all variables are at the desired value. However, when I do the following:
s.out1 <- sim(p.out1.1, x = x.1)
R returns "Error in qi.svyglm(object, simpar = simpar, x = x, x1 = x1, y = NULL) : subscript out of bounds"
Do you have any idea what this problem is?
I appreciate your help
Jun-deh
Hi,
I got a problem when I use the "as.factor" and "setx" command. Respondensts in the dataset I used come from 20 countries (coded as 1 to 20). I use as.factor to generate country dummies and run a probit regression like this: p.out <- zelig(y ~ x1 + x2 + as.factor(country), model="probit.survey", data=mydata, weights=~weight, x=TRUE).
As a result, summary(p.out) returns coefficients of x1, x2, and 19 country dummies labeled as as.factor(country)2, as.factor(country)3......as.factor(country)20.
When I use "setx" and "sim" commands to calculate first difference, I need to set values for these country dummies. Supposed that a typical case is from country 3, I therefore need to set the dummy of country 3 = 1, else 0. However, I have difficulty in setting these values.
When I do x.low <- setx(p.out, x1=1, x2=0, country=c(rep(0,2),1,rep(0,17))), x.high <- setx(p.out, x1=1, x2=1, country=c(rep(0,2),1,rep(0,17))), they are fine. But fd <- sim(p.out, x=x.low, x1=x.high) returns "Error in coef %*% t(x) : non-conformable arguments"
I have tried different ways to set values for these country dummies. The only way that sim command works is to do x.low <- setx(p.out, x1=1, x2=0, country=c(seq(1,20))), x.low <- setx(p.out, x1=1, x2=1, country=c(seq(1,20))), and then do fd <- sim(p.out, x=x.low, x1=x.high). This setting doesn't make sense, but it can make "sim" run. However, When I run summary(fd), I found that all country dummies are set at 0.05.
How do I set values for these country dummies?
Thank you very much
Jun-deh Wu
Ph.D candidate
University of North Texas
Hi there,
I have a question about validation. First off, I would like to be able to use the validate.lrm() function, however I believe that it is not supported to put zelig functions into it yet... Is there any other options to use this using Zelig outputs at the moment?
i.e.
fit <- zelig(Y_bin ~ TMIN_WI + TMAX_SU, model = "relogit", tau = 0.0076, case.control = "weighting", robust = TRUE, data = table, x=TRUE,y=TRUE)
where Y_bin is a dichotomous variable. You need to add the x=TRUE and y=TRUE, following the methodology on the function manual.
Then I try to put it into a cross validation or bootstrap function with some test values and I get the following errors:
> validate(fit, method=”boot”,B=10)
Error: unexpected input in " validate(fit, method=”"
> validate(fit, B=10)
Error in UseMethod("validate") :
no applicable method for 'validate' applied to an object of class "c('relogit', 'glm.robust')"
My second question is for the cv.glm function, which I thought was supported:
cv.out <-cv.glm(z.out, data = table)
it again gives a similar error:
Error in UseMethod("predict") :
no applicable method for 'predict' applied to an object of class "c('relogit', 'glm.robust')"
Could you offer any suggestions as to what may be missing here?
Thanks
-
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,
Probably a ridiculously simple question I know, but how do I interpret the output to the cross validation (the delta values) in relation to the relogit output? I assume I need to compare it to the MSE from the original model. I know how to calculate MSE, and I see the qi$ev predicted probabilties, but what do I compare this to? Do I need to calculate observed probabilities through a standard glm model, compute MSE between that and qi$ev, then look at the % difference between MSE from original and the delta values?
I've also tried calculating the sum of squares of the residuals (from z.out) and dividing that by the degrees of freedom but this seems very low compared to the delta values.
Thanks
-
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 maintainers,
when I compute the example in the vignette for the relogit model all runs fine.
Once I want to specify the case.correct option I get the following error message:
> z.out1 <- zelig(conflict ~ major + contig + power + maxdem + mindem + years, data = mid, model = "relogit", case.correct="weighting")
error in glm.control(...) :
unused argument(s) (case.correct = "weighting")
> z.out1 <- zelig(conflict ~ major + contig + power + maxdem + mindem + years, data = mid, model = "relogit", case.correct="prior")
errorr in glm.control(...) :
unused argument(s) (case.correct = "prior")
Also with a fixed tau parameter the error message occurs:
> z.out1 <- zelig(conflict ~ major + contig + power + maxdem + mindem + years, data = mid, tau=0.05, model = "relogit", case.correct="weighting")
error in glm.control(...) :
unused argument(s) (case.correct = "weighting")
> z.out1 <- zelig(conflict ~ major + contig + power + maxdem + mindem + years, data = mid, tau=0.05, model = "relogit", case.correct="prior")
error in glm.control(...) :
unused argument(s) (case.correct = "prior")
It seems that setting this option is not accepted by the zelig() command or the glm.control() command it calls.
Can you help me with this problem.
Thank you very much in advance! And, of course, thank very very much for all your effort with Zelig.
With best wishes,
Jens
Prof. Dr. Jens Krüger
Darmstadt University of Technology
Department of Law and Economics
Empirical Economics
Marktplatz 15
Residenzschloss
D-64283 Darmstadt
Germany
Tel.: +49/6151/16-3693
Fax: +49/6151/16-3897
Email: jjk(a)vwl.tu-darmstadt.de
-
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/