fit_yreg {regmedint} | R Documentation |
Fit a model for the outcome given the treatment, mediator, and covariates.
Description
The outcome model type yreg
can be one of the following "linear"
, "logistic"
, "loglinear"
(implemented as modified Poisson), "poisson"
, "negbin"
, "survCox"
, "survAFT_exp"
, or "survAFT_weibull"
.
Usage
fit_yreg(
yreg,
data,
yvar,
avar,
mvar,
cvar,
emm_ac_yreg = NULL,
emm_mc_yreg = NULL,
eventvar,
interaction
)
Arguments
yreg |
A character vector of length 1. Outcome regression type: |
data |
Data frame containing the following relevant variables. |
yvar |
A character vector of length 1. Outcome variable name. It should be the time variable for the survival outcome. |
avar |
A character vector of length 1. Treatment variable name. |
mvar |
A character vector of length 1. Mediator variable name. |
cvar |
A character vector of length > 0. Covariate names. Use |
emm_ac_yreg |
A character vector of length > 0. Effect modifiers names. The covariate vector in treatment-covariate product term in the outcome model. |
emm_mc_yreg |
A character vector of length > 0. Effect modifiers names. The covariate vector in mediator-covariate product term in outcome model. |
eventvar |
An character vector of length 1. Only required for survival outcome regression models. Note that the coding is 1 for event and 0 for censoring, following the R survival package convention. |
interaction |
A logical vector of length 1. The presence of treatment-mediator interaction in the outcome model. Default to TRUE. |
Details
The outcome regression functions to be called are the following:
-
"linear"
lm
-
"logistic"
glm
-
"loglinear"
glm
(modified Poisson) -
"poisson"
glm
-
"negbin"
glm.nb
-
"survCox"
coxph
-
"survAFT_exp"
survreg
-
"survAFT_weibull"
survreg
Value
Model fit object from on of the above regression functions.