Title: | A Two-Stage Estimation Approach to Cox Regression Using M-Spline Function |
---|---|
Description: | Implements a two-stage estimation approach for Cox regression using five-parameter M-spline functions to model the baseline hazard. It allows for flexible hazard shapes and model selection based on log-likelihood criteria. |
Authors: | Ren Teranishi [aut, cre] |
Maintainer: | Ren Teranishi <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.0.1 |
Built: | 2024-12-19 05:40:03 UTC |
Source: | https://github.com/ren1227/splinecox |
splineCox.reg1
estimates the parameters of a five-parameter spline Cox model based on a specified shape for the baseline hazard function.
The function calculates the estimates for the model parameters (beta) and the baseline hazard scale parameter (gamma), using non-linear optimization.
splineCox.reg1( t.event, event, Z, xi1 = min(t.event), xi3 = max(t.event), model = "constant", p0 = rep(0, 1 + ncol(as.matrix(Z))) )
splineCox.reg1( t.event, event, Z, xi1 = min(t.event), xi3 = max(t.event), model = "constant", p0 = rep(0, 1 + ncol(as.matrix(Z))) )
t.event |
a vector for time-to-event |
event |
a vector for event indicator (=1 event; =0 censoring) |
Z |
a matrix for covariates; nrow(Z)=sample size, ncol(Z)=the number of covariates |
xi1 |
lower bound for the hazard function; the default is min(t.event) |
xi3 |
upper bound for the hazard function; the default is max(t.event) |
model |
A character string specifying the shape of the baseline hazard function. Available options include: "increase", "constant", "decrease", "unimodal1", "unimodal2", "unimodal3", "bathtub1", "bathtub2", "bathtub3". Default is "constant" |
p0 |
Initial values to maximize the likelihood (1 + p parameters; baseline hazard scale parameter and p regression coefficients) |
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% confidence intervals for the regression coefficients |
gamma |
A named vector with the estimate, standard error, and 95% confidence interval for the baseline hazard parameter |
loglik |
A named vector containing the log-likelihood ( |
# Example data library(joint.Cox) data(dataOvarian) t.event = dataOvarian$t.event event = dataOvarian$event Z = dataOvarian$CXCL12 reg1 <- splineCox.reg1(t.event, event, Z, model = "constant") print(reg1)
# Example data library(joint.Cox) data(dataOvarian) t.event = dataOvarian$t.event event = dataOvarian$event Z = dataOvarian$CXCL12 reg1 <- splineCox.reg1(t.event, event, Z, model = "constant") print(reg1)
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 minimization of the log-likelihood function.
The function calculates the estimates for the model parameters (beta) and the baseline hazard scale parameter (gamma), using non-linear optimization.
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))) )
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))) )
t.event |
a vector for time-to-event |
event |
a vector for event indicator (=1 event; =0 censoring) |
Z |
a matrix for covariates; nrow(Z)=sample size, ncol(Z)=the number of covariates |
xi1 |
lower bound for the hazard function; the default is min(t.event) |
xi3 |
upper bound for the hazard function; the default is max(t.event) |
model |
A character vector specifying which model shapes to consider for the baseline hazard.
Available options are:
"increase", "constant", "decrease", "unimodal1", "unimodal2", "unimodal3", "bathtub1", "bathtub2", "bathtub3".
Default is |
p0 |
Initial values to maximize the likelihood (1 + p parameters; baseline hazard scale parameter and p regression coefficients) |
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% confidence intervals for the regression coefficients |
gamma |
A named vector with the estimate, standard error, and 95% confidence interval for the baseline hazard parameter |
loglik |
A named vector containing the log-likelihood ( |
other_models |
A data frame containing the log-likelihood ( |
# 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)
# 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)