rpwexp: Simulate univariate time-to-event data under piecewise...

View source: R/simID_PW.R

rpwexpR Documentation

Simulate univariate time-to-event data under piecewise exponential hazard

Description

rpwexp generates n independent, identically distributed event times under a piecewise exponential model.

Usage

rpwexp(n, rate = 1, intervals = NULL, cumulative = FALSE)

Arguments

n

Number of observations. If length(n) > 1, the length is taken to be the number required.

rate

Vector containing exponential failure rates in intervals described by intervals

intervals

Vector containing positive values indicating interval lengths where the exponential rates provided in rate apply. Note that the length of intervals is 1 less than that of rate and that the final value rate in rate applies after time sum(intervals).

cumulative

FALSE (the default) generates n independent, identically distributed piecewise exponential failure rates according to the distribution specified by intervals and rate. TRUE generates independent inter-arrival times with the rates of arrival in each interval specified by intervals determined by rate.


hreed7/SemiCompRisksPen documentation built on Dec. 15, 2024, 5:41 p.m.