sandwich_se {CIEE}R Documentation

Sandwich standard error estimates

Description

Function to obtain consistent and robust sandwich standard error estimates based on estimating equations, for the parameter estimates of the get_estimates function, under the GLM or AFT setting for the analysis of a normally-distributed or censored time-to-event primary outcome.

Usage

sandwich_se(setting = "GLM", scores = NULL, hessian = 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.

scores

Score matrix of the parameters, which can be obtained using the scores function.

hessian

Hessian matrix of the parameters, which can be obtained using the hessian function.

Details

Under the GLM setting for the analysis of a normally-distributed primary outcome Y, robust sandwich standard error estimates are obtained for the estimates of the parameters \alpha_0, \alpha_1, \alpha_2, \alpha_3, \sigma_1^2, \alpha_4, \alpha_{XY}, \sigma_2^2 in the model

Y = \alpha_0 + \alpha_1 \cdot K + \alpha_2 \cdot X + \alpha_3 \cdot L + \epsilon_1, \epsilon_1 \sim N(0,\sigma_1^2)

Y^* = Y - \overline{Y} - \alpha_1 \cdot (K-\overline{K})

Y^* = \alpha_0 + \alpha_{XY} \cdot X + \epsilon_2, \epsilon_2 \sim N(0,\sigma_2^2)

by using the score and hessian matrices of the parameters.

Under the AFT setting for the analysis of a censored time-to-event primary outcome, robust sandwich standard error estimates are similarly obtained of the parameter estimates of \alpha_0, \alpha_1, \alpha_2, \alpha_3, \sigma_1, \alpha_4, \alpha_{XY}, \sigma_2^2. For more details and the underlying model, see the vignette.

Value

Returns a vector with the CIEE sandwich standard error estimates of the parameter estimates.

Examples


# Generate data including Y, K, L, X under the GLM setting
dat <- generate_data(setting = "GLM")

# Obtain estimating functions expressions
estfunct <- est_funct_expr(setting = "GLM")

# Obtain point estimates of the parameters
estimates <- get_estimates(setting = "GLM", Y = dat$Y, X = dat$X,
                           K = dat$K, L = dat$L)

# Obtain matrices with all first and second derivatives
derivobj <- deriv_obj(setting = "GLM", logL1 = estfunct$logL1,
                      logL2 = estfunct$logL2, Y = dat$Y, X = dat$X,
                      K = dat$K, L = dat$L, estimates = estimates)

# Obtain score and hessian matrices
results_scores <- scores(derivobj)
results_hessian <- hessian(derivobj)

# Obtain sandwich standard error estimates of the parameters
sandwich_se(scores = results_scores, hessian = results_hessian)


[Package CIEE version 0.1.1 Index]