predVals
allows users to examine the estimated effects of input
variables on the expected outcome using the coefficients returned by
polywog
. The procedure is designed so that, for a preliminary
analysis, the user can simply specify the fitted model and the independent
variable of interest, and quickly obtain predicted values.
The predicted values are generated according to Hanmer and Kalkan's (2013)
observed-value approach, which takes the form of a nested loop. When
xvars
contains a single variable \(X_m\), the procedure is as
follows:
For each level \(x\) of \(X_m\) in data
(if \(X_m\)
is discrete) or each element \(x\) of a grid over the range of \(X_m\)
in data
(if \(X_m\) is continuous):
For each observation \(i\) of data
:
Set \(X_{mi} = x\), while holding all other variables
\(X_{-mi}\) at their observed levels
Compute the predicted value of \(Y_i\) for the modified
observation \(i\), using the estimated model coefficients (as in
predict.polywog
)
The predicted value of \(Y\) given \(X_m = x\) is the average of
the predictions computed in the previous step
This observed-value approach provides a better estimate of population
average effects for nonlinear models than does the traditional approach,
which is to vary \(X_m\) across its levels/range while holding each
other covariate to its mean or median in data
(Hanmer and Kalkan
2013).
When xvars
consists of multiple variables \(X_1, \ldots,
X_M\), the predVals
procedure is the same, except the
outer loop is over every combination of their levels in
data
.
All confidence intervals are generated via the bootstrap. Specifically,
predVals
repeats the above procedure for each set of bootstrap
coefficients and computes order statistics of the resulting set of
averages (for each combination of levels of xvars
). If
model
does not have a boot.matrix
element (see
bootPolywog
), confidence intervals will not be computed.