ModelFirth: R6 class representing modelling result

ModelFirthR Documentation

R6 class representing modelling result

Description

R6 class representing modelling result

R6 class representing modelling result

Super class

prolfqua::ModelInterface -> ModelFirth

Public fields

modelDF

data.frame with modelling data and model.

modelName

name of model

subject_Id

e.g. protein_Id

model_strategy

function to create the models

anova_df

function to compute anova

p.adjust

function to adjust p-values

Active bindings

modelDF

data.frame with modelling data and model.

model_strategy

function to create the models

Methods

Public methods


Method new()

initialize

Usage
ModelFirth$new(
  models,
  modelName = "modelFirth",
  subject_Id = "protein_Id",
  p.adjust = prolfqua::adjust_p_values
)
Arguments
modelName

name of model

subject_Id

subject column name

p.adjust

method to adjust p-values

modelDF

dataframe with modelling results

model_strategy

model_strategy see strategy_lmer


Method get_coefficients()

return model coefficient table

Usage
ModelFirth$get_coefficients()

Method get_anova()

return anova table

Usage
ModelFirth$get_anova()

Method write_coefficients()

writes model coefficients to file

Usage
ModelFirth$write_coefficients(path, format = "xlsx")
Arguments
path

folder to write to

format

default xlsx lfq_write_table


Method coef_histogram()

histogram of model coefficient

Usage
ModelFirth$coef_histogram()

Method coef_volcano()

volcano plot of non intercept coefficients

Usage
ModelFirth$coef_volcano()

Method coef_pairs()

pairs-plot of coefficients

Usage
ModelFirth$coef_pairs()

Method anova_histogram()

histogram of ANOVA results

Usage
ModelFirth$anova_histogram(what = c("p.value", "FDR"))
Arguments
what

show either "Pr..F." or "FDR.Pr..F."


Method write_anova_figures()

write figures related to ANOVA into pdf file

Usage
ModelFirth$write_anova_figures(path, width = 10, height = 10)
Arguments
path

folder name

width

figure width

height

figure height


Method write_coef_figures()

write figures related to Coefficients into pdf file

Usage
ModelFirth$write_coef_figures(path, width = 10, height = 10)
Arguments
path

folder name

width

figure width

height

figure height


Method clone()

The objects of this class are cloneable with this method.

Usage
ModelFirth$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other modelling: Contrasts, ContrastsFirth, ContrastsMissing, ContrastsModerated, ContrastsPlotter, ContrastsProDA, ContrastsROPECA, ContrastsTable, INTERNAL_FUNCTIONS_BY_FAMILY, LR_test(), Model, build_model(), build_model_logistf(), contrasts_fisher_exact(), generate_contrasts(), generate_contrasts_for_factor(), get_anova_df(), get_complete_model_fit(), get_p_values_pbeta(), group_label(), interaction_contrasts(), isSingular_lm(), level_specific_contrasts(), linfct_all_possible_contrasts(), linfct_factors_contrasts(), linfct_from_model(), linfct_matrix_contrasts(), main_effect_contrasts(), merge_contrasts_results(), model_analyse(), model_summary(), moderated_p_limma(), moderated_p_limma_long(), my_contest(), my_contrast(), my_contrast_V1(), my_contrast_V2(), my_glht(), pivot_model_contrasts_2_Wide(), plot_lmer_peptide_predictions(), process_factor(), sim_build_models_lm(), sim_build_models_lmer(), sim_build_models_logistf(), sim_make_model_lm(), sim_make_model_lmer(), strategy_logistf(), summary_ROPECA_median_p.scaled()

Examples





istar <- prolfqua::sim_lfq_data_peptide_config(Nprot = 10, with_missing = TRUE, weight_missing = 0.5, seed = 3)
istar$data <- prolfqua::encode_bin_resp(istar$data, istar$config)
tmp <- LFQData$new(istar$data, istar$config)
formula <- paste0(tmp$config$table$bin_resp , "~ group_")
mod <- build_model_logistf(tmp, formula)
tmp <- mod$get_coefficients()
mod$coef_histogram()
mod$coef_pairs()
mod$get_anova()
mod$coef_volcano()
mod$anova_histogram()
mod$write_coef_figures(tempdir())

istar <- prolfqua::sim_lfq_data_protein_config(Nprot = 10, with_missing = TRUE, weight_missing = 0.5, seed = 3)
istar$data <- prolfqua::encode_bin_resp(istar$data, istar$config)
tmp <- LFQData$new(istar$data, istar$config)
formula <- paste0(tmp$config$table$bin_resp , "~ group_")
ModelFirth$undebug("get_coefficients")
mod <- build_model_logistf(tmp, formula)
tmp <- mod$get_coefficients()
stopifnot(nrow(tmp) == 30)
mod$coef_histogram()
mod$coef_pairs()
mod$get_anova()
mod$coef_volcano()
mod$anova_histogram()
mod$write_coef_figures(tempdir())

wolski/prolfqua documentation built on June 8, 2025, 5:19 a.m.