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 |
scores |
Score matrix of the parameters, which can be obtained using the
|
hessian |
Hessian matrix of the parameters, which can be obtained using the
|
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
in the model
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
.
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)