Microsimulation API: R Namespace Reference

Microsimulation API

Functions
R Namespace Reference

## Functions
double | rnormPos (double mean, double sd)
| rnorm function constrained to be positive. This uses brute-force re-sampling rather than conditioning on the distribution function. More...
double | rllogis (double shape, double scale)
| rllogis function for a random covariate from a log-logistic distribution with shape and scale. S(t) = 1/(1+(t/scale)^shape). More...
double | rllogis_trunc (double shape, double scale, double left)
| rllogis_trunc function for a random covariate from a log-logistic distribution with shape and scale with minimum time left. S(t|t>x)=S(t)/S(x) where S(t)=1/(1+(t/scale)^shape). More...
double | rgompertz (double shape=1.0, double rate=1.0)
| Random draw from a Gompertz distribution. More...

## Function Documentation

## ◆ rgompertz()

double R::rgompertz | ( | double | shape = `1.0`,
|  | double | rate = `1.0`
| ) |  |

Random draw from a Gompertz distribution.

Importantly, the parameterisation is as per flexsurv, where hazard(t)=rate*exp(shape*t). As a reminder, if shape<0 then there is a non-zero probability of cure (that is, no event), which is represented by R_PosInf.

Definition at line 119 of file microsimulation.cc.

## ◆ rllogis()

double R::rllogis | ( | double | shape,
|  | double | scale
| ) |  |

rllogis function for a random covariate from a log-logistic distribution with shape and scale. S(t) = 1/(1+(t/scale)^shape).

Definition at line 108 of file microsimulation.cc.

## ◆ rllogis_trunc()

double R::rllogis_trunc | ( | double | shape,
|  | double | scale,
|  | double | left
| ) |  |

rllogis_trunc function for a random covariate from a log-logistic distribution with shape and scale with minimum time left. S(t|t>x)=S(t)/S(x) where S(t)=1/(1+(t/scale)^shape).

Definition at line 113 of file microsimulation.cc.

## ◆ rnormPos()

double R::rnormPos | ( | double | mean,
|  | double | sd
| ) |  |

rnorm function constrained to be positive. This uses brute-force re-sampling rather than conditioning on the distribution function.

Definition at line 102 of file microsimulation.cc.