Skip to contents

Analogous to build_model_impute but for limma's matrix-based pipeline. Fits all proteins with lmFit, identifies proteins with NA coefficients (typically from entire missing groups), imputes their missing values with the limit of detection (LOD), refits, and replaces the variance with a borrowed estimate from successful proteins.

Usage

build_model_limma_impute(
  lfqdata,
  strategy,
  modelName = paste0(strategy$model_name, "Imputed"),
  lod = NULL,
  df_method = c("observed", "borrowed")
)

Arguments

lfqdata

an LFQData object (aggregated to protein level)

strategy

output of strategy_limma

modelName

name of model (default: strategy name + "Imputed")

lod

numeric limit of detection; if NULL, auto-computed from data via MissingHelpers

df_method

how to set degrees of freedom for imputed proteins: "observed" (default) uses max(n_observed - p, 1) where n_observed counts only non-missing values; "borrowed" uses the median df from successful fits

Value

a ModelLimma object with a hybrid fit

Details

The LOD imputation gives plausible coefficients (fold change direction), while the borrowed sigma and corrected degrees of freedom ensure that inference is not artificially precise from the constant imputation.

See also

Other modelling: AnovaExtractor, Contrasts, ContrastsDEqMSFacade, ContrastsFirth, ContrastsFirthFacade, ContrastsLMFacade, ContrastsLMImputeFacade, ContrastsLMMissingFacade, ContrastsLimma, ContrastsLimmaFacade, ContrastsLimmaImputeFacade, ContrastsLmerFacade, ContrastsMissing, ContrastsModerated, ContrastsModeratedDEqMS, ContrastsPlotter, ContrastsRLMFacade, ContrastsROPECA, ContrastsROPECAFacade, ContrastsTable, INTERNAL_FUNCTIONS_BY_FAMILY, LR_test(), Model, ModelFirth, ModelLimma, StrategyLM, StrategyLimma, StrategyLmer, StrategyLogistf, StrategyRLM, build_contrast_analysis(), build_model(), build_model_glm_peptide(), build_model_glm_protein(), build_model_impute(), build_model_limma(), build_model_logistf(), compute_borrowed_variance(), compute_borrowed_variance_limma(), compute_contrast(), compute_lmer_contrast(), contrasts_fisher_exact(), get_anova_df(), get_complete_model_fit(), get_p_values_pbeta(), group_label(), impute_refit_singular(), isSingular_lm(), linfct_all_possible_contrasts(), linfct_factors_contrasts(), linfct_from_model(), linfct_matrix_contrasts(), merge_contrasts_results(), model_analyse(), model_summary(), moderated_p_deqms(), moderated_p_deqms_long(), moderated_p_limma(), moderated_p_limma_long(), new_lm_imputed(), pivot_model_contrasts_2_Wide(), plot_lmer_peptide_predictions(), sim_build_models_lm(), sim_build_models_lmer(), sim_build_models_logistf(), sim_make_model_lm(), sim_make_model_lmer(), strategy_limma(), strategy_logistf(), summary_ROPECA_median_p.scaled()

Examples

istar <- sim_lfq_data_protein_config(Nprot = 50, weight_missing = 0.5)
#> creating sampleName from fileName column
#> completing cases
#> completing cases done
#> setup done
lfqdata <- LFQData$new(istar$data, istar$config)
lfqdata$rename_response("transformedIntensity")

strat <- strategy_limma("transformedIntensity ~ group_")
mod <- build_model_limma_impute(lfqdata, strat)
#> Warning: Partial NA coefficients for 2 probe(s)
#> completing cases
mod$get_coefficients()
#> # A tibble: 147 × 6
#>    protein_Id  factor      Estimate Std..Error t.value  Pr...t..
#>    <chr>       <chr>          <dbl>      <dbl>   <dbl>     <dbl>
#>  1 0EfVhX~7161 (Intercept)     20.6      0.570    36.1 1.22e-112
#>  2 0m5WN4~3543 (Intercept)     20.8      0.570    36.6 6.27e-114
#>  3 76k03k~9735 (Intercept)     20.2      0.493    40.9 3.48e-126
#>  4 7QuTub~5556 (Intercept)     22.8      0.493    46.2 2.51e-140
#>  5 7cbcrd~0495 (Intercept)     16.7      0.493    33.8 1.93e-105
#>  6 7soopj~3451 (Intercept)     26.3      0.493    53.4 1.83e-157
#>  7 9VUkAq~8655 (Intercept)     22.2      0.494    45.0 2.59e-137
#>  8 At886V~0359 (Intercept)     17.1      0.698    24.5 2.33e- 74
#>  9 BEJI92~5483 (Intercept)     15.9      0.698    22.7 1.03e- 67
#> 10 CGzoYe~1248 (Intercept)     18.2      0.493    37.0 3.72e-115
#> # ℹ 137 more rows