View source: R/glm_effect_profile.R
| glm_effect_profile | R Documentation |
Estimates a treatment effect profile across a continuous biomarker using a generalized linear model with natural cubic spline interactions. Supports binary, continuous, and count or rate outcomes. Standard errors are computed via the delta method applied to the full model covariance, with optional sandwich variance estimation for modified-Poisson models.
glm_effect_profile(
df,
outcome.name,
treat.name = "treat",
z.name = "bm",
effect_measure = c("log_OR", "log_RR", "log_IRR", "RD", "MD"),
offset.name = NULL,
overdispersion = c("none", "quasi", "negbin"),
spline_df = 3L,
z_by = 0.05,
z_quantile = 0.95,
alpha = 0.05,
conf.level = NULL,
strata.name = NULL,
show_plot = FALSE,
verbose = FALSE
)
df |
Data frame containing the analysis data. |
outcome.name |
Character. Name of the outcome variable. Binary outcomes must be coded 0/1; count outcomes must be non-negative integers; continuous outcomes may be any numeric. |
treat.name |
Character. Name of the binary treatment indicator
(0 = control, 1 = treated). Default: |
z.name |
Character. Name of the continuous biomarker (effect modifier).
Default: |
effect_measure |
Character. Effect measure to estimate on the link
scale. Allowed values: |
offset.name |
Character or |
overdispersion |
Character. Overdispersion correction for Poisson
family models. |
spline_df |
Integer. Degrees of freedom for natural spline basis.
Default: |
z_by |
Numeric. Increment for the biomarker prediction grid.
Default: |
z_quantile |
Numeric. Upper quantile of the biomarker used as the
grid endpoint (avoids extrapolation into sparse tails).
Default: |
alpha |
Numeric. Two-sided significance level for confidence
intervals. Default: |
conf.level |
Numeric or |
strata.name |
Character or |
show_plot |
Logical. Display a base-R diagnostic plot of the
estimated treatment effect profile. Default: |
verbose |
Logical. Print diagnostic messages. Default: |
An object of class "glm_effect_profile": a named list
containing z_profile (biomarker grid), est (point
estimates on the link scale), lower and upper
(confidence bounds), se (standard errors),
effect_measure, family_used, overdispersion,
dispersion (quasi or negbin dispersion estimate, else NA),
model_fit, spline_basis, and alpha.
glm_cs_fit for a simpler family-based interface,
cox_cs_fit for survival outcomes,
grf.subg.harm.glm for GRF-based subgroup identification.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.