tef_rlm_boot | R Documentation |
Run a rlm
model nBoot
times, then include the bootstrapped parameter estimates
(and summary of quantiles thereof) in the rlm output. Also includes out-of-sample
delta-R-squared. If parameter distributions are *anywhere near* decision thresholds,
using nBoot
>2000 (or even much higher) is recommended.
tef_rlm_boot(formIn, datIn, nBoot = 500, useLM = F)
formIn |
Model formula, as with |
datIn |
Data, as with |
nBoot |
Number of resamples [with replacement] |
useLM |
Override the standard |
Wraps rlm()
or lm()
and then bootstraps [fits models to datasets sampled with replacement]
that model nBoot
times. Then fits models to
nBoot random 80 percent of data and tests the delta R-squared of each numeric or logical parameter
when predicting the out-of-sample 20 percent.
An augmented rlm
or lm
object that includes
several new items: $bootSummary
, $boots
(all bootstrapped parameters),
$bootQs
(quantiles
of bootstrapped parameters), $dRsq
(all out-of-sample proportional reduction of error),
$dRsqQs
(quantiles of out-of-sample proportional reduction of error),
and $results
(strings, formatted
for RMarkdown, including whole-sample slope, bootstrapped CI, and median out-of-sample dRSq).
For an explanation specific objects see comment(model$boots)
,
comment(model$dRsq)
, or comment(model$bootSummary)
.
dat <- data.frame(x=rnorm(50))
dat$y <- dat$x + rnorm(50)
dat$z <- dat$y - rnorm(50)
dat$z[2] <- NA # the function is robust to NAs
m <- tef_rlm_boot(y~x*z,dat)
m$bootSummary # to get a summary of the fit[s]
comment(m$bootSummary) # to get an explanation of the summary data frame
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.