boot.se: Compute bootstrap standard errors

View source: R/MPMutils.R

boot.seR Documentation

Compute bootstrap standard errors

Description

Compute bootstrap standard errors (SE) for a given (generalized) linear model.

Usage

boot.se(fit, boot, probs = c(0.025, 0.975), z0 = 1.96, b0 = 0, ...)

Arguments

fit

An object of class glm or lm.

boot

A bootstrapped model object (see the examples section).

probs

Bootstrap intervals (default = c(0.025, 0.975)).

z0

z-score under null hypothesis (default = 1.96).

b0

Effect size under null hypothesis (default = 0).

...

Currently ignored.

Value

A data.frame of 9 columns:

  1. "Variable", variable name;

  2. "Estimate", parameter (effect size) estimate;

  3. "se.boot", bootstrap standard error;

  4. "lower", confidence interval lower bound;

  5. "upper", confidence interval upper bound;

  6. "conf.level", confidence level;

  7. "method", estimation method;

  8. "z", z-score = (estimate - b0)/SE;

  9. "P", 2-sided p-value; i.e., 2*pnorm(-abs(z)).

Author(s)

Fernando Palluzzi fernando.palluzzi@gmail.com

References

Pruim R, Kaplan DT, Horton NJ (2017). The mosaic Package: Helping Students to 'Think with Data' Using R. The R Journal, 9(1), 77–102. <https://journal.r-project.org/archive/2017/RJ-2017-024/index.html>

See Also

See p.boot for performance indices bootstrap confidence intervals. See also do for resampling.

Examples


# Dichotomized dataset creation
x <- dichotomize(mpm.us, asFactor = TRUE)

# Model specification
model <- formula(paste0(c("y ~ shortAxis + cortical + hilum + ",
                          "inflammatoryStroma + extracapsularSpread + ",
                          "ecostructure + FID + VFL + corticalThickening + ",
                          "vascularPattern + CMID + shape + grouping + ",
                          "colorScore"), collapse = ""))

# Binomial model fitting (MLE)
fit <- glm(model, data = x, family = "binomial")

# Binomial model fitting
n.reps <- 100
boot <- mosaic::do(n.reps) * coef(glm(model, data = mosaic::resample(x),
                                      family = "binomial"))

# Bootstrap SE calculation
SE <- boot.se(fit, boot)
print(SE)


Morphonodepredictivemodel/morphonode documentation built on Feb. 15, 2023, 4:51 a.m.