Wraps a contrast object such as Contrasts and replaces its standard errors and p-values with limma's empirical
Bayes moderation: per-subject residual variances are shrunk towards a common prior (limma::squeezeVar()), which
adds prior degrees of freedom. Fold changes are unchanged.
See also
Other modelling:
AnovaExtractor,
Contrasts,
ContrastsComparison,
ContrastsDEqMSFacade,
ContrastsDEqMSVoomFacade,
ContrastsFacadeBase,
ContrastsFirth,
ContrastsFirthFacade,
ContrastsHurdleFacade,
ContrastsHurdleNestedFacade,
ContrastsLMFacade,
ContrastsLMImputeFacade,
ContrastsLimma,
ContrastsLimmaFacade,
ContrastsLimmaImputeFacade,
ContrastsLimmaVoomFacade,
ContrastsLimmaVoomImputeFacade,
ContrastsLimpaFacade,
ContrastsLimpaNestedFacade,
ContrastsLmerNestedFacade,
ContrastsModeratedDEqMS,
ContrastsPlotter,
ContrastsRLMFacade,
ContrastsROPECA,
ContrastsROPECANestedFacade,
ContrastsROPECAV2,
ContrastsROPECAV2NestedFacade,
ContrastsRfitFacade,
ContrastsRfitImputeFacade,
ContrastsTable,
INTERNAL_FUNCTIONS_BY_FAMILY,
Model,
ModelFirth,
ModelLimma,
StrategyLM,
StrategyLimma,
StrategyLimpa,
StrategyLmer,
StrategyLogistf,
StrategyRLM,
StrategyRfit,
build_contrast_analysis(),
build_model(),
build_model_glm_protein(),
build_model_impute(),
build_model_limma(),
build_model_limma_impute(),
build_model_limma_voom(),
build_model_limma_voom_impute(),
build_model_limpa(),
compute_borrowed_variance(),
compute_borrowed_variance_limma(),
df.residual.rfit_prolfqua(),
group_label(),
impute_from_model(),
impute_refit_singular(),
list_facades(),
lookup_facade(),
lr_test(),
merge_contrasts_results(),
new_imputed_model(),
nobs.rfit_prolfqua(),
pivot_model_contrasts_to_wide(),
prolfqua_analysis_methods,
register_facade(),
sigma.rfit_prolfqua(),
strategy_limma(),
strategy_limpa(),
strategy_logistf(),
vcov.rfit_prolfqua()
Super class
ContrastsInterface -> ContrastsModerated
Public fields
ContrastClass implementing the Contrast interface
model_namename of model
subject_idcolumns with subject_id (proteinID)
p.adjustfunction to adjust p-values
variance_flooroptional lower bound for posterior variances
Methods
Inherited methods
ContrastsInterface$column_description()ContrastsInterface$contrast_summary_table()ContrastsInterface$extra_artifacts()ContrastsInterface$filter_significant()ContrastsInterface$get_Plotter()ContrastsInterface$get_config()ContrastsInterface$get_missing()ContrastsInterface$get_ora()ContrastsInterface$get_rank()ContrastsInterface$to_wide()
ContrastsModerated$new()
initialize
Usage
ContrastsModerated$new(
Contrast,
model_name = paste0(Contrast$model_name, "_moderated"),
p.adjust = prolfqua::adjust_p_values,
variance_floor = NULL
)Examples
istar <- sim_lfq_data_protein_config(n_proteins = 50)
#> `protein_Id`: columns `proteinID`, `idtype2` united with separator '~'.
#> creating sampleName from file_name column
#> setup_analysis: dropped 5 unconfigured columns: average_prot_abundance, sd, mean, N, Replicate.
#> setup_analysis: added 82 rows with NA response for feature and sample combinations absent from the input.
protIntensity <- istar$data
config <- istar$config
lProt <- LFQData$new(protIntensity, config)
lProt$rename_response("transformedIntensity")
modelFunction <-
strategy_lm("transformedIntensity ~ group_")
mod <- build_model(
lProt,
modelFunction)
#> fit (Model): 1 singular fits (e.g. VUnZ6o~1614): coefficients not estimable or fewer than 2 residual df
#> fit (Model): 82 missing responses dropped (e.g. 0EfVhX~7161, 0m5WN4~3543, 7QuTub~5556, 7cbcrd~0495, 9VUkAq~8655, ...): NA response (missing observation) left out of the fit
#> See $provenance().
Contr <- c("dil.b_vs_a" = "group_A - group_Ctrl")
contrast <- prolfqua::Contrasts$new(mod,
Contr)
contrast <- ContrastsModerated$new(contrast)
bb <- contrast$get_contrasts()
# LOD-imputed refit for proteins the plain lm cannot estimate
imp <- ContrastsLMImputeFacade$new(lProt, "~ group_", Contr)$contrast
#> fit (ModelImputed): 1 refit at the limit of detection (e.g. VUnZ6o~1614): fit failed, singular or missing a group; missing responses imputed at the LOD
#> fit (ModelImputed): 73 missing responses dropped (e.g. 0EfVhX~7161, 0m5WN4~3543, 7QuTub~5556, 7cbcrd~0495, 9VUkAq~8655, ...): NA response (missing observation) left out of the fit
#> See $provenance().
contrast$get_contrasts() |> dim()
#> [1] 49 16
(xx <- imp$get_contrasts()) |> dim()
#> [1] 50 16
merged <- merge_contrasts_results(contrast, imp)
merged$more$get_contrasts() |> dim()
#> [1] 1 16
stopifnot(all(dim(merged$merged$get_contrasts()) == c(50, 16)))
stopifnot(all(dim(merged$same$get_contrasts()) == c(49, 16)))
cs <- contrast$get_contrast_sides()
cslf <- contrast$get_linfct()
ctr <- contrast$get_contrasts()
ctrwide <- contrast$to_wide()
cp <- contrast$get_Plotter()
print(cp$histogram()$p.value, vp=NULL)
print(cp$histogram()$FDR, vp = NULL)
cp$volcano()
#> $FDR
#>
cp$ma_plot()