TSMCP {MTAFT}R Documentation

TSMCP: Two stage multiple change points detection for AFT model.

Description

This function first formulates the threshold problem as a group model selection problem so that a concave 2-norm group selection method can be applied using the 'grpreg' package in R, and then finalizes it via a refining method.

Usage

TSMCP(Y, X, delta, c, penalty = "scad")

Arguments

Y

the censored logarithm of the failure time.

X

the design matrix without the intercept.

delta

the censoring indicator.

c

the length of each segment in the splitting stage, defined as ceiling(c * sqrt(length(Y))).

penalty

Penalty type (default is "scad").

Value

An object with the following components:

cp

the change points.

coef

the estimated coefficients.

sigma

the variance of the error.

residuals

the residuals.

Yn

weighted Y by Kaplan-Meier weight.

Xn

weighted Xn by Kaplan-Meier weight.

References

Li, Jialiang, and Baisuo Jin. 2018. “Multi-Threshold Accelerated Failure Time Model.” The Annals of Statistics 46 (6A): 2657–82.

See Also

grpreg

Examples


library(grpreg)
# Generate simulated data with 500 samples and normal error distribution
dataset <- MTAFT_simdata(n = 500, err = "normal")
Y <- dataset[, 1]
delta <- dataset[, 2]
Tq <- dataset[, 3]
X <- dataset[, -c(1:3)]
n1 = sum(delta)
c=seq(0.5,1.5,0.1)
m=ceiling(c*sqrt(n1))
bicy= rep(NA,length(c))
tsmc=NULL
p = ncol(X)
for(i in 1:length(c)){
    tsm=try(TSMCP(Y,X,delta,c[i],penalty = "scad"),silent=TRUE)
    if(is(tsm,"try-error")) next()
    bicy[i]=log(n)*((length(tsm[[1]])+1)*(p+1))+n*log(tsm[[3]])
    tsmc[[i]]=tsm
}

if((any(!is.na(bicy)))){
    tsmcp=tsmc[[which(bicy==min(bicy))[1]]]
    thre.LJ = Tq[tsmcp[[1]]]
    thre.num.Lj = length(thre.LJ)
    thre.LJ
    thre.num.Lj
}


[Package MTAFT version 0.1.0 Index]