trajhrmsm_gform {trajmsm} | R Documentation |
History Restricted MSM and Latent Class of Growth Analysis estimated with G-formula.
Description
Estimate parameters of LCGA-HRMSM using g-formula. and bootstrap to get standard errors.
Usage
trajhrmsm_gform(
degree_traj = c("linear", "quadratic", "cubic"),
rep = 50,
treatment,
covariates,
baseline,
outcome,
ntimes_interval,
total_followup,
time,
time_values,
identifier,
var_cov,
number_traj = 3,
family = "poisson",
obsdata
)
Arguments
degree_traj |
To specify the polynomial degree for modelling the time-varying treatment. |
rep |
Number of repetition for the bootstrap. |
treatment |
Name of the time-varying treatment. |
covariates |
Names of the time-varying covariates (should be a list). |
baseline |
Name of baseline covariates. |
outcome |
Name of the outcome variable. |
ntimes_interval |
Length of a time-interval (s). |
total_followup |
Total length of follow-up. |
time |
Name of the time variable. |
time_values |
Measuring times. |
identifier |
Name of the column of the unique identifier. |
var_cov |
Names of the time-varying covariates. |
number_traj |
Number of trajectory groups. |
family |
Specification of the error distribution and link function to be used in the model. |
obsdata |
Data in a long format. |
Value
A list containing the following components:
- results_hrmsm_gform
Matrix of estimates for LCGA-MSM, obtained using the g-formula method.
- result_coef_boot
Matrix of estimates obtained with bootstrap.
- restraj
Fitted trajectory model.
- mean_adh
Matrix of mean adherence per trajectory group.
Author(s)
Awa Diop Denis Talbot
Examples
obsdata_long = gendata(n = 1000, format = "long", total_followup = 8,
timedep_outcome = TRUE, seed = 945)
baseline_var <- c("age","sex")
years <- 2011:2018
variables <- c("hyper", "bmi")
covariates <- lapply(years, function(year) {
paste0(variables, year)})
treatment_var <- paste0("statins", 2011:2018)
var_cov <- c("statins","hyper", "bmi")
reshrmsm_gform = trajhrmsm_gform(degree_traj = "linear", rep=5 ,
treatment = treatment_var,covariates = covariates, baseline = baseline_var,
outcome = "y",var_cov = var_cov, ntimes_interval = 6, total_followup = 8,
time = "time",time_values = years, identifier = "id",
number_traj = 3, family = "poisson", obsdata = obsdata_long)
reshrmsm_gform$results_hrmsm_gform