BSBInit {BGPhazard} | R Documentation |
Initial setup for BSBHaz model
Description
BSBInit
creates the necessary data structure for use in
BSBHaz
.
Usage
BSBInit(
df = NULL,
t1 = NULL,
t2 = NULL,
alpha = 0.001,
beta = 0.001,
c = 1000,
part_len = 1,
seed = 42
)
Arguments
df |
A data frame with columns 't1', 't2', 'delta1', 'delta2'. Any other columns not named 'id' are taken to be predictors. These predictors must be numeric, i.e., categorical predictors must be one-hot encoded. |
t1 , t2 |
Objects of class 'Surv' as created by
|
alpha , beta , c |
Doubles. Parameters for Markov gamma hazard priors. |
part_len |
A double that gives the length of time partition intervals. |
seed |
Random seed for variable initialization. |
Details
This function reads and formats censored bivariate survival data in the
following way. If df
is provided, failure times and censoring
indicadors are assumed to be columns named 't1', 't2', 'delta1', and
'delta2'. Other columns not named 'id' (ignoring case) are taken to be
predictors. If df
has no columns 'delta1' or 'delta2', observations
are taken as exact.
If df
is not provided, then t1
and t2
are expected to be
objects of class 'Surv' created by Surv
and the model
does not use predictors. Only right-censored observations are supported. Only
df
or t1
and t2
must be supplied. df
argument
comes first for use in pipes.
Value
An object of class 'BSBinit
'
Examples
t1 <- survival::Surv(c(1, 2, 3))
t2 <- survival::Surv(c(1, 2, 3))
init <- BSBInit(t1 = t1, t2 = t2, seed = 0)