RND {coxsei} | R Documentation |
Random number generator
Description
RND takes a vectorized positive R function defined on positive reals
and returns a vector of n
values of the random variable
(survival time) with the specifed function as its hazard/intensity
rate function.
Usage
RND(n, int, tol = .Machine$double.eps^0.5, epsabs = 1e-10, epsrel =
1e-10, limit = 1000)
Arguments
n |
number of observations. |
int |
hazard rate function of the survival variable, or the intensity function of the one-event point process counting the number (0 or 1) of deaths by following a sample of the surviving suject. |
tol |
tolerance of the numerical error in calculating the inverse of the cumulative distribution function of the survival variable. Defaults to the square root of the machine epsilon. |
epsabs |
maximum absolute error to be tolerated by the integrator. |
epsrel |
maximum relative error to be tolerated by the integrator. |
limit |
maximum number of iterations permitted by the integrator. |
Value
a vector of n
observations of the survival variable with the
supplied intensity/hazard function.
Author(s)
Feng Chen <feng.chen@unsw.edu.au>
Examples
set.seed(1)
dat <- RND(100,int=function(x)x^2)
ks.test(dat,pweibull,shape=3) # p-value = 0.6058
qqplot(dat,rweibull(100,shape=3))