Description Usage Arguments Details Value Examples
View source: R/se_estimates_sandwich.R
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.
1 | sandwich_se(setting = "GLM", scores = NULL, hessian = NULL)
|
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
|
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.
Returns a vector with the CIEE sandwich standard error estimates of the parameter estimates.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.