bootPolywog {polywog} | R Documentation |
Bootstrap a fitted polywog model
Description
Nonparametric bootstrap of the polywog
regression procedure.
Can be run on a fitted model of class "polywog"
, or within the
original procedure via the boot
argument. The function
control.bp
can be used to pass options to bootPolywog
when
bootstrapping within polywog
.
Usage
bootPolywog(model, nboot = 100, .parallel = FALSE, reuse.lambda = FALSE,
reuse.penwt = FALSE, nlambda = 100, lambda.min.ratio = 1e-04,
nfolds = 10, thresh = NULL, maxit = NULL, maxtries = 1000,
min.prop = 0, report = FALSE, .matrixOnly = FALSE)
control.bp(.parallel = FALSE, reuse.lambda = FALSE, reuse.penwt = FALSE,
nlambda = 100, lambda.min.ratio = 1e-04, nfolds = 10, thresh = NULL,
maxit = NULL, maxtries = 1000, min.prop = 0, report = FALSE)
Arguments
model |
a fitted model of class |
nboot |
number of bootstrap iterations. |
.parallel |
logical: whether to perform computations in parallel
using a backend registered with |
reuse.lambda |
logical: whether to use the penalization parameter from
the original fit ( |
reuse.penwt |
logical: whether to use the penalty weights from the
original fit ( |
nlambda |
number of values of the penalty factor to examine in
cross-validation, as in |
lambda.min.ratio |
ratio of the smallest value of the penalty factor
to the largest, as in |
nfolds |
number of cross-validation folds to use. |
thresh |
convergence threshold, as in |
maxit |
iteration limit for fitting, as in |
maxtries |
maximum number of attempts to generate a bootstrap sample with a non-collinear model matrix (often problematic with lopsided binary regressors) before stopping and issuing an error message. |
min.prop |
for models with a binary response variable, minimum proportion of
non-modal outcome to ensure is included in each bootstrap iteration (for
example, set |
report |
logical: whether to print a status bar. Not available if
|
.matrixOnly |
logical: whether to return just the matrix of bootstrap
coefficients ( |
Details
Parallel computation via the .parallel
argument requires
registation of a backend for %dopar%
, as
in polywog
. In the case of bootPolywog
, bootstrap
fitting is carried out in parallel, while cross-validation to choose the
penalization factor (assuming reuse.lambda = FALSE
) is carried
out sequentially within each iteration.
Value
If .matrixOnly = FALSE
, the returned object is model
with the bootstrap matrix included as its boot.matrix
element. If
.matrixOnly = TRUE
, just the matrix is returned. In either case, the
bootstrap matrix is a sparse matrix of class
"dgCMatrix"
.
Author(s)
Brenton Kenkel and Curtis S. Signorino
Examples
## Using occupational prestige data
data(Prestige, package = "carData")
Prestige <- transform(Prestige, income = income / 1000)
## Fit a polywog model without bootstrapping
## (note: using low convergence threshold to shorten computation time of the
## example, *not* recommended in practice!)
fit1 <- polywog(prestige ~ education + income + type,
data = Prestige,
degree = 2,
thresh = 1e-4)
summary(fit1)
## Bootstrap the fitted model
fit2 <- bootPolywog(fit1, nboot = 5)
summary(fit2)
## Example of parallel processing on Mac/Unix via 'doMC'
## Not run:
library(doMC)
registerDoMC()
fit2 <- bootPolywog(fit1, nboot = 100, .parallel = TRUE)
## End(Not run)
## Example of parallel processing on Windows via 'doSMP'
## Not run:
library(doSMP)
w <- startWorkers()
registerDoSMP(w)
fit2 <- bootPolywog(fit1, nboot = 100, .parallel = TRUE)
stopWorkers(w)
## End(Not run)