Skip to contents

R6 class representing modelling result

R6 class representing modelling result

Super class

prolfqua::ModelInterface -> ModelFirth

Public fields

models

data.frame with modelling data and model.

modelName

name of model

subject_Id

e.g. protein_Id

anova_df

function to compute anova

p.adjust

function to adjust p-values

Methods


Method new()

initialize

Usage

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

Arguments

models

dataframe with modelling results

modelName

name of model

subject_Id

subject column name

p.adjust

method to adjust p-values


Method get_coefficients()

return model coefficient table

Usage

ModelFirth$get_coefficients()


Method get_anova()

return anova table

Usage

ModelFirth$get_anova()


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.

Examples





istar <- prolfqua::sim_lfq_data_peptide_config(Nprot = 10, with_missing = TRUE,
  weight_missing = 0.5, seed = 3)
#> creating sampleName from fileName column
#> completing cases
#> completing cases done
#> setup done
istar$data <- prolfqua::encode_bin_resp(istar$data, istar$config)
#> completing cases
tmp <- LFQData$new(istar$data, istar$config)
formula <- paste0(tmp$config$bin_resp , "~ group_")
mod <- build_model_logistf(tmp, formula)
#> Joining with `by = join_by(protein_Id)`
#> Joining with `by = join_by(protein_Id)`
#> Joining with `by = join_by(protein_Id)`
#> Joining with `by = join_by(protein_Id)`
tmp <- mod$get_coefficients()
mod$coef_histogram()
#> $plot

#> 
#> $name
#> [1] "Coef_Histogram_modelFirth.pdf"
#> 
mod$coef_pairs()
#> $plot
#> # A tibble: 10 × 4
#>    subject_Id  `(Intercept)`   group_B group_Ctrl
#>    <chr>               <dbl>     <dbl>      <dbl>
#>  1 7IZdVV~0841       2.10     6.77e- 1  -6.66e- 1
#>  2 AZPG26~2091       0.905    2.23e-16   1.82e+ 0
#>  3 AoNKbb~6908       1.01    -7.77e- 1  -4.25e- 1
#>  4 JnEDsz~4938       0.00838  8.36e-11   9.37e- 1
#>  5 tCZCHm~6695       2.16     1.23e+ 0   1.23e+ 0
#>  6 EnbuYk~0350       0.847    1.35e+ 0  -3.04e+ 0
#>  7 NNASGK~1417       2.20    -1.35e+ 0   4.13e-16
#>  8 XYrp6h~5793       2.20    -1.52e-15  -1.07e-15
#>  9 quTD7H~4566       0.847    1.35e+ 0  -8.47e- 1
#> 10 tHE075~8231       0.847    1.35e+ 0   1.35e+ 0
#> 
#> $name
#> [1] "Coef_Pairsplot_modelFirth.pdf"
#> 
mod$get_anova()
#> Warning: method not implemented!
#> NULL
mod$coef_volcano()
#> $plot

#> 
#> $name
#> [1] "Coef_VolcanoPlot_modelFirth.pdf"
#> 
mod$anova_histogram()
#> Warning: not implemented
#> NULL
mod$write_coef_figures(tempdir())
#> Writing figure into : /tmp/RtmpdHigFb/Coef_Histogram_modelFirth.pdf
#> Writing figure into : /tmp/RtmpdHigFb/Coef_VolcanoPlot_modelFirth.pdf
#> Writing figure into : /tmp/RtmpdHigFb/Coef_Pairsplot_modelFirth.pdf
#> # A tibble: 10 × 4
#>    subject_Id  `(Intercept)`   group_B group_Ctrl
#>    <chr>               <dbl>     <dbl>      <dbl>
#>  1 7IZdVV~0841       2.10     6.77e- 1  -6.66e- 1
#>  2 AZPG26~2091       0.905    2.23e-16   1.82e+ 0
#>  3 AoNKbb~6908       1.01    -7.77e- 1  -4.25e- 1
#>  4 JnEDsz~4938       0.00838  8.36e-11   9.37e- 1
#>  5 tCZCHm~6695       2.16     1.23e+ 0   1.23e+ 0
#>  6 EnbuYk~0350       0.847    1.35e+ 0  -3.04e+ 0
#>  7 NNASGK~1417       2.20    -1.35e+ 0   4.13e-16
#>  8 XYrp6h~5793       2.20    -1.52e-15  -1.07e-15
#>  9 quTD7H~4566       0.847    1.35e+ 0  -8.47e- 1
#> 10 tHE075~8231       0.847    1.35e+ 0   1.35e+ 0
#> agg_record_1189364864 
#>                     2 

istar <- prolfqua::sim_lfq_data_protein_config(Nprot = 10, with_missing = TRUE,
  weight_missing = 0.5, seed = 3)
#> creating sampleName from fileName column
#> completing cases
#> completing cases done
#> setup done
istar$data <- prolfqua::encode_bin_resp(istar$data, istar$config)
#> completing cases
tmp <- LFQData$new(istar$data, istar$config)
formula <- paste0(tmp$config$bin_resp , "~ group_")
mod <- build_model_logistf(tmp, formula)
#> Joining with `by = join_by(protein_Id)`
#> Joining with `by = join_by(protein_Id)`
tmp <- mod$get_coefficients()
stopifnot(nrow(tmp) == 30)
mod$coef_histogram()
#> $plot

#> 
#> $name
#> [1] "Coef_Histogram_modelFirth.pdf"
#> 
mod$coef_pairs()
#> $plot
#> # A tibble: 10 × 4
#>    subject_Id  `(Intercept)`   group_B group_Ctrl
#>    <chr>               <dbl>     <dbl>      <dbl>
#>  1 7IZdVV~0841         2.20   5.61e-16  -2.20e+ 0
#>  2 AZPG26~2091         2.20  -1.52e-15  -1.07e-15
#>  3 AoNKbb~6908         2.20   6.16e-16  -1.35e+ 0
#>  4 EnbuYk~0350         0.847 -8.47e- 1  -6.83e-16
#>  5 JnEDsz~4938        -0.847 -1.35e+ 0   1.18e-16
#>  6 NNASGK~1417         2.20  -1.52e-15  -1.07e-15
#>  7 XYrp6h~5793         2.20  -1.52e-15  -1.07e-15
#>  8 quTD7H~4566         2.20  -1.35e+ 0  -2.20e+ 0
#>  9 tCZCHm~6695         2.20  -1.35e+ 0   4.13e-16
#> 10 tHE075~8231         0.847  1.35e+ 0   1.85e-16
#> 
#> $name
#> [1] "Coef_Pairsplot_modelFirth.pdf"
#> 
mod$get_anova()
#> Warning: method not implemented!
#> NULL
mod$coef_volcano()
#> $plot

#> 
#> $name
#> [1] "Coef_VolcanoPlot_modelFirth.pdf"
#> 
mod$anova_histogram()
#> Warning: not implemented
#> NULL
mod$write_coef_figures(tempdir())
#> Writing figure into : /tmp/RtmpdHigFb/Coef_Histogram_modelFirth.pdf
#> Writing figure into : /tmp/RtmpdHigFb/Coef_VolcanoPlot_modelFirth.pdf
#> Writing figure into : /tmp/RtmpdHigFb/Coef_Pairsplot_modelFirth.pdf
#> # A tibble: 10 × 4
#>    subject_Id  `(Intercept)`   group_B group_Ctrl
#>    <chr>               <dbl>     <dbl>      <dbl>
#>  1 7IZdVV~0841         2.20   5.61e-16  -2.20e+ 0
#>  2 AZPG26~2091         2.20  -1.52e-15  -1.07e-15
#>  3 AoNKbb~6908         2.20   6.16e-16  -1.35e+ 0
#>  4 EnbuYk~0350         0.847 -8.47e- 1  -6.83e-16
#>  5 JnEDsz~4938        -0.847 -1.35e+ 0   1.18e-16
#>  6 NNASGK~1417         2.20  -1.52e-15  -1.07e-15
#>  7 XYrp6h~5793         2.20  -1.52e-15  -1.07e-15
#>  8 quTD7H~4566         2.20  -1.35e+ 0  -2.20e+ 0
#>  9 tCZCHm~6695         2.20  -1.35e+ 0   4.13e-16
#> 10 tHE075~8231         0.847  1.35e+ 0   1.85e-16
#> agg_record_1189364864 
#>                     2