Description Usage Arguments Details Value See Also Examples
Generate a sample of n
survival times from a distribution
specified by type
, and parameters specified p
.
1 |
n |
Number of observations to simulate. |
type |
One of |
p |
A numeric vector of length 4 specifying the model parameters. Some
models ignore some parameters: |
If a parameter that is used by a model
is set to zero, the type
argument is changed to that of a simpler
model that does not use that parameter. "l"
and "lm"
use
the Survomatic functions rlgst
and
rlogmake
, respectively. "g"
and "gm"
use the
eha functions rgompertz
and
rmakeham
, respectively. "e"
and
"w"
use the stats functions rexp
and
rweibull
functions, respectively. Validation is not
enforced, but values outside [0,1] will probably give nonsensical
results or errors.
A numeric vector of length n
.
rlgst
, rlogmake
,
rgompertz
, rmakeham
,
rexp
,
rweibull
1 2 3 4 5 6 7 8 9 10 | ## The following two are from the same Gompertz distribution because the
## zero parameter values cause the type to get changed from lm to g
s0 <- simsurv(1e4, type = "g", p=c(2e-5,5e-3,0,0))
s1 <- simsurv(1e4, type = "lm", p=c(2e-5,5e-3,0,0))
plot(survfit(Surv(s0)~1),col='red',conf.int=FALSE)
lines(survfit(Surv(s1)~1),col='blue',lty=2)
## ...but this one really is from a Logistic-Makeham distribution:
s2 <- simsurv(1e4, type = "lm", p=c(2e-5,5e-3,1e-4,0.4))
lines(survfit(Surv(s2)~1),col='green')
legend('topright',bty='n',col=c('red','blue','green'),lty=c(1,2,1),legend=c('s0','s1','s2'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.