Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bootstrap_se

Bootstrap standard error estimates


Description

Function to obtain bootstrap standard error estimates for the parameter estimates of the get_estimates function, under the generalized linear model (GLM) or accelerated failure time (AFT) setting for the analysis of a normally-distributed or censored time-to-event primary outcome.

Usage

bootstrap_se(setting = "GLM", BS_rep = 1000, Y = NULL, X = NULL,
  K = NULL, L = NULL, C = NULL)

Arguments

setting

String with value "GLM" or "AFT" indicating whether standard error estimates are obtained for a normally-distributed ("GLM") or censored time-to-event ("AFT") primary outcome Y.

BS_rep

Integer indicating the number of bootstrap samples that are drawn.

Y

Numeric input vector for the primary outcome.

X

Numeric input vector for the exposure variable.

K

Numeric input vector for the intermediate outcome.

L

Numeric input vector for the observed confounding factor.

C

Numeric input vector for the censoring indicator under the AFT setting (must be coded 0 = censored, 1 = uncensored).

Details

Under the GLM setting for the analysis of a normally-distributed primary outcome Y, bootstrap standard error estimates are obtained for the estimates of the parameters α0, α1, α2, α3, σ1^2, α4, αXY, σ2^2 in the models

Y = α0 + α1*K + α2*X + α3*L + ε1, ε1 ~ N(0,σ1^2)

Y* = Y - mean(Y) - α1*(K-mean(K))

Y* = α0 + αXY*X + ε2, ε2 ~ N(0,σ2^2),

accounting for the additional variability from the 2-stage approach.

Under the AFT setting for the analysis of a censored time-to-event primary outcome, bootstrap standard error estimates are similarly obtained of the parameter estimates of α0, α1, α2, α3, σ1, α4, αXY, σ2^2

Value

Returns a vector with the bootstrap standard error estimates of the parameter estimates.

Examples

dat <- generate_data(setting = "GLM", n = 100)

# For illustration use here only 100 bootstrap samples, recommended is using 1000
bootstrap_se(setting = "GLM", BS_rep = 100, Y = dat$Y, X = dat$X,
             K = dat$K, L = dat$L)

CIEE

Estimating and Testing Direct Effects in Directed Acyclic Graphs using Estimating Equations

v0.1.1
GPL-2
Authors
Stefan Konigorski [aut, cre], Yildiz E. Yilmaz [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.