| Boot.hrandindex.param | R Documentation |
Performs bootstrap estimation of hazard rates and corresponding index parameters
for a given set of bootstrap samples. For each bootstrap replicate, the function
re-estimates the index parameters via optimisation and computes hazard estimates
using Boot.hqm. The output is used as input in functions Quantile.Index.CIs and Pivot.Index.CIs
Boot.hrandindex.param(B, Boot.samples, marker_name1, marker_name2,event_time_name,
time_name, event_name, b, t, true.haz, v.param, n.est.points)
B |
Integer. Number of bootstrap iterations. |
Boot.samples |
A list of bootstrap datasets. Each element corresponds to one replicate. |
marker_name1 |
Character string. Name of the first longitudinal marker. |
marker_name2 |
Character string. Name of the second longitudinal marker. |
event_time_name |
Name of the event time variable in the data. |
time_name |
Name of the time variable for the longitudinal marker measurements. |
event_name |
Name of the event indicator variable. |
b |
Numeric. Bandwidth parameter used in hazard estimation. |
t |
Numeric. Evaluation point for the conditional hazard. |
true.haz |
Numeric vector. The true or reference hazard used in the optimisation criterion. |
v.param |
Numeric vector. Starting values of the indexing parameters for the optimisation of the index coefficients. |
n.est.points |
Integer. Number of estimation grid points for the hazard curve. |
For each bootstrap iteration k = 1, \dots, B, the function:
Extracts the bootstrap sample data.use.
Computes centred marker values at the subject and observation level.
Estimates index parameters by minimising index_optim using optim.
Computes the bootstrap hazard estimate via Boot.hqm.
The outputs are matrices collecting the hazard estimates and estimated index parameter vectors across bootstrap replicates.
A matrix of dimension n.est.points × B containing the bootstrap hazard estimates.
Boot.hqm, index_optim, to_id
marker_name1 <- 'albumin'
marker_name2 <- 'serBilir'
event_time_name <- 'years'
time_name <- 'year'
event_name <- 'status2'
id<-'id'
par.x1 <- 0.0702
par.x2 <- 0.0856
t.x1 = 0 # refers to zero mean variables - slightly high
t.x2 = 1.9 # refers to zero mean variable - high
b = 0.42
t = par.x1 * t.x1 + par.x2 *t.x2
# first simulate true HR function:
xin <- pbc2[,c(id, marker_name1, marker_name2, event_time_name, time_name, event_name)]
n <- length(xin$id)
nn<-max( as.double(xin[,'id']) )
xin.id <- to_id(xin)
# Create bootstrap samples by group:
set.seed(1)
B<- 10 # 400 #50
Boot.samples<-list()
for(j in 1:B)
{
i.use<-c()
id.use<-c()
index.nn <- sample (nn, replace = TRUE)
for(l in 1:nn)
{
i.use2<-which(xin[,id]==index.nn[l])
i.use<-c(i.use, i.use2)
id.use2<-rep(index.nn[l], times=length(i.use2))
id.use<-c(id.use, id.use2)
}
xin.i<-xin[i.use,]
xin.i<-xin[i.use,]
Boot.samples[[j]]<- xin.i[order(xin.i$id),] #xin[i.use,]
}
true.hazard<- Sim.True.Hazard(Boot.samples, id='id', 100, marker_name1=marker_name1,
marker_name2= marker_name2, event_time_name = event_time_name,
time_name = time_name, event_name = event_name,
in.par = c(par.x1, par.x2), b)
res <- Boot.hrandindex.param( B, Boot.samples, marker_name1, marker_name2,
event_time_name, time_name, event_name , b = 0.4, t = 1.0,
true.haz = true.hazard, v.param = c(0.07, 0.08), n.est.points = 100)
#return bootstrap hazard rate estimators in marix format:
res
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.