Merge contrast results coming from two different model.
Source:R/ContrastsInterface.R
merge_contrasts_results.RdTypically used to fill proteins missing from Contrasts with
estimates from another model, e.g. the LOD-imputed refits of ContrastsLMImputeFacade
Value
A list of three ContrastsTable objects: merged, all contrasts of prefer plus those of add for
subjects missing from prefer; more, only the added contrasts; same, the contrasts of add for subjects
that prefer already has.
See also
Other modelling:
AnovaExtractor,
Contrasts,
ContrastsComparison,
ContrastsDEqMSFacade,
ContrastsDEqMSVoomFacade,
ContrastsFacadeBase,
ContrastsFirth,
ContrastsFirthFacade,
ContrastsHurdleFacade,
ContrastsHurdleNestedFacade,
ContrastsLMFacade,
ContrastsLMImputeFacade,
ContrastsLimma,
ContrastsLimmaFacade,
ContrastsLimmaImputeFacade,
ContrastsLimmaVoomFacade,
ContrastsLimmaVoomImputeFacade,
ContrastsLimpaFacade,
ContrastsLimpaNestedFacade,
ContrastsLmerNestedFacade,
ContrastsModerated,
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(),
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()
Examples
prefer_df <- data.frame(
protein_Id = c("P1", "P2"),
contrast = "A_vs_B",
modelName = "prefer",
diff = c(1, 2),
p.value = c(0.01, 0.2),
FDR = c(0.02, 0.2),
statistic = c(3, NA)
)
add_df <- data.frame(
protein_Id = c("P1", "P2"),
contrast = "A_vs_B",
modelName = "add",
diff = c(1.1, 2.1),
p.value = c(0.02, 0.03),
FDR = c(0.03, 0.04),
statistic = c(2.8, 2.5)
)
prefer <- ContrastsTable$new(prefer_df, subject_id = "protein_Id", model_name = "prefer")
add <- ContrastsTable$new(add_df, subject_id = "protein_Id", model_name = "add")
merged <- merge_contrasts_results(prefer, add)
merged$merged$get_contrasts()
#> protein_Id contrast modelName diff p.value FDR statistic
#> 1 P1 A_vs_B prefer 1.0 0.01 0.02 3.0
#> 2 P2 A_vs_B add 2.1 0.03 0.04 2.5