coxph_fw {psfmi} | R Documentation |
Predictor selection function for forward selection of Cox regression models in single complete dataset.
Description
coxph_bw
Forward selection of Cox regression models in single complete
dataset using as selection method the partial likelihood-ratio statistic.
Usage
coxph_fw(
data,
formula = NULL,
status = NULL,
time = NULL,
predictors = NULL,
p.crit = 1,
cat.predictors = NULL,
spline.predictors = NULL,
int.predictors = NULL,
keep.predictors = NULL,
nknots = NULL
)
Arguments
data |
A data frame. |
formula |
A formula object to specify the model as normally used by coxph. See under "Details" and "Examples" how these can be specified. |
status |
The status variable, normally 0=censoring, 1=event. |
time |
Survival time. |
predictors |
Character vector with the names of the predictor variables. At least one predictor variable has to be defined. Give predictors unique names and do not use predictor name combinations with numbers as, age2, gnder10, etc. |
p.crit |
A numerical scalar. P-value selection criterium. A value of 1 provides the pooled model without selection. |
cat.predictors |
A single string or a vector of strings to define the categorical variables. Default is NULL categorical predictors. |
spline.predictors |
A single string or a vector of strings to define the (restricted cubic) spline variables. Default is NULL spline predictors. See details. |
int.predictors |
A single string or a vector of strings with the names of the variables that form an interaction pair, separated by a “:” symbol. |
keep.predictors |
A single string or a vector of strings including the variables that are forced in the model during predictor selection. All type of variables are allowed. |
nknots |
A numerical vector that defines the number of knots for each spline predictor separately. |
Details
A typical formula object has the form Surv(time, status) ~ terms
. Categorical variables has to
be defined as Surv(time, status) ~ factor(variable)
, restricted cubic spline variables as
Surv(time, status) ~ rcs(variable, 3)
. Interaction terms can be defined as
Surv(time, status) ~ variable1*variable2
or Surv(time, status) ~ variable1 + variable2 +
variable1:variable2
. All variables in the terms part have to be separated by a "+".
Value
An object of class smods
(single models) from
which the following objects can be extracted: original dataset as data
, final selected
model as RR_model_final
, model at each selection step RR_model
,
p-values at final step multiparm_final
, and at each step as multiparm
,
formula object at final step as formula_final
,
and at each step as formula_step
and for start model as formula_initial
,
predictors included at each selection step as predictors_in
, predictors excluded
at each step as predictors_out
, and time
, status
, p.crit
, call
,
model_type
, predictors_final
for names of predictors in final selection step and
predictors_initial
for names of predictors in start model and keep.predictors
for
variables that are forced in the model during selection.
Author(s)
Martijn Heymans, 2021
References
http://missingdatasolutions.rbind.io/
Examples
lbpmicox1 <- subset(psfmi::lbpmicox, Impnr==1) # extract first imputed dataset
res_single <- coxph_bw(data=lbpmicox1, p.crit = 0.05, formula=Surv(Time, Status) ~
Previous + Radiation + Onset + Age + Tampascale +
Pain + JobControl + factor(Satisfaction),
spline.predictors = "Function",
nknots = 3)
res_single$RR_model_final
res_single$multiparm_final