Learn R Programming

BayesReversePLLH (version 1.5)

ApproxMean: Returns the approximate restricted posterior mean survival for the PLLH model.

Description

Uses a grid and parameter values to approximate the restricted posterior mean survival for the PLLH model using the integral of the survival function.

Usage

ApproxMean(Y, s, lam, J)

Value

Returns the approximate restricted posterior mean survival time for the PLLH model.

Arguments

Y

Sequence from 0.01 to the maximum observed event time used to compute the approximate restricted mean survival time. Smaller spaced sequences results in better approximation but longer computation time.

s

Vector of split points. The first and last entries must be 0 and max(Y).

lam

Vector of log-hazard values at each split point location. Must be same length as s.

J

Number of split points.

Examples

Run this code
##Generate Data
Y1=rweibull(100,4,1)
##Create sequence from (0,max(Y1)) for approximation
Y=seq(.01,max(Y1),.01)
##Parameters used to approximate the mean
s=c(0,1,max(Y1))
lam=c(-2,0,-2)
J=1
ApproxMean( Y, s, lam, J)

Run the code above in your browser using DataLab