user.baseline: Calculating baseline functions from a user-specified baseline...

Description Usage Arguments Details Value Author(s) Examples

View source: R/user.baseline.R

Description

This function is called by sim.survdata and is not intended to be used by itself.

Usage

1
user.baseline(user.fun, T)

Arguments

user.fun

A user-specified R function with one argument, representing time, that outputs the baseline hazard function

T

The latest time point during which an observation may fail. Failures can occur as early as 1 and as late as T

Details

user.baseline takes a function as a user-specified baseline hazard which must have only one argument: time. user.baseline approximates the cumulative baseline hazard by taking the cumulative sum of the user-specified hazard function. It calculates the survivor function by exponentiating the cumulative baseline hazard time -1, the baseline failure CDF by subtracting the survivor function from 1, and it approximates the baseline failure PDF by taking the first difference of the failure CDF. survivor function, and baseline failure-time PDF and CDF.

Value

A data frame with five columns representing time from 1 to T, and the user-specified baseline hazard, cumulative hazard, survivor function, failure PDF and failure CDF at each time point.

Author(s)

Jonathan Kropko <jkropko@virginia.edu> and Jeffrey J. Harden <jharden2@nd.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Writing the hazard to be lognormal with mean of 50, sd of 10
my.hazard <- function(t){
     dnorm((log(t) - log(50))/log(10)) /
          (log(10)*t*(1 - pnorm((log(t) - log(50))/log(10))))
}
lognormal.functions <- user.baseline(my.hazard, 100)
summary(lognormal.functions)

#A customized user-specified hazard
sine.squared.hazard <- user.baseline(function(t) sin(t/25)^2, 30)
summary(sine.squared.hazard)

coxed documentation built on Aug. 2, 2020, 9:07 a.m.