rrGcomp {clintools} | R Documentation |
Relative risk derived by G-computation (rrGcomp)
Description
rrGcomp()
is a small function which generates population-level (marginal) relative risks derived by G-computation. For models with random effects mixed-effects generalized linear model with a logit link with adjustment for stratification variables will be used, while those without random effects a logistic regression will be used. The code is based on the method used in the paper by Dankiewicz et al. (2021) N Engl J Med. Jun 17;384(24):2283-2294. (PubMed
Usage
rrGcomp(df, outcome_col, group_col,
fixed_strata = NULL, random_strata = NULL,
nbrIter = 5000, conf_level = 0.95)
Arguments
df |
the individual participant dataframe |
outcome_col |
column name for the outcome column |
group_col |
column name for the group column |
fixed_strata |
list of column names for the fixed effect stratification columns |
random_strata |
list of column names for the random effect stratification columns |
nbrIter |
number of iterations to be used in the G-computation. The original paper used 5000, which is also the default. |
conf_level |
the confidence level to be reported. |
Value
Returns a list with relative risk (rr), simulated rr (simRR), lower- and upper confidence level (simLCL/simUCL), and the p-value (p_val)
Examples
df <- sRCT(n_sites=3,n_pop=50)
rrGcomp(df,outcome_col="outcome",group_col="Var1",random_strata="site",nbrIter=10)