Contents
associate
Association analyses for PolyGenius
associate is an environment bundling the package's association entry points,
each of which takes a PolyGeniusStudy and returns a
PolyGeniusAssociation with $results, $artifacts, $diagnostics,
$metadata and $fits. Keeping inferential rows separate from plot-support
artifacts is what lets forest plots, heatmaps, survival curves and
meta-analysis all read one container.
Usage
associateValue
An environment of class associate holding the six association
functions listed under Details; call them as associate$regression(),
associate$meta() and so on.
Details
The environment holds six functions:
associate$regression() — Coefficient models over an outcome x
predictor x interaction x stratum grid, classical or survival. See
associate-regression.
associate$singleVariant() — Single-variant association scans (GWAS)
through PLINK2 --glm. See associate-single-variant.
associate$compare() — Incremental, heterogeneity and
pairwise-contrast comparisons. See associate-compare.
associate$mediation() — Exposure-mediator-outcome decomposition via
the suggested {mediation} package. See associate-mediation.
associate$mr() — Mendelian-randomization entry point. Declared only;
every call aborts, no estimator backend exists. See associate-mr.
associate$meta() — Pools compatible summary results across studies.
See associate-meta.
Each call fits the families and returns the result class and schemas below.
| Call | Families fitted | Result class | Schema(s) |
|---|---|---|---|
| associate$regression() | LinearRegression, LogisticRegression, CoxRegression, CompetingRiskRegression, KaplanMeierRegression | PolyGeniusAssociation | schema-lm, schema-glm, schema-cox, schema-crr, schema-km |
| associate$compare() | LinearComparison, LogisticComparison, CoxComparison, CompetingRiskComparison | PolyGeniusAssociation | schema-comparison |
| associate$mediation() | none, fits lm/glm directly |
PolyGeniusAssociation | schema-mediation |
| associate$singleVariant() | none, PLINK2 --glm |
PolyGeniusAssociation | schema-single-variant |
| associate$meta() | none, pools results | PolyGeniusAssociation | schema-meta |
| associate$mr() | none, always aborts | none | none |
associate$regression() forces a family by model or infers it per outcome
when model = "auto": "lm" for continuous, "glm" for binary, "cox" for
right-censored survival and "crr" for competing risks. "km" (grouped
Kaplan-Meier / log-rank) is never inferred.
associate$compare() shares the first four families; associate$mediation()
supports "lm" and "glm" outcome models only.
Examples
results <- associate$regression(
data,
outcomes = dementia,
predictors = everything(),
covariates = c(age, sex, PCA1)
)
survival.results <- associate$regression(
data,
outcomes = surv(time = age.observed, event = dementia),
predictors = c(PRS_AD, PRS_longevity),
covariates = c(sex, pmi, PCA1)
)
pooled <- associate$meta(cohort1 = results, cohort2 = other.results)