splineCox.reg2 estimates the parameters of a five-parameter spline Cox model for multiple specified shapes
and selects the best-fitting model based on the maximization of the log-likelihood function.
This function supports predefined model shapes and custom numeric vectors of length 5.
If numeric vectors are provided, they will be normalized to have an L1 norm of 1.
Additionally, if plot = TRUE, the function generates a plot of the estimated baseline hazard function for the best-fitting model,
along with its 95% confidence intervals.
The x-axis represents time, and the y-axis represents the estimated hazard.
The solid line indicates the estimated hazard function, while the dashed red lines represent the confidence intervals.
splineCox.reg2(
t.event,
event,
Z,
xi1 = min(t.event),
xi3 = max(t.event),
model = names(shape.list),
p0 = rep(0, 1 + ncol(as.matrix(Z))),
plot = TRUE
)A list containing the following components:
model: A character string indicating the shape of the baseline hazard function used.
parameter: A numeric vector of the parameters defining the baseline hazard shape.
beta: A named vector with the estimates, standard errors, and 95\
gamma: A named vector with the estimate, standard error, and 95\
loglik: A named vector containing the log-likelihood (LogLikelihood), Akaike Information Criterion (AIC), and Bayesian Information Criterion (BIC) for the best-fitting model.
other_models: A data frame containing the log-likelihood (LogLikelihood) for all other evaluated models, with model names as row names.
plot: A baseline hazard function plot for the best-fitting model (if plot = TRUE).
a vector for time-to-event
a vector for event indicator (=1 event; =0 censoring)
a matrix for covariates; nrow(Z)=sample size, ncol(Z)=the number of covariates
lower bound for the hazard function; the default is min(t.event)
upper bound for the hazard function; the default is max(t.event)
A list of character strings and/or numeric vectors of length 5 specifying the shapes of the baseline hazard function to evaluate.
Character options include:
"increase", "constant", "decrease", "unimodal1", "unimodal2", "unimodal3", "bathtub1", "bathtub2", "bathtub3".
Numeric vectors must be of length 5 and will be normalized to have an L1 norm of 1.
Default is names(shape.list), which includes all predefined models.
Initial values to maximize the likelihood (1 + p parameters; baseline hazard scale parameter and p regression coefficients)
A logical value indicating whether to plot the estimated baseline hazard function.
If TRUE, a plot is generated displaying the estimated baseline hazard function along with its 95% confidence intervals.
The x-axis represents time, and the y-axis represents the estimated hazard.
The solid line indicates the estimated hazard function, while the dashed red lines represent the confidence intervals.
Default is TRUE.
Teranishi, R.; Furukawa, K.; Emura, T. (2025). A Two-Stage Estimation Approach to Cox Regression Under the Five-Parameter Spline Model Mathematics 13(4), 616. tools:::Rd_expr_doi("10.3390/math13040616") Available at https://www.mdpi.com/2227-7390/13/4/616
# Example data
library(joint.Cox)
data(dataOvarian)
t.event = dataOvarian$t.event
event = dataOvarian$event
Z = dataOvarian$CXCL12
M = c("constant", "increase", "decrease")
reg2 <- splineCox.reg2(t.event, event, Z, model = M)
print(reg2)
Run the code above in your browser using DataLab