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@mcgill.ca<mailto:sam.harper@mcgill.ca>
http://people.mcgill.ca/samuel.harper