Skip to contents

Linear model strategy (R6 class)

Linear model strategy (R6 class)

Details

Encapsulates everything needed to fit per-protein linear models and extract contrasts: the formula, model fitting function, singularity check, contrast computation, ANOVA, and residual statistics.

See also

Other modelling: AnovaExtractor, Contrasts, ContrastsDEqMSFacade, ContrastsDEqMSVoomFacade, ContrastsFirth, ContrastsFirthFacade, ContrastsLMFacade, ContrastsLMImputeFacade, ContrastsLMMissingFacade, ContrastsLimma, ContrastsLimmaFacade, ContrastsLimmaImputeFacade, ContrastsLimmaVoomFacade, ContrastsLimmaVoomImputeFacade, ContrastsLimpaFacade, ContrastsLmerFacade, ContrastsMissing, ContrastsModerated, ContrastsModeratedDEqMS, ContrastsPlotter, ContrastsRLMFacade, ContrastsROPECA, ContrastsROPECAFacade, ContrastsTable, INTERNAL_FUNCTIONS_BY_FAMILY, LR_test(), Model, ModelFirth, ModelLimma, StrategyLimma, StrategyLimpa, StrategyLmer, StrategyLogistf, StrategyRLM, 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(), 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(), 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_to_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_limpa(), strategy_logistf(), summary_ROPECA_median_p.scaled()

Public fields

formula

model formula

model_name

name of model

report_columns

columns to report

weights

optional character string naming a column in the data containing per-observation weights, passed to lm.

is_mixed

always FALSE for lm

anova_df

list with anova function and column names

Methods


Method new()

Create a new StrategyLM

Usage

StrategyLM$new(
  modelstr,
  model_name = "Model",
  report_columns = c("statistic", "p.value", "p.value.adjusted", "moderated.p.value",
    "moderated.p.value.adjusted"),
  weights = NULL
)

Arguments

modelstr

model formula string

model_name

name of model

report_columns

columns to report

weights

optional character string naming a column in the data containing per-observation weights


Method model_fun()

Fit lm to one protein's data

Usage

StrategyLM$model_fun(x, pb, get_formula = FALSE)

Arguments

x

data.frame for one protein

pb

optional progress bar

get_formula

if TRUE, return formula instead of fitting


Method isSingular()

Check if model is singular

Usage

StrategyLM$isSingular(model)

Arguments

model

fitted model


Method contrast_fun()

Compute contrasts from fitted model

Usage

StrategyLM$contrast_fun(...)

Arguments

...

passed to compute_contrast


Method df_residual()

Get residual degrees of freedom

Usage

StrategyLM$df_residual(model)

Arguments

model

fitted model


Method sigma()

Get residual standard error

Usage

StrategyLM$sigma(model)

Arguments

model

fitted model


Method clone()

The objects of this class are cloneable with this method.

Usage

StrategyLM$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

strat <- StrategyLM$new("Intensity ~ condition", model_name = "parallel design")
strat$model_fun(get_formula = TRUE)
#> Intensity ~ condition
#> <environment: 0x55721d43ef68>
strat$weights
#> NULL