Fit a new model to data created using resample(model).

relm(model, ..., envir = environment(formula(model)))

Arguments

model

a linear model object produced using lm().

...

additional arguments passed through to resample().

envir

an environment in which to (re)evaluate the linear model.

See also

Examples

mod <- lm(length ~ width, data = KidsFeet)
do(1) * mod 
#> Using parallel package.
#>   * Set seed with set.rseed().
#>   * Disable this message with options(`mosaic:parallelMessage` = FALSE)
#>   Intercept    width    sigma r.squared        F numdf dendf .row .index
#> 1  9.817212 1.657624 1.024769 0.4110041 25.81878     1    37    1      1
do(3) * relm(mod) 
#> Using parallel package.
#>   * Set seed with set.rseed().
#>   * Disable this message with options(`mosaic:parallelMessage` = FALSE)
#>   Intercept    width     sigma r.squared        F numdf dendf .row .index
#> 1 11.311765 1.475611 1.0454138 0.3469818 19.65998     1    37    1      1
#> 2  9.739407 1.670964 0.8886576 0.4853133 34.88839     1    37    1      2
#> 3 12.103496 1.425416 0.8519418 0.4274531 27.62353     1    37    1      3
# use residual resampling to estimate standard error (very crude because so few replications)
Boot <- do(100) * relm(mod)
#> Using parallel package.
#>   * Set seed with set.rseed().
#>   * Disable this message with options(`mosaic:parallelMessage` = FALSE)
sd(~ width, data = Boot)
#> [1] 0.3410556
# standard error as produced by summary() for comparison
mod |> summary() |> coef() 
#>             Estimate Std. Error  t value     Pr(>|t|)
#> (Intercept) 9.817212  2.9381078 3.341338 1.915251e-03
#> width       1.657624  0.3262257 5.081218 1.097225e-05