Skip to contents

Robust linear model strategy (R6 class)

Robust linear model strategy (R6 class)

Details

Encapsulates everything needed to fit per-protein robust linear models via rlm and extract contrasts.

Public fields

formula

model formula

model_name

name of model

report_columns

columns to report

is_mixed

always FALSE for rlm

anova_df

list with anova function and column names

Methods


Method new()

Create a new StrategyRLM

Usage

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

Arguments

modelstr

model formula string

model_name

name of model

report_columns

columns to report


Method model_fun()

Fit rlm to one protein's data

Usage

StrategyRLM$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 (NA coefficients or df < 2)

Usage

StrategyRLM$isSingular(model)

Arguments

model

fitted model


Method contrast_fun()

Compute contrasts from fitted model

Usage

StrategyRLM$contrast_fun(...)

Arguments

...

passed to my_contrast_V2


Method df_residual()

Get residual degrees of freedom

Usage

StrategyRLM$df_residual(model)

Arguments

model

fitted model


Method sigma()

Get residual standard error

Usage

StrategyRLM$sigma(model)

Arguments

model

fitted model


Method clone()

The objects of this class are cloneable with this method.

Usage

StrategyRLM$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

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