Unfortunately, I don't think we have an automated procedure for everything. You would have to multiply impute the data, do matching on each imputed data set, and then combine it in zelig() using mi() function. But this does not require any programming. You can simply run the same matching procedure on each data set via matchit() and then feed the resulting multiple matched data sets into zelig().
Good luck,
Kosuke
Department of Politics
Princeton University
http://imai.princeton.edu
On Sep 13, 2011, at 6:02 PM, Pingaul jb wrote:
> Dear Professor,
> I’m a post-doctoral student at Montreal University. I’m actually in Columbia, working and propensity scores with a colleague and using MatchIt and Zelig. First, congratulations for your packages that are very flexible.
>
> My question is about multiple imputation and propensity scores with these softwares. From what I understand, combining both approaches would include:
>
> 1/ Doing multiple imputation and testing which variables to include.
>
> 2/ Propensity score analysis on each imputed data set and pooling the overall balance to check if it is ok (or on each data set?).
>
> 3/ Calculation of the quantities of interest for each data set
>
> 4/ Pooling the quantities across data sets.
>
> I would like to know if there is a written syntax to perform the MatchIt analysis for all of the imputed data set without having to do it manually and check the overall balance. Also, in theory, the number of individuals retained after propensity score matching and the weights can be different for each imputed data set. So that we have to perform the final analysis on each one and then pool the data with a specific procedure to take into account the eventual varying Ns? I normally use Mice package for multiple imputation but it seems that Zelig handle Amelia. My colleague seems to do be able to do all that in stata, but I’m not sure how to make all the three R packages work together.
>
> I would be very happy if you could indicate to me a reference or a place where I can find the syntax to do that (I’ve been using R for some times so I can use packages easily but I have no programming skills).
>
>
> Best Regards!
>
>
>
> Jean-Baptiste
>
-
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/
*Please, let me know how can I install ZeligMultinomial package. I want to
use mlogit, which according to the manual (page 50), is found in said
package.
I tried with the command,
install.packages("ZeligMultinomial", repos="http://r.iq.harvard.edu/",
type="source")
But received the following message:
Warning: dependency 'MNP' is not available
trying URL '
http://r.iq.harvard.edu/src/contrib/ZeligMultinomial_0.5-4.tar.gz'
Content type 'application/x-gzip' length 9730 bytes
opened URL
==================================================
downloaded 9730 bytes
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_TIME failed, using "C"
3: Setting LC_MESSAGES failed, using "C"
4: Setting LC_PAPER failed, using "C"
ERROR: dependency 'MNP' is not available for package 'ZeligMultinomial'
* removing
'/Library/Frameworks/R.framework/Versions/2.14/Resources/library/ZeligMultinomial'
The downloaded packages are in
'/private/var/folders/UL/ULLu+bi5GR8IM1G-7XZBJU+++TI/-Tmp-/Rtmp6jw6M9/downloaded_packages'
Warning message:
In install.packages("ZeligMultinomial", repos = "http://r.iq.harvard.edu/",
:
installation of package 'ZeligMultinomial' had non-zero exit status
***
Hi. I'm trying to use Zelig to analyze some survey data that contain anchoring vignettes. I know that the 'anchors' R package also may be used for parametric analysis of anchoring vignettes, but the benefit of Zelig is the ability to get quantities of interest (e.g., predicted probabilities) and simulate counterfactuals (plus, I'd like to compare the chopit results to a naive ordered probit model). In any case, chopit seems to run fine but I'm running into an error when using the setx command that I can't figure out (I'm a seasoned Stata user, but R's error messages usually baffle me). Here is a bit of output (for brevity I do not include the parameter estimates):
> #Using Zelig
> fml <- list(self = y ~ male + educ + as.factor(regwho), vign = cbind(ns1, ns2, ns3, ns4, ns5) ~ 1, tau = ~ male + factor(regwho))
>
> z.out <- zelig(fml, data = list(self = whsc, vign = whsc), model = "chopit")
chopit() will be identified/normalized by:
1. omitting the intercept in mu, (constant set to zero is beta.(Intercept) )
2. setting variance of first self question to 1
NOTE: analytical gradients are being employed
initial value 803201.040424
iter 10 value 485484.642061
iter 20 value 482529.754368
iter 30 value 482173.043022
iter 40 value 473363.721902
iter 50 value 464296.593358
iter 60 value 461466.659722
iter 70 value 461318.256986
final value 461318.256969
converged
How to cite this model in Zelig:
Kosuke Imai, Gary King, and Oliva Lau. 2007. "chopit: Compound Hierarchical Ordinal Probit Regression for Survey Vignettes" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
> summary(z.out)
ANCHORS: SUMMARY OF RELATIVE CHOPIT ANALYSIS:
[output omitted...]
Number of cases that contribute at least partially to likelihoods:
a) in self-responses: 62421
b) in vign-responses: 62826
> xc.out <- setx(z.out)
Error in eval(expr, envir, enclos) : object 'y' not found
I also note that the chopit demo for Zelig hangs at the 'sim' stage, but I gather this is some other error.
> demo(chopit)
demo(chopit)
---- ~~~~~~
Type <Return> to start :
> data(free1, free2)
> ## Setting up the formula as a list for the self-response,
> ## vignettes, and the cut points (drawn from both the self-response
> ## and vignette data sets).
> formulas <- list(self = y ~ sex + age + factor(country),
+ vign = cbind(v1, v2, v3, v4, v5) ~ 1,
+ tau = ~ sex + age + factor(country))
> ## Setting up the data as a list, one data set corresponding to the
> ## self-response, and one to the vignette responses. Note that the
> ## tau variables must be in both data sets.
> data <- list(self = free1, vign = free2)
> z.out <- zelig(formulas, data = data, model = "chopit")
chopit() will be identified/normalized by:
1. omitting the intercept in mu, (constant set to zero is beta.(Intercept) )
2. setting variance of first self question to 1
NOTE: analytical gradients are being employed
initial value 6625.675854
iter 10 value 4224.619177
iter 20 value 4157.894719
iter 30 value 3988.857712
iter 40 value 3804.978832
iter 50 value 3749.792462
iter 60 value 3749.728152
iter 70 value 3749.728150
final value 3749.728150
converged
How to cite this model in Zelig:
Kosuke Imai, Gary King, and Oliva Lau. 2007. "chopit: Compound Hierarchical Ordinal Probit Regression for Survey Vignettes" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
> user.prompt()
Press <return> to continue:
> ## Using defaults
> x.out1 <- setx(z.out)
> s.out1 <- sim(z.out, x = x.out1)
Error in UseMethod("vcov") :
no applicable method for 'vcov' applied to an object of class "anchors.chopit"
In addition: Warning messages:
1: In demo(chopit) : Demo for topic ‘chopit’' found more than once,
using the one found in ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Zelig/demo’
2: In FUN(X[[1L]], ...) :
There is more than one mode. The first level is selected.
I'd be very grateful if someone could suggest any possible solutions or could identify what I am doing wrong. I'm using RStudio 0.96.304 and Zelig (Version 3.5.5, built: 2010-01-20) on a Mac Pro (OS Lion)
Cheers,
Sam
__________________________________________
Sam Harper
Department of Epidemiology, Biostatistics & Occupational Health
McGill University
514.398.2856 phone
514.398.4503 fax
sam.harper(a)mcgill.ca<mailto:sam.harper@mcgill.ca>
http://people.mcgill.ca/samuel.harper
Hi. I'm trying to use Zelig to analyze some survey data that contain anchoring vignettes. I know that the 'anchors' R package also may be used for parametric analysis of anchoring vignettes, but the benefit of Zelig is the ability to get quantities of interest (e.g., predicted probabilities) and simulate counterfactuals (plus, I'd like to compare the chopit results to a naive ordered probit model). In any case, chopit seems to run fine but I'm running into an error when using the setx command that I can't figure out (I'm a seasoned Stata user, but R's error messages usually baffle me). Here is a bit of output (for brevity I do not include the parameter estimates):
> #Using Zelig
> fml <- list(self = y ~ male + educ + as.factor(regwho), vign = cbind(ns1, ns2, ns3, ns4, ns5) ~ 1, tau = ~ male + factor(regwho))
>
> z.out <- zelig(fml, data = list(self = whsc, vign = whsc), model = "chopit")
chopit() will be identified/normalized by:
1. omitting the intercept in mu, (constant set to zero is beta.(Intercept) )
2. setting variance of first self question to 1
NOTE: analytical gradients are being employed
initial value 803201.040424
iter 10 value 485484.642061
iter 20 value 482529.754368
iter 30 value 482173.043022
iter 40 value 473363.721902
iter 50 value 464296.593358
iter 60 value 461466.659722
iter 70 value 461318.256986
final value 461318.256969
converged
How to cite this model in Zelig:
Kosuke Imai, Gary King, and Oliva Lau. 2007. "chopit: Compound Hierarchical Ordinal Probit Regression for Survey Vignettes" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
> summary(z.out)
ANCHORS: SUMMARY OF RELATIVE CHOPIT ANALYSIS:
[output omitted...]
Number of cases that contribute at least partially to likelihoods:
a) in self-responses: 62421
b) in vign-responses: 62826
> xc.out <- setx(z.out)
Error in eval(expr, envir, enclos) : object 'y' not found
I also note that the chopit demo for Zelig hangs at the 'sim' stage, but I gather this is some other error.
> demo(chopit)
demo(chopit)
---- ~~~~~~
Type <Return> to start :
> data(free1, free2)
> ## Setting up the formula as a list for the self-response,
> ## vignettes, and the cut points (drawn from both the self-response
> ## and vignette data sets).
> formulas <- list(self = y ~ sex + age + factor(country),
+ vign = cbind(v1, v2, v3, v4, v5) ~ 1,
+ tau = ~ sex + age + factor(country))
> ## Setting up the data as a list, one data set corresponding to the
> ## self-response, and one to the vignette responses. Note that the
> ## tau variables must be in both data sets.
> data <- list(self = free1, vign = free2)
> z.out <- zelig(formulas, data = data, model = "chopit")
chopit() will be identified/normalized by:
1. omitting the intercept in mu, (constant set to zero is beta.(Intercept) )
2. setting variance of first self question to 1
NOTE: analytical gradients are being employed
initial value 6625.675854
iter 10 value 4224.619177
iter 20 value 4157.894719
iter 30 value 3988.857712
iter 40 value 3804.978832
iter 50 value 3749.792462
iter 60 value 3749.728152
iter 70 value 3749.728150
final value 3749.728150
converged
How to cite this model in Zelig:
Kosuke Imai, Gary King, and Oliva Lau. 2007. "chopit: Compound Hierarchical Ordinal Probit Regression for Survey Vignettes" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
> user.prompt()
Press <return> to continue:
> ## Using defaults
> x.out1 <- setx(z.out)
> s.out1 <- sim(z.out, x = x.out1)
Error in UseMethod("vcov") :
no applicable method for 'vcov' applied to an object of class "anchors.chopit"
In addition: Warning messages:
1: In demo(chopit) : Demo for topic ‘chopit’' found more than once,
using the one found in ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Zelig/demo’
2: In FUN(X[[1L]], ...) :
There is more than one mode. The first level is selected.
I'd be very grateful if someone could suggest any possible solutions or could identify what I am doing wrong. I'm using RStudio 0.96.304 and Zelig (Version 3.5.5, built: 2010-01-20) on a Mac Pro (OS Lion)
Cheers,
Sam
__________________________________________
Sam Harper
Department of Epidemiology, Biostatistics & Occupational Health
McGill University
514.398.2856 phone
514.398.4503 fax
sam.harper(a)mcgill.ca<mailto:sam.harper@mcgill.ca>
http://people.mcgill.ca/samuel.harper
I am attempting to fit a relogit model in Zelig 4.0-10, R 2.15.1, and
ZeligCommon 0.1.
For simplicities sake, say I am using a binary outcome variable (outcome)
and one dummy predictor (iv). The error reproduces regardless of
combination of predictors and whether or not I use a single value for tau.
The error is also reproducible using the examples in the Zelig relogit
vignette.
Call: z.out <- zelig(outcome ~ iv, data = data, model = "relogit", tau =
c(.001, .005))
Error:
Error in as.name(zelig2$.function) :
attempt to use zero-length variable name
Traceback:
3: as.name(zelig2$.function)
2: zelig.call(Call, zclist, remove)
1: zelig(outcome ~ pred, data = data, model = "relogit", tau = c(0.001,
0.005))