Main model class
MultiStateModel.RdMain model class
Main model class
Public fields
systempk_modelA
PKModelor NULL.prior_onlyShould the model ignore likelihood?
pk_onlyShould the model ignore the entire hazard model part?
Methods
Method set_normalizers()
Set normalization constant for each variable (side effect)
Arguments
dataA
JointDataobject
Method set_prior_mean_h0_data()
Set assumed prior mean baseline hazard rates (side effect) based on average hazards in data.
Method new()
Create model
Usage
MultistateModel$new(
system,
covariates = NULL,
pk_model = NULL,
t_max = 1000,
num_knots = 5,
categorical = NULL,
n_grid = 1000,
prior_only = FALSE,
pk_only = FALSE
)Arguments
systemcovariatesThe names of the hazard covariates (excluding possible exposure estimated from PK model). Do not use reserved names
ss_aucordose.pk_modelA
PKModelor NULL.t_maxMax time.
num_knotsTotal number of spline knots.
categoricalNames of covariates that are binary. This only has an effect when simulating data. When fitting a model, all covariates are treated as continuous, so you should use a binary encoding for categories if there is more than two.
n_gridNumber of time discretization points for integrating
prior_onlyShould the model ignore likelihood?
pk_onlyShould the model ignore the entire hazard model part? hazards.
Method set_knots()
Set knot locations based on event times
The knots define how the spline basis functions are set.
Method simulate_subjects()
Simulate subject data, all covariates independently.
Usage
MultistateModel$simulate_subjects(N_subject = 100, doses = c(15, 30, 60))Method simulate_data()
Simulate data using the multistate model
Usage
MultistateModel$simulate_data(
N_subject = 100,
beta_haz = NULL,
beta_pk = NULL,
w0 = 0.001,
w = NULL,
num_doses = 10,
subjects_df = NULL
)Arguments
N_subjectNumber of subjects.
beta_hazCovariate effects on each transition type. A matrix of shape
num_target_statesxnum_covs. IfNULL, a data frame of zeros is used.beta_pkCovariate effects on PK parameters. A named list with three elements, each being a vector. If any element is
NULL, a vector of zeros is used.w0Baseline hazard rate for all transitions.
wSpline weights. Matrix of shape
num_transxnum_weights. IfNULL, a matrix of zeros is used.num_dosesAverage number of doses taken by each subject. Only has effect if model as a PK submodel.
subjects_dfSubject data frame. If
NULL, simulated using thesimulate_subjectsmethod.
Returns
A JointData object.