regression_fit {clinpubr} | R Documentation |
Obtain regression results
Description
This function fit the regression of a predictor in a linear, logistic, or Cox proportional hazards model.
Usage
regression_fit(
data,
y,
predictor,
time = NULL,
covars = NULL,
rcs_knots = NULL,
returned = c("full", "predictor_split", "predictor_combined")
)
Arguments
data |
A data frame. |
y |
A character string of the outcome variable. The variable should be binary or numeric and determines the type of model to be used. If the variable is binary, logistic or cox regression is used. If the variable is numeric, linear regression is used. |
predictor |
A character string of the predictor variable. |
time |
A character string of the time variable. If |
covars |
A character vector of covariate names. |
rcs_knots |
The number of rcs knots. If |
returned |
The return mode of this function.
|
Value
A list containing the regression ratio and p-value of the predictor. If rcs_knots
is not NULL
,
the list contains the overall p-value and the nonlinear p-value of the rcs model. If return_full_result
is TRUE
, the complete result of the regression model is returned.
Examples
data(cancer, package = "survival")
regression_fit(data = cancer, y = "status", predictor = "age", time = "time", rcs_knots = 4)