gen_piece_df: Piecewise Exponential Simulations Generate piecewise...

View source: R/helper.R

gen_piece_dfR Documentation

Piecewise Exponential Simulations Generate piecewise exponential observations.

Description

Piecewise Exponential Simulations Generate piecewise exponential observations.

Usage

gen_piece_df(n_obs, n_events_req, num.breaks, rate, t_change, max_time = Inf)

Arguments

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.

Value

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.

Examples

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)

Philip-Cooney/PiecewiseChangepoint documentation built on Sept. 10, 2023, 9:49 p.m.