knitr::opts_chunk$set(echo = TRUE, eval = FALSE)
After expansion, we need to fit the outcome model. Before that we need to prepare the outcome data set. This might involve sampling, or some other filtering or variable derivation.
trial_itt <- trial_sequence(...) |> ... |> set_outcome_model(...) |> expand_trials()
with small data it should just work
fit_msm(trial_itt)
This would load the full expanded data and fit the model
-> Maybe delete sample_controls
and just have a single method like load_trial_data()
This should be done simply
trial_itt <- sample_controls(trial_itt, p_control = 0.3, seed = 444) fit_msm(trial_itt)
with small data it should just work
trial_itt <- load_trial_data(trial_itt, period = 1:100, subset_condition = "age > 30", p_control = NULL, seed = NULL) fit_msm(trial_itt)
model_data(trial_itt) <- model_data(trial_itt) |> group_by() |> mutate() fit_msm(trial_itt)
Currently the input data has a slot @data
and a class te_data
which has some validation, eg on
columns.
We could have a second slot eg @model_data
. We would need a different or modified te_data
class, at
least the validation. Alternatively we could directly have the data.table in the slot and validation could
occur in the getter/setter methods.
Remove te_data
class and do all validation in setter methods.
te_data_unset
class@data@data
Modify class
te_data_unset
classMore subclasses which inherit from te_data
If we have the two data slots, @data
, @model_data
sample_controls()
would save the data.table to this slotmodel_data(object)
/model_data(object)<-
to access @model_data@data
input_data(object)
/input_data(object)<-
to access @data@data
trial_msm()
is called, but @model_data
is empty, it will be read from the te_datastore
.is(@model_data, "te_data_unset")
give error: run data expansionis(@outcome_model, "te_outcome_unset")
give error: run set outcome modelte_input_data
which inherits from te_data
. This used in @data
and created by set_data()
te_outcome_data
which inherits from te_data
. This used in @outcome_data
and created by read_expanded_data
, sample_expanded_data
. It would also have a slot for trial_periods
.te_data
as the class of the slots to allow te_data_unset
to be used.@outcome_data
to allow complex modifications.set_model_data
would check the validity of the data.table to ensure correct columns, as well as update @N
, periods
get_model_data
would return data.tableAdd the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.