Skip to contents

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). rfit exposes no lm-style cov.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 in get_missing() rather than carrying an lm-specific approximation.

  • No observation weights (rfit has no weights argument), matching plain rfit.

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.

Value

An R6 class generator.

See also

ContrastsLMImputeFacade, ContrastsRfitFacade, build_model_impute

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, 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 classes

ContrastsInterface -> ContrastsFacadeBase -> ContrastsRfitImputeFacade

Methods

Inherited methods


ContrastsRfitImputeFacade$new()

initialize

Usage

ContrastsRfitImputeFacade$new(
  lfqdata,
  modelstr,
  contrasts,
  lod = NULL,
  df_method = c("observed", "borrowed"),
  control = list()
)

Arguments

lfqdata

LFQData object (aggregated to protein level)

modelstr

model formula string (e.g. "~ group_")

contrasts

named character vector of contrasts

lod

numeric 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

control

named list of convergence controls, see strategy_rfit


ContrastsRfitImputeFacade$clone()

The objects of this class are cloneable with this method.

Usage

ContrastsRfitImputeFacade$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

istar <- sim_lfq_data_protein_config(n_proteins = 30, weight_missing = 0.5)
#> `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 89 rows with NA response for feature and sample combinations absent from the input.
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)
#> fit (rfitImputed): 6 refit at the limit of detection (e.g. DuwH7n~2082, HvIpHG~1448, JcKVfU~4958, JfvT8X~6972, LlQY7I~3486, ...): fit failed, singular or missing a group; missing responses imputed at the LOD
#> fit (rfitImputed): 44 missing responses dropped (e.g. 0m5WN4~6730, 7QuTub~6175, 7cbcrd~2687, 9VUkAq~3402, BEJI92~2727, ...): NA response (missing observation) left out of the fit
#> See $provenance().
head(fa$get_contrasts())
#> # A tibble: 6 × 16
#>   modelName   estimate_type protein_Id  contrast     diff avgAbd
#>   <chr>       <chr>         <chr>       <chr>       <dbl>  <dbl>
#> 1 rfit_impute observed      0EfVhX~2956 A_vs_Ctrl  1.40     22.7
#> 2 rfit_impute observed      0m5WN4~6730 A_vs_Ctrl  0.0318   20.7
#> 3 rfit_impute observed      7QuTub~6175 A_vs_Ctrl  0.909    16.7
#> 4 rfit_impute observed      7cbcrd~2687 A_vs_Ctrl  0.612    21.8
#> 5 rfit_impute observed      9VUkAq~3402 A_vs_Ctrl  0.768    19.9
#> 6 rfit_impute observed      At886V~7759 A_vs_Ctrl -1.91     29.2
#> # ℹ 10 more variables: std.error.unmoderated <dbl>, df.unmoderated <dbl>,
#> #   std.error <dbl>, statistic <dbl>, 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.140          0.628              1.54  
#>  2 0m5WN4~67…         0.0318            0.973          1                  0.0343
#>  3 7QuTub~61…         0.909             0.530          1                  0.644 
#>  4 7cbcrd~26…         0.612             0.628          1                  0.493 
#>  5 9VUkAq~34…         0.768             0.607          1                  0.522 
#>  6 At886V~77…        -1.91              0.0519         0.390             -2.06  
#>  7 BEJI92~27…        -1.30              0.173          0.628             -1.41  
#>  8 CGzoYe~08…         0.867             0.352          1                  0.954 
#>  9 CtOJ9t~91…         0.107             0.911          1                  0.113 
#> 10 DoWup2~28…        -1.50              0.0951         0.571             -1.75  
#> # ℹ 20 more rows