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 α0, α1, α2, α3, σ1^2, α4, αXY, σ2^2 in the model

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)

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 α0, α1, α2, α3, σ1, α4, αXY, σ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]