Description Usage Arguments Details Author(s) Examples

View source: R/simulationFunctions.R View source: R/user_utilities.R

Simulates interval censored data from a regression model with a weibull baseline distribution. Used for demonstration

1 2 3 | ```
simIC_weib(n = 100, b1 = 0.5, b2 = -0.5, model = "ph", shape = 2,
scale = 2, inspections = 2, inspectLength = 2.5, rndDigits = NULL,
prob_cen = 1)
``` |

`n` |
Number of samples simulated |

`b1` |
Value of first regression coefficient |

`b2` |
Value of second regression coefficient |

`model` |
Type of regression model. Options are 'po' (prop. odds) and 'ph' (Cox PH) |

`shape` |
shape parameter of baseline distribution |

`scale` |
scale parameter of baseline distribution |

`inspections` |
number of inspections times of censoring process |

`inspectLength` |
max length of inspection interval |

`rndDigits` |
number of digits to which the inspection time is rounded to,
creating a discrete inspection time. If |

`prob_cen` |
probability event being censored. If event is uncensored, l == u |

Exact event times are simulated according to regression model: covariate `x1`

is distributed `rnorm(n)`

and covariate `x2`

is distributed
`1 - 2 * rbinom(n, 1, 0.5)`

. Event times are then censored with a
case II interval censoring mechanism with `inspections`

different inspection times.
Time between inspections is distributed as `runif(min = 0, max = inspectLength)`

.
Note that the user should be careful in simulation studies not to simulate data
where nearly all the data is right censored (or more over, all the data with x2 = 1 or -1)
or this can result in degenerate solutions!

Clifford Anderson-Bergman

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
set.seed(1)
sim_data <- simIC_weib(n = 500, b1 = .3, b2 = -.3, model = 'ph',
shape = 2, scale = 2, inspections = 6,
inspectLength = 1)
#simulates data from a cox-ph with beta weibull distribution.
diag_covar(Surv(l, u, type = 'interval2') ~ x1 + x2,
data = sim_data, model = 'po')
diag_covar(Surv(l, u, type = 'interval2') ~ x1 + x2,
data = sim_data, model = 'ph')
#'ph' fit looks better than 'po'; the difference between the transformed survival
#function looks more constant
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.