traditional_regression_functions {CIEE} | R Documentation |
Traditional regression approaches.
Description
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.
Usage
mult_reg(setting = "GLM", Y = NULL, X = NULL, K = NULL, L = NULL,
C = NULL)
res_reg(Y = NULL, X = NULL, K = NULL, L = NULL)
Arguments
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). |
Details
In more detail, for a quantitative normally-distributed primary outcome
Y
, mult_reg
fits the model
and obtains point and standard error estimates for the parameters
.
res_reg
obtains point and standard
error estimates for the parameters
by fitting the models
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.
Value
Returns a list with point estimates of the parameters
point_estimates
, standard error estimates SE_estimates
and p-values pvalues
.
Examples
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)