Rfit rank-regression contrast analysis with LOD imputation facade
Source:R/ContrastsFacades.R
ContrastsRfitImputeFacade.RdRfit rank-regression contrast analysis with LOD imputation facade
Rfit rank-regression contrast analysis with LOD imputation facade
Details
The rank-based analogue of ContrastsLMImputeFacade.
Encapsulates the pipeline: strategy_rfit ->
build_model_impute -> Contrasts ->
ContrastsModerated, using rfit.
Proteins whose initial rfit fit fails, is singular, or has an
incomplete design are re-fitted after imputing missing values with the
limit of detection (LOD). Uncertainty is borrowed from successful donor
fits so it is not underestimated by the constant imputation.
Differences from ContrastsLMImputeFacade:
Covariance borrowing is vcov-only (element-wise median of the donors' full named covariance matrices).
rfitexposes nolm-stylecov.unscaled, so the scalar-sigma borrowing mode is not available and is not exposed.Borrowing is fail-hard (
on_misalign = "fail"): if the donor covariance matrices cannot be aligned by coefficient name, the rescue is skipped and those proteins remain inget_missing()rather than carrying anlm-specific approximation.No observation weights (
rfithas noweightsargument), matching plainrfit.
modelName is the facade key "rfit_impute"; rescued rows are
flagged in the estimate_type column as "lod_imputed", the same
convention used by ContrastsLMImputeFacade.
See also
ContrastsLMImputeFacade, ContrastsRfitFacade,
build_model_impute
Other modelling:
AnovaExtractor,
Contrasts,
ContrastsDEqMSFacade,
ContrastsDEqMSVoomFacade,
ContrastsFacadeBase,
ContrastsFirth,
ContrastsFirthFacade,
ContrastsFirthNestedFacade,
ContrastsLMFacade,
ContrastsLMImputeFacade,
ContrastsLMMissingFacade,
ContrastsLimma,
ContrastsLimmaFacade,
ContrastsLimmaImputeFacade,
ContrastsLimmaVoomFacade,
ContrastsLimmaVoomImputeFacade,
ContrastsLimpaFacade,
ContrastsLimpaNestedFacade,
ContrastsLmerNestedFacade,
ContrastsMissing,
ContrastsModerated,
ContrastsModeratedDEqMS,
ContrastsPlotter,
ContrastsRLMFacade,
ContrastsROPECA,
ContrastsROPECANestedFacade,
ContrastsRfitFacade,
ContrastsTable,
INTERNAL_FUNCTIONS_BY_FAMILY,
LR_test(),
Model,
ModelFirth,
ModelLimma,
StrategyLM,
StrategyLimma,
StrategyLimpa,
StrategyLmer,
StrategyLogistf,
StrategyRLM,
StrategyRfit,
build_contrast_analysis(),
build_model(),
build_model_glm_peptide(),
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(),
build_model_logistf(),
compute_borrowed_variance(),
compute_borrowed_variance_limma(),
compute_contrast(),
compute_lmer_contrast(),
contrasts_fisher_exact(),
df.residual.rfit_prolfqua(),
get_anova_df(),
get_complete_model_fit(),
get_p_values_pbeta(),
group_label(),
impute_refit_singular(),
is_singular_lm(),
linfct_all_possible_contrasts(),
linfct_factors_contrasts(),
linfct_from_model(),
linfct_matrix_contrasts(),
list_facades(),
lookup_facade(),
merge_contrasts_results(),
model_analyse(),
model_summary(),
moderated_p_deqms(),
moderated_p_deqms_long(),
moderated_p_limma(),
moderated_p_limma_long(),
new_imputed_model(),
pivot_model_contrasts_to_wide(),
plot_lmer_peptide_predictions(),
register_facade(),
sigma.rfit_prolfqua(),
sim_build_models_lm(),
sim_build_models_lmer(),
sim_build_models_logistf(),
sim_make_model_lm(),
sim_make_model_lmer(),
strategy_limma(),
strategy_limpa(),
strategy_logistf(),
summary_ROPECA_median_p.scaled(),
unregister_facade(),
vcov.rfit_prolfqua()
Super classes
prolfqua::ContrastsInterface -> prolfqua::ContrastsFacadeBase -> ContrastsRfitImputeFacade
Public fields
modelModel object (with imputed proteins)
contrastContrastsModerated object
.lfqdatastored reference to input LFQData
.contrast_namesnames of the requested contrasts
Methods
Inherited methods
prolfqua::ContrastsInterface$column_description()prolfqua::ContrastsInterface$contrast_summary_table()prolfqua::ContrastsInterface$extra_artifacts()prolfqua::ContrastsInterface$filter_significant()prolfqua::ContrastsInterface$get_config()prolfqua::ContrastsInterface$get_contrast_sides()prolfqua::ContrastsInterface$get_ora()prolfqua::ContrastsInterface$get_rank()prolfqua::ContrastsFacadeBase$get_Plotter()prolfqua::ContrastsFacadeBase$get_contrasts()prolfqua::ContrastsFacadeBase$get_missing()prolfqua::ContrastsFacadeBase$to_wide()
Method new()
initialize
Usage
ContrastsRfitImputeFacade$new(
lfqdata,
modelstr,
contrasts,
lod = NULL,
df_method = c("observed", "borrowed"),
...
)Arguments
lfqdataLFQData object (aggregated to protein level)
modelstrmodel formula string (e.g. "~ group_")
contrastsnamed character vector of contrasts
lodnumeric limit of detection; if NULL, auto-computed from data
df_method"observed" uses max(n_observed - p, 1); "borrowed" uses median df from successful fits
...passed to
strategy_rfit
Examples
istar <- sim_lfq_data_protein_config(Nprot = 30, weight_missing = 0.5)
#> creating sampleName from file_name column
#> completing cases
#> completing cases done
#> setup done
lfqdata <- LFQData$new(istar$data, istar$config)
lfqdata$rename_response("transformedIntensity")
contrasts <- c("A_vs_Ctrl" = "group_A - group_Ctrl")
fa <- ContrastsRfitImputeFacade$new(lfqdata, "~ group_", contrasts)
#> Warning: There were 2 warnings in `dplyr::mutate()`.
#> The first warning was:
#> ℹ In argument: `linear_model = purrr::map(data, model_strategy$model_fun, pb =
#> pb)`.
#> ℹ In group 20: `protein_Id = "LlQY7I~3486"`.
#> Caused by warning in `sqrt()`:
#> ! NaNs produced
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
head(fa$get_contrasts())
#> determine linear functions:
#> get_contrasts -> contrasts_linfct
#> contrasts_linfct
#> Joining with `by = join_by(protein_Id, contrast)`
#> # A tibble: 6 × 14
#> modelName estimate_type protein_Id contrast diff std.error avgAbd statistic
#> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 rfit_imp… observed 0EfVhX~29… A_vs_Ct… 1.40 0.999 22.7 1.55
#> 2 rfit_imp… observed 0m5WN4~67… A_vs_Ct… 0.0318 0.857 20.7 0.0304
#> 3 rfit_imp… observed 7QuTub~61… A_vs_Ct… 0.909 1.15 16.7 0.580
#> 4 rfit_imp… observed 7cbcrd~26… A_vs_Ct… 0.612 1.64 21.8 0.553
#> 5 rfit_imp… observed 9VUkAq~34… A_vs_Ct… 0.768 2.04 19.9 0.787
#> 6 rfit_imp… observed At886V~77… A_vs_Ct… -1.91 1.03 29.2 -2.11
#> # ℹ 6 more variables: df <dbl>, p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
#> # sigma <dbl>, FDR <dbl>
fa$to_wide()
#> # A tibble: 30 × 5
#> protein_Id diff.A_vs_Ctrl p.value.A_vs_Ctrl FDR.A_vs_Ctrl statistic.A_vs_Ctrl
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 0EfVhX~29… 1.40 0.133 0.666 1.55
#> 2 0m5WN4~67… 0.0318 0.976 1 0.0304
#> 3 7QuTub~61… 0.909 0.568 1 0.580
#> 4 7cbcrd~26… 0.612 0.586 1 0.553
#> 5 9VUkAq~34… 0.768 0.439 1 0.787
#> 6 At886V~77… -1.91 0.0443 0.443 -2.11
#> 7 BEJI92~27… -1.30 0.195 0.711 -1.33
#> 8 CGzoYe~08… 0.867 0.383 1 0.888
#> 9 CtOJ9t~91… 0.107 0.906 1 0.119
#> 10 DoWup2~28… -1.50 0.108 0.646 -1.66
#> # ℹ 20 more rows