Description Usage Arguments Value See Also Examples
Run vglm()
on a master data set and each of a list of data sets created from it (often
using create.sampdata()
), saving original model object, all successful model objects,
and number of models with errors.
1 2 | multi.bootstrap(org.data, data.sets, ref.outcome, multi.form,
n.boot = length(data.sets)/1.25, xvar = "Exposure")
|
org.data |
Original data set, of class |
data.sets |
List of data sets with same variables as |
ref.outcome |
Integer; level of outcome variable to use as reference. |
multi.form |
Formula used for all models. |
n.boot |
Integer representing number of successful model fits required. Defaults to
80% of length of |
xvar |
String to include in printed status updates. Defaults to "Exposure." |
List of 1) org.model
(model fit to org.data
); 2) boot.models
(fits for all successful models); and 3) num.failed
(number of models which failed).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | df <- data.frame(id = sample(1:20, size = 100, replace = TRUE),
x1 = rnorm(n = 100),
x2 = rbinom(p = 0.75, n = 100, size = 1),
y = sample(LETTERS[1:3], size = 100, replace = TRUE))
df <- df[order(df$id),]
df$time <- unlist(lapply(1:length(unique(df$id)),
FUN = function(idnum){ 1:nrow(df[df$id == unique(df$id)[idnum],]) }))
## Using create.sampdata(), generate list of cluster bootstrapped data sets
bootdata.list <- create.sampdata(org.data = df,
id.var = 'id',
n.sets = 25)
## Fit model to original and bootstrapped data frame,
## saving errors and warnings to .txt file
boot.fits.a <- multi.bootstrap(org.data = df,
data.sets = bootdata.list,
ref.outcome = grep('A', levels(df$y)),
multi.form = as.formula('y ~ x1 + x2'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.