RND | R Documentation |
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.
RND(n, int, tol = .Machine$double.eps^0.5, epsabs = 1e-10, epsrel =
1e-10, limit = 1000)
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. |
a vector of n
observations of the survival variable with the
supplied intensity/hazard function.
Feng Chen <feng.chen@unsw.edu.au>
set.seed(1)
dat <- RND(100,int=function(x)3*x^2)
ks.test(dat,pweibull,shape=3) # p-value = 0.6058
qqplot(dat,rweibull(100,shape=3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.