traditional_regression_functions {CIEE} | R Documentation |
Functions to fit traditional regression approaches for a quantitative
normally-distributed primary outcome (setting
= "GLM"
)
and a censoredtime-to-event primary outcome (setting
= "AFT"
).
mult_reg
fits the multiple regression approach and
res_reg
computes the regression of residuals approach.
mult_reg(setting = "GLM", Y = NULL, X = NULL, K = NULL, L = NULL, C = NULL) res_reg(Y = NULL, X = NULL, K = NULL, L = NULL)
setting |
String with value |
Y |
Numeric input vector of the primary outcome. |
X |
Numeric input vector of the exposure variable. |
K |
Numeric input vector of the intermediate outcome. |
L |
Numeric input vector of the observed confounding factor. |
C |
Numeric input vector of the censoring indicator under the AFT setting (must be coded 0 = censored, 1 = uncensored). |
In more detail, for a quantitative normally-distributed primary outcome
Y
, mult_reg
fits the model
Y = α0 + α1*K + αXY*X + α2*L + ε
and obtains point and standard error estimates for the parameters
α0, α1, αXY, α2.
res_reg
obtains point and standard
error estimates for the parameters
α0, α1, α2, α3, αXY
by fitting the models
Y = α0 + α1*K + α2*L + ε1,
hat(ε1) = α3 + αXY*X + ε2.
Both functions use the lm
function and also report the
provided p-values from t-tests that each parameter equals 0.
For the analysis of a censored time-to-event primary outcome Y
,
only the multiple regression approach is implemented. Here,
mult_reg
fits the according censored regression model to obtain
coefficient and standard error estimates as well as p-values from large-sample
Wald-type tests by using the survreg
function.
See the vignette for more details.
Returns a list with point estimates of the parameters
point_estimates
, standard error estimates SE_estimates
and p-values pvalues
.
dat_GLM <- generate_data(setting = "GLM") mult_reg(setting = "GLM", Y = dat_GLM$Y, X = dat_GLM$X, K = dat_GLM$K, L = dat_GLM$L) res_reg(Y = dat_GLM$Y, X = dat_GLM$X, K = dat_GLM$K, L = dat_GLM$L) dat_AFT <- generate_data(setting = "AFT", a = 0.2, b = 4.75) mult_reg(setting = "AFT", Y = dat_AFT$Y, X = dat_AFT$X, K = dat_AFT$K, L = dat_AFT$L, C = dat_AFT$C)