Description Usage Arguments Value Examples
This is a simple function that wraps lm_pai_cvboot
.
1 2 | mi_lm_pai_cvboot(formula, DV, TreatVar, data, nboot = 500, holdouts, cl,
cores, seed = 1234, boot = TRUE, yhigherisbetter = TRUE)
|
formula |
An R formula, but without dependent variable |
DV |
a character string indicating the name of the dependent variable |
TreatVar |
a character string indicating the name of the treatment variable (note that values must be coded as 0/1 for the treatment variable. |
data |
A list of imputed datasets or for a single dataset, a list of one |
nboot |
The number of bootstrap resamples to take |
holdouts |
The holdouts to be used. This should be a numeric list with as many elements desired for holdouts. For example, if the list is the same length as the number of cases and each element is one case (i.e., 1, 2, ..., N), then it is equivalent to leave-one-out. If there are ten elements, each containing approximately 1/10th of the sample, it is 10-fold cross validation, etc. If a single character string is passed, K-fold CV is assumed and holdouts are automatically constructed. |
cl |
An existing cluster to use (optional) |
cores |
The number of cores to use when creating a cluster, if an existing cluster is not passed (optional). If left blank and no cluster passed, defaults to the number of cores available. |
seed |
A seed to make the bootstrap reproducible |
boot |
A logical value whether to bootstrap or not |
yhigherisbetter |
A logical value whether higher scores indicate better treatment response on the dependent variable |
A list containing a four dimensional array of the results, as well as the input parameters for the model. For the array, the first dimension is cases, the second dimension is multiple estimates calculated, the third dimension is bootstrap resamples, and the fourth dimension is imputations.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
# builtin dataset with 32 cases
dat <- mtcars
dat$cyl <- factor(dat$cyl)
formula <- ~ cyl + am * (mpg + hp + drat + wt)
DV <- "disp"
TreatVar <- "am"
k <- 50 # use a few just for speed
holdouts <- 1:32 # for leave-one-out
m <- mi_lm_pai_cvboot(formula, DV, TreatVar, list(dat, dat),
nboot = k, holdouts = holdouts, cores = 2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.