Random generation for piecewise exponential distribution
Random generation for piecewise exponential distribution
Draw random samples from an exponential distribution with piecewise rates. rpwexp is vectorized and written in C++ for speed.
rpwexp(n, rate =1, time =0)
Arguments
n: Number of random observations to draw.
rate: A matrix of rates where rows correspond to observations and columns correspond to rates during specified time intervals.
time: A vector equal to the number of columns in rate giving the times at which the rate changes
Returns
A vector of random samples from the piecewise exponential distribution. The length of the sample is determined by n. The numerical arguments other than n are recycled so that the number of samples is equal to n.