setx {Zelig} | R Documentation |
The setx
command 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.
x.out <- setx(object, fn = mean, data = NULL, cond = FALSE, ...)
object |
the saved output from zelig . |
fn |
a function applied to all non-factor variables.
The default function is mean. The default value for factor
variables corresponds to the value of the greatest mode. When more
than one such mode exists, the smallest value in Levels
is selected. Setting fn = median changes the value for the
non-factor variables to their medians, and factor variables may be
set by specifying exact variables. |
data |
a new data frame used to set the values of
explanatory variables. If data = NULL (the default), the
data frame called in zelig is used. |
cond |
a logical value indicating whether unconditional
(default) or conditional (choose cond = TRUE ) prediction
should be performed. If you choose cond = TRUE , setx
will ignore the arguments in fn and ... . |
... |
user-defined values of specific variables
overwriting the default values set by the function fn . For
example, adding var1 = mean(data\$var1) or x1 = 12
explicitly sets the value of x1 to 12. In addition, you may
specify one explanatory variable as a range of values, creating one
observation for every unique value in the range of values. |
Kosuke Imai <kimai@princeton.edu>; Gary King <king@harvard.edu>; Olivia Lau <olau@fas.harvard.edu>
The full Zelig manual may be accessed online at http://gking.harvard.edu/zelig.