Skip to contents

Firth's logistic regression strategy (R6 class)

Firth's logistic regression strategy (R6 class)

Details

Encapsulates everything needed to fit per-protein Firth's bias-reduced logistic regression via logistf and extract contrasts.

Public fields

formula

model formula

model_name

name of model

report_columns

columns to report

is_mixed

always FALSE for logistf

anova_df

list with anova function and column names

Methods


Method new()

Create a new StrategyLogistf

Usage

StrategyLogistf$new(
  modelstr,
  model_name = "logistf",
  report_columns = c("statistic", "p.value", "p.value.adjusted", "moderated.p.value",
    "moderated.p.value.adjusted"),
  test = "Chisq"
)

Arguments

modelstr

model formula string

model_name

name of model

report_columns

columns to report

test

type of test statistic to use (e.g. "Chisq")


Method model_fun()

Fit logistf to one protein's data

Usage

StrategyLogistf$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

StrategyLogistf$isSingular(model)

Arguments

model

fitted model


Method contrast_fun()

Compute contrasts from fitted model

Usage

StrategyLogistf$contrast_fun(...)

Arguments

...

passed to my_contrast_V2


Method df_residual()

Get residual degrees of freedom

Usage

StrategyLogistf$df_residual(model)

Arguments

model

fitted model


Method sigma()

Get residual standard error (always 1 for logistic)

Usage

StrategyLogistf$sigma(model)

Arguments

model

fitted model


Method clone()

The objects of this class are cloneable with this method.

Usage

StrategyLogistf$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

strat <- StrategyLogistf$new("bin_resp ~ condition")
strat$model_fun(get_formula = TRUE)
#> bin_resp ~ condition
#> <environment: 0x561446a606a8>