Wald tests of contrasts of ModelFirth fits, one per subject and contrast, on the log-odds scale of
protein detection. The reference distribution is normal (df = Inf), as in the coefficient table of logistf
and confint(). Used by the firth method of build_contrast_analysis().
See also
Other modelling:
AnovaExtractor,
Contrasts,
ContrastsComparison,
ContrastsDEqMSFacade,
ContrastsDEqMSVoomFacade,
ContrastsFacadeBase,
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(),
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 -> ContrastsFirth
Public fields
modelsModel
contrastscharacter with contrasts
model_namename of model
subject_idname of column containing e.g., protein Id's
p.adjustfunction to adjust p-values (default prolfqua::adjust_p_values)
contrast_resultdata frame containing results of contrast computation
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()
ContrastsFirth$new()
initialize create Contrast
Usage
ContrastsFirth$new(
model,
contrasts,
p.adjust = prolfqua::adjust_p_values,
model_name = "firth"
)Arguments
modela dataframe with a structure similar to that generated by
build_modelcontrastsa character vector with contrast specification
p.adjustfunction to adjust the p-values
model_namename of contrast method, default firth
Examples
istar <- sim_lfq_data_protein_config(n_proteins = 10, weight_missing = 1, seed = 3)
#> `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 39 rows with NA response for feature and sample combinations absent from the input.
modi <- build_model_glm_protein(LFQData$new(istar$data, istar$config), "~ group_")
contrasts <- c(Avs = "group_A - group_B", AvsCtrl = "group_A - group_Ctrl")
ctr <- ContrastsFirth$new(modi,contrasts)
ctr$get_contrast_sides()
#> # A tibble: 2 × 3
#> contrast group_1 group_2
#> <chr> <chr> <chr>
#> 1 Avs group_A group_B
#> 2 AvsCtrl group_A group_Ctrl
ctr$get_linfct()
#> $model_df
#> # A tibble: 10 × 13
#> # Groups: protein_Id [10]
#> protein_Id data linear_model fit_warnings has_model_fit isSingular
#> <chr> <list> <list> <list> <lgl> <lgl>
#> 1 7IZdVV~0841 <tibble> <logistf> <chr [0]> TRUE FALSE
#> 2 AZPG26~2091 <tibble> <logistf> <chr [0]> TRUE FALSE
#> 3 AoNKbb~6908 <tibble> <logistf> <chr [0]> TRUE FALSE
#> 4 EnbuYk~0350 <tibble> <logistf> <chr [0]> TRUE FALSE
#> 5 JnEDsz~4938 <tibble> <logistf> <chr [0]> TRUE FALSE
#> 6 NNASGK~1417 <tibble> <logistf> <chr [0]> TRUE FALSE
#> 7 XYrp6h~5793 <tibble> <logistf> <chr [0]> TRUE FALSE
#> 8 quTD7H~4566 <tibble> <logistf> <chr [0]> TRUE FALSE
#> 9 tCZCHm~6695 <tibble> <logistf> <chr [0]> TRUE FALSE
#> 10 tHE075~8231 <tibble> <logistf> <chr [0]> TRUE FALSE
#> # ℹ 7 more variables: df.residual <dbl>, sigma <dbl>, nr_coef <int>,
#> # nr_coef_not_NA <int>, converged <lgl>, iterations <int>, linfct <list>
#>
#> $model_name
#> [1] "logistf"
#>
#> $strategy
#> <StrategyLogistf>
#> Inherits from: <StrategyBase>
#> Public:
#> anova_df: AnovaExtractor, R6
#> clone: function (deep = FALSE)
#> contrast_fun: function (...)
#> control: list
#> df_residual: function (model)
#> formula: formula
#> initialize: function (modelstr, model_name = "logistf", control = list())
#> isSingular: function (model)
#> model_fun: function (x, pb)
#> model_name: logistf
#> sigma: function (model)
#> zero_residual_variance: function (sigma, scale)
#> Private:
#> check_packages: function ()
#> control_defaults: function ()
#> control_names: function ()
#> fit: function (DFT)
#> prepare: function (x)
#>
ctr$get_contrasts()
#> # A tibble: 20 × 16
#> modelName estimate_type protein_Id contrast sigma df diff FDR
#> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 firth observed 7IZdVV~0841 Avs 1 Inf -2.20e+ 0 0.732
#> 2 firth observed 7IZdVV~0841 AvsCtrl 1 Inf 3.22e-16 1
#> 3 firth observed AZPG26~2091 Avs 1 Inf 2.75e-16 1
#> 4 firth observed AZPG26~2091 AvsCtrl 1 Inf 5.58e-16 1
#> 5 firth observed AoNKbb~6908 Avs 1 Inf 8.47e- 1 0.746
#> 6 firth observed AoNKbb~6908 AvsCtrl 1 Inf -1.35e+ 0 1
#> 7 firth observed EnbuYk~0350 Avs 1 Inf 1.69e+ 0 0.732
#> 8 firth observed EnbuYk~0350 AvsCtrl 1 Inf 8.47e- 1 1
#> 9 firth observed JnEDsz~4938 Avs 1 Inf 1.35e+ 0 0.746
#> 10 firth observed JnEDsz~4938 AvsCtrl 1 Inf -8.47e- 1 1
#> 11 firth observed NNASGK~1417 Avs 1 Inf -1.26e-15 1
#> 12 firth observed NNASGK~1417 AvsCtrl 1 Inf 4.27e-16 1
#> 13 firth observed XYrp6h~5793 Avs 1 Inf -1.26e-15 1
#> 14 firth observed XYrp6h~5793 AvsCtrl 1 Inf 4.27e-16 1
#> 15 firth observed quTD7H~4566 Avs 1 Inf 3.04e+ 0 0.732
#> 16 firth observed quTD7H~4566 AvsCtrl 1 Inf 2.20e+ 0 1
#> 17 firth observed tCZCHm~6695 Avs 1 Inf 1.35e+ 0 0.746
#> 18 firth observed tCZCHm~6695 AvsCtrl 1 Inf 2.16e-15 1
#> 19 firth observed tHE075~8231 Avs 1 Inf 8.47e- 1 0.746
#> 20 firth observed tHE075~8231 AvsCtrl 1 Inf 8.47e- 1 1
#> # ℹ 8 more variables: std.error <dbl>, statistic <dbl>, p.value <dbl>,
#> # conf.low <dbl>, conf.high <dbl>, avgAbd <dbl>, std.error.unmoderated <dbl>,
#> # df.unmoderated <dbl>
pl <- ctr$get_Plotter()