arpchsurv: The adaptive ridge and ridge estimates from the piecewise...

Description Usage Arguments Details Value See Also Examples

View source: R/arpchsurv.R

Description

Given time to event data, a set of cuts and a sequence of penalty values, returns the adaptive ridge or the ridge estimator of the log-hazard.

Usage

1
2
3
arpchsurv(time, status, cuts = NULL, weights = rep(1, length(time)),
  pen = exp(seq(log(0.1), log(1000), length = 100)), a = rep(0,
  length(cuts) + 1), AR = TRUE, ...)

Arguments

time

the observed time data.

status

status of the time data. TRUE for true time and FALSE for censored time.

cuts

a sequence of cuts. Default to NULL which corresponds to the exponential model.

weights

an optional weight sequence. Default to 1. Should be of the size of time and status.

pen

a sequence of penalty values.

a

the log-hazard value at the initialization step. Default to the unpenalized log-hazard estimator.

AR

do you want to compute the adaptive-ridge? If FALSE compute the ridge estimator. Default to TRUE.

w

the w sequence values for the adaptive ridge algorithm at the initialization step. Default to 1. Should be of the size of the cuts.

tol

the tolerance parameter for convergence of the algorithm. Default to 1e-7.

itermax

the maximum number of iterations. If the algorithm has not converged before itermax iterations then the algorithm exits the program. Default to 1e+5.

CI

should the confidence intervals be computed? Default to TRUE.

alphaCI

the value of alpha for 1-alpha confidence intervals. Default to 0.05.

logtransf

should the confidence intervals be computed using the log-transformtation? Default to TRUE.

Details

The adaptive-ridge algorithm is run for the sequence of penalty values pen. The final adaptive-ridge estimator final.a is found by minimising a Bayesian Information Criteria (BIC). The res list returned from the function contains all the estimators (adaptive-ridge or ridge) for each penalty value. Write res[[pos]] to get the estimator for the penalty corresponding to pen[pos]. Use the option AR to choose between the ridge or adaptive-ridge estimator. For the ridge estimator only res is not null.Confidence intervals are computed for the final adaptive-ridge hazard estimator.

Value

res the list of adaptive-ridge estimators for each penalty value
final.a the final log-hazard that minimizes the BIC
final.cuts the final cut vector found from the BIC
bic the minimal value of the BIC
pos the position of the penalty that minimizes the BIC
CIleft the left confidence intervals for the final hazard
CIright the right confidence intervals for the final hazard

See Also

Other pchsurv functions: bootpchsurv, mlepchsurv, pchsurv, rsurv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
set.seed(45)
n=400
cuts=c(20,40,50,70)
alpha=c(0,0.05,0.1,0.2,0.4)/10
time=rsurv(n,cuts,alpha) #generate true data from the pch model
censoring=runif(n,min=70,max=90)
time=pmin(time,censoring) #observed times
delta=time<censoring #gives 62% of observed data on average

#The adaptive ridge estimator
fit=arpchsurv(time,delta,verbose=TRUE,cuts=1:100,CI=TRUE)

fit$final.cuts
exp(fit$final.a)

plot(fit)
plot(fit,pos=fit$pos,CI=TRUE)
points(c(0,c(20,40,50,70),max(time)),c(0,alpha),type="S",lwd=2,xlim=c(10,80),lty=2,col="red") #the true hazard function

fitsurv=pchsurv(time,delta,cuts=fit$final.cuts)
plot(fitsurv,CI=TRUE)
seqtime=seq(0,100,by=0.1)
lines(seqtime,exp(-pchcumhaz(seqtime,cuts,alpha)),type="l",col="red") #the true survival function

#The ridge estimator
fitR=arpchsurv(time,delta,verbose=TRUE,cuts=1:100,AR=FALSE)
plot(fitR)
plot(fitR,pos=50,main="")
lines(fitR,pos=80,col="blue")
points(c(0,c(20,40,50,70),max(time)),c(0,alpha),type="S",lwd=2,xlim=c(10,80),lty=2,col="red") #the true hazard function

obouaziz/pchsurv documentation built on Sept. 7, 2020, 11:03 a.m.