CalcFunction: CALCFUNCTION CALCULATES THE HAZARD RATE, CUMULATIVE HAZARD...

Description Usage Arguments Value Author(s) Examples

Description

This function calculates the hazard rate, cumulative hazard and/or the survival function of an MRH object. The alpha-level bounds are included in the calculation.

Usage

1
2
CalcFunction(mrhobject, function.type = c("h", "H", "S"), 
maxStudyTime, alpha.level = 0.05)

Arguments

mrhobject

An MRH object: either the fitted model from the estimateMRH() routine or the text file of MCMC chains converted to an MRH object.

function.type

The function the user would like returned, with 'h' denoting the hazard rate, 'H' denoting the cumulative hazard, and 'S' denoting the survival function. The user may request any subset of these functions, and multiple functions can be requested and returned.

maxStudyTime

The maximum observed or censored failure time, or the end of the study period. This is only needed if the text file of the chains are used instead of the actived fitted MRH object.

alpha.level

The alpha.level for the bounds of the credible intervals.

Value

hazardrate

The hazard rate and alpha-level bounds. Returned to the user if 'h' is entered in function.type.

cumulhaz

The cumulative hazard functions and alpha-level bounds. Returned to the user if 'H' is entered in function.type.

survfunction

The survival function and alpha-level bounds. Returned to the user if 'S' is entered in function.type

Author(s)

Yolanda Hagar <yolanda.hagar@colorado.edu>

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
31
32
# The MRH fit portion of the example is from 
# the estimateMRH() help page.  They do not need to 
# be re-run if the code has previously 
# been run and the outfolder ('MRH_lung') is saved.
data(cancer)
cancer$censorvar = cancer$status - 1
## Not run: 
fit.lung = estimateMRH(formula = Surv(time, censorvar) ~ 
	age + as.factor(sex) + ph.karno, data = cancer,
	M = 3, maxStudyTime = 960, burnIn = 200, 
	maxIter = 1000, thin = 1, outfolder = 'MRH_lung')
## End(Not run)

# Get the cumulative hazard with 99% credible interval bounds
## Not run: 
CalcFunction(fit.lung, function.type = 'H', 
	alpha.level = .01)
## End(Not run)

# Get the hazard rate, cumulative hazard, and 
# survival function using the MCMC chains text file
## Not run: 
lung.chains = MRH(read.table('MRH_lung/MCMCchains.txt', header = TRUE))
## End(Not run)

# When the chains are read in from a file and used, 
# the maximum study time 
# must be entered to calculate the hazard rate.
# (i.e. CalcFunction(lung.chains) does not work)
## Not run: 
CalcFunction(lung.chains, maxStudyTime = 960)
## End(Not run)

MRH documentation built on May 2, 2019, 11:10 a.m.