The setx
function uses the variables identified in
the formula
generated by zelig
and sets the values of
the explanatory variables to the selected values. Use setx
after zelig
and before sim
to simulate quantities of
interest.
setx(obj, fn = NULL, data = NULL, cond = FALSE, ...)
obj | output object from |
---|---|
fn | a list of functions to apply to the data frame |
data | a new data frame used to set the values of
explanatory variables. If |
cond | a logical value indicating whether unconditional
(default) or conditional (choose |
... | user-defined values of specific variables for overwriting the
default values set by the function |
The output is returned in a field to the Zelig object. For
unconditional prediction, x.out
is a model matrix based
on the specified values for the explanatory variables. For multiple
analyses (i.e., when choosing the by
option in zelig
,
setx
returns the selected values calculated over the entire
data frame. If you wish to calculate values over just one subset of
the data frame, the 5th subset for example, you may use:
x.out <- setx(z.out[[5]])
This documentation describes the setx
Zelig 4 compatibility wrapper
function.
The full Zelig manual may be accessed online at http://docs.zeligproject.org/articles/
# Unconditional prediction: data(turnout) z.out <- zelig(vote ~ race + educate, model = 'logit', data = turnout)#> How to cite this model in Zelig: #> R Core Team. 2007. #> logit: Logistic Regression for Dichotomous Dependent Variables #> in Christine Choirat, Christopher Gandrud, James Honaker, Kosuke Imai, Gary King, and Olivia Lau, #> "Zelig: Everyone's Statistical Software," http://zeligproject.org/