gen_piece_df | R Documentation |
Piecewise Exponential Simulations Generate piecewise exponential observations.
gen_piece_df(n_obs, n_events_req, num.breaks, rate, t_change, max_time = Inf)
n_obs |
number of observations |
n_events_req |
(approximate) number of events contained within the sample |
num.breaks |
number of change-points, NA if no changepoints |
rate |
vector of hazard rate |
t_change |
vector of change-point times |
max_time |
maximum time after which all observations are censored. |
a dataframe with three columns, the time of the events (time_event), time which is the minimum of the cenorsing time and event time. status is an indicator which is 0 censored observation, or 1 if event.
set.seed(123)
n_obs =300
n_events_req=300
max_time = 2
rate = c(0.75,0.25)
t_change =1
df <- gen_piece_df(n_obs = n_obs,n_events_req = n_events_req,
num.breaks = length(t_change),rate = rate ,
t_change = t_change, max_time = max_time)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.