initiators | R Documentation |
An all-in-one analysis using a sequence of emulated target trials. This provides a simplified interface to the main
functions data_preparation()
and trial_msm()
.
initiators(
data,
id = "id",
period = "period",
treatment = "treatment",
outcome = "outcome",
eligible = "eligible",
outcome_cov = ~1,
estimand_type = c("ITT", "PP", "As-Treated"),
model_var = NULL,
switch_n_cov = ~1,
switch_d_cov = ~1,
first_period = NA,
last_period = NA,
first_followup = NA,
last_followup = NA,
use_censor_weights = FALSE,
save_weight_models = FALSE,
analysis_weights = c("asis", "unweighted", "p99", "weight_limits"),
weight_limits = c(0, Inf),
cense = NA,
pool_cense = c("none", "both", "numerator"),
cense_d_cov = ~1,
cense_n_cov = ~1,
include_followup_time = ~followup_time + I(followup_time^2),
include_trial_period = ~trial_period + I(trial_period^2),
eligible_wts_0 = NA,
eligible_wts_1 = NA,
where_var = NULL,
where_case = NA,
data_dir,
glm_function = "glm",
quiet = FALSE,
...
)
data |
A |
id |
Name of the variable for identifiers of the individuals. Default is ‘id’. |
period |
Name of the variable for the visit/period. Default is ‘period’. |
treatment |
Name of the variable for the treatment indicator at that visit/period. Default is ‘treatment’. |
outcome |
Name of the variable for the indicator of the outcome event at that visit/period. Default is ‘outcome’. |
eligible |
Name of the variable for the indicator of eligibility for the target trial at that visit/period. Default is ‘eligible’. |
outcome_cov |
A RHS formula with baseline covariates to be adjusted for in the marginal structural model for the
emulated trials. Note that if a time-varying covariate is specified in |
estimand_type |
Specify the estimand for the causal analyses in the sequence of emulated trials. |
model_var |
Treatment variables to be included in the marginal structural model for the emulated trials.
|
switch_n_cov |
A RHS formula to specify the logistic models for estimating the numerator terms of the inverse
probability of treatment weights. A derived variable named |
switch_d_cov |
A RHS formula to specify the logistic models for estimating the denominator terms of the inverse probability of treatment weights. |
first_period |
First time period to be set as trial baseline to start expanding the data. |
last_period |
Last time period to be set as trial baseline to start expanding the data. |
first_followup |
First follow-up time/visit in the trials to be included in the marginal structural model for the outcome event. |
last_followup |
Last follow-up time/visit in the trials to be included in the marginal structural model for the outcome event. |
use_censor_weights |
Require the inverse probability of censoring weights. If |
save_weight_models |
Save model objects for estimating the weights in |
analysis_weights |
Choose which type of weights to be used for fitting the marginal structural model for the outcome event.
|
weight_limits |
Lower and upper limits to truncate weights, given as |
cense |
Variable name for the censoring indicator. Required if |
pool_cense |
Fit pooled or separate censoring models for those treated and those untreated at the immediately
previous visit. Pooling can be specified for the models for the numerator and denominator terms of the inverse
probability of censoring weights. One of |
cense_d_cov |
A RHS formula to specify the logistic models for estimating the denominator terms of the inverse probability of censoring weights. |
cense_n_cov |
A RHS formula to specify the logistic models for estimating the numerator terms of the inverse probability of censoring weights. |
include_followup_time |
The model to include the follow up time/visit of the trial ( |
include_trial_period |
The model to include the trial period ( |
eligible_wts_0 |
See definition for |
eligible_wts_1 |
Exclude some observations when fitting the models for the inverse probability of treatment
weights. For example, if it is assumed that an individual will stay on treatment for at least 2 visits, the first 2
visits after treatment initiation by definition have a probability of staying on the treatment of 1.0 and should
thus be excluded from the weight models for those who are on treatment at the immediately previous visit. Users can
define a variable that indicates that these 2 observations are ineligible for the weight model for those who are on
treatment at the immediately previous visit and add the variable name in the argument |
where_var |
Specify the variable names that will be used to define subgroup conditions when fitting the marginal
structural model for a subgroup of individuals. Need to specify jointly with the argument |
where_case |
Define conditions using variables specified in |
data_dir |
Directory to save model objects in. |
glm_function |
Specify which glm function to use for the marginal structural model from the |
quiet |
Suppress the printing of progress messages and summaries of the fitted models. |
... |
Additional arguments passed to |
Returns the result of trial_msm()
from the expanded data. An object of class TE_msm
containing
a glm
object
a list containing a summary table of estimated regression coefficients and the robust covariance matrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.