Provides the degrees of freedom for flexible continuous covariates in multivariate additive Cox models.
dfmacox(time, time2=NULL, status, nl.predictors, other.predictors,
smoother, method, mindf=NULL, maxdf=NULL, ntimes=NULL, data)
An object of class list
, basically a list including the elements:
Degrees of freedom of the 'nl.predictors'.
Akaike’s Information Criterion score of the fitted model.
Corrected Akaike’s Information Criterion score of the fitted model.
Bayesian Information Criterion score of the fitted model.
Fitted (additive Cox) model based on the chosen degrees of freedom.
The method used for obtaining the degrees of freedom.
Vector with the nonlinear predictors.
For right censored data, this is the follow up time. For interval data, the first argument is the starting time for the interval.
Ending time of the interval for interval censored or counting process data only. Intervals are assumed to be open on the left and closed on the right, (start, end]. For counting process data, event indicates whether an event occurred at the end of the interval.
The status indicator, normally 0=alive, 1=dead. Other choices are TRUE/FALSE (TRUE = death) or 1/2 (2=death). For interval censored data, the status indicator is 0=right censored, 1=event at time, 2=left censored, 3=interval censored. Although unusual, the event indicator can be omitted, in which case all subjects are assumed to have an event.
Vector with covariates to be introduced in the additive Cox model with a nonlinear effect.
Vector with remaining covariates to be introduced in the additive Cox model. This will include qualitative covariates or continuous covariates with a linear effect.
Smoothing method to be used in the additive Cox model. Possible options are ‘ns’ for natural spline smoothing or ‘pspline’ for penalized spline smoothing.
The desired method to obtain the optimal degrees of freedom. If method ="AIC", then the AIC = (loglik -df) is used to choose the "optimal" degrees of freedom. The corrected AIC of Hurvich et. al. (method="AICc") and the BIC criterion (method = "BIC") can also be used.
Vector with minimum degrees of freedom for each nonlinear predictor. By default this value is a vector of of the same length of nl.predictors all with value 1, if smoother is 'ns'; a vector with the same length of nl.predictors all with value 1.5, if smoother is 'pspline'.
Vector with maximum degrees of freedom for each nonlinear predictor. By default, when penalized spline is used (smoother='pspline'), the corrected AIC from Hurvich obtained in the corresponding univariate additive Cox model is used. When penalized spline is used (smoother='ns') a vector with the same length of nl.predictors all with values 1.5.
Internel procedure which involves repetion of some convergence steps to attain the optimal degrees of freedom. By deafault is 5.
A data.frame in which to interpret the variables named in the arguments time
, time2
, and status
.
Artur Araújo and Luís Meira-Machado
Eilers, Paul H. and Marx, Brian D. (1996). Flexible smoothing with B-splines and penalties. Statistical Science, 11(2), 89-121. tools:::Rd_expr_doi("10.1214/ss/1038425655")
Hurvich, C. M. and Simonoff, J. S. and Tsai, Chih-Ling (1998). Smoothing parameter selection in nonparametric regression using an improved Akaike information criterion. JRSSB, 60(2), 271–293. tools:::Rd_expr_doi("10.1111/1467-9868.00125")
Meira-Machado, L. and Cadarso-Suárez, C. and Gude, F. and Araújo, A. (2013). smoothHR: An R Package for Pointwise Nonparametric Estimation of Hazard Ratio Curves of Continuous Predictors. Computational and Mathematical Methods in Medicine, 2013, 11 pages. tools:::Rd_expr_doi("10.1155/2013/745742")
# Example 1
library(survival)
data(whas500)
mydf_ns <- dfmacox(time="lenfol", status="fstat", nl.predictors=c("los", "bmi"),
other.predictors=c("age", "hr", "gender", "diasbp"), smoother="ns", data=whas500)
print(mydf_ns)
# Example 2
mydf_ps <- dfmacox(time="lenfol", status="fstat", nl.predictors=c("los", "bmi"),
other.predictors=c("age", "hr", "gender", "diasbp"), smoother="pspline", data=whas500)
print(mydf_ps)
Run the code above in your browser using DataLab