trajhrmsm_ipw {trajmsm} | R Documentation |
History Restricted MSM and Latent Class of Growth Analysis estimated with IPW.
Description
Estimate parameters of LCGA-HRMSM using IPW.
Usage
trajhrmsm_ipw(
degree_traj = c("linear", "quadratic", "cubic"),
numerator = c("stabilized", "unstabilized"),
identifier,
baseline,
covariates,
treatment,
outcome,
var_cov,
include_censor = FALSE,
ntimes_interval,
total_followup,
time,
time_values,
family = "poisson",
censor = censor,
number_traj,
obsdata,
weights = NULL,
treshold = 0.999
)
Arguments
degree_traj |
To specify the polynomial degree for modelling the time-varying treatment. |
numerator |
To choose between stabilized and unstabilized weights. |
identifier |
Name of the column of the unique identifier. |
baseline |
Names of the baseline covariates. |
covariates |
Names of the time-varying covariates (should be a list). |
treatment |
Name of the time-varying treatment. |
outcome |
Name of the outcome variable. |
var_cov |
Names of the time-varying covariates. |
include_censor |
Logical, if TRUE, includes censoring. |
ntimes_interval |
Length of a time-interval (s). |
total_followup |
Total length of follow-up. |
time |
Name of the time variable. |
time_values |
Values of the time variable. |
family |
specification of the error distribution and link function to be used in the model. |
censor |
Name of the censoring variable. |
number_traj |
Number of trajectory groups. |
obsdata |
Data in a long format. |
weights |
A vector of estimated weights. If NULL, the weights are computed by the function. |
treshold |
For weight truncation. |
Value
Provides a matrix of estimates for LCGA-HRMSM, obtained using IPW.
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","y")
reshrmsm_ipw <- trajhrmsm_ipw(degree_traj = "linear", numerator = "stabilized",
identifier = "id", baseline = baseline_var,
covariates = covariates, treatment = treatment_var,
outcome = "y", var_cov= var_cov,include_censor = FALSE,
ntimes_interval = 6,total_followup = 8, time = "time", time_values = 2011:2018,
family = "poisson", number_traj = 3, obsdata = obsdata_long, treshold = 0.999)
reshrmsm_ipw$res_trajhrmsm_ipw