The strategy contains functions to fit the model but also compute the contrasts etc.
The strategy contains functions to fit the model but also compute the contrasts etc.
strategy_lmer(
modelstr,
model_name = "Model",
report_columns = c("statistic", "p.value", "p.value.adjusted", "moderated.p.value",
"moderated.p.value.adjusted")
)
strategy_lm(
modelstr,
model_name = "Model",
report_columns = c("statistic", "p.value", "p.value.adjusted", "moderated.p.value",
"moderated.p.value.adjusted")
)
strategy_rlm(
modelstr,
model_name = "Model",
report_columns = c("statistic", "p.value", "p.value.adjusted", "moderated.p.value",
"moderated.p.value.adjusted")
)
strategy_glm(
modelstr,
model_name = "Model",
test = "Chisq",
family = stats::binomial,
multiplier = 1,
offset = 1,
report_columns = c("statistic", "p.value", "p.value.adjusted", "moderated.p.value",
"moderated.p.value.adjusted")
)list with model function, contrast computation function etc.
list with model function, contrast computation function etc.
Other modelling:
Contrasts,
ContrastsMissing,
ContrastsModerated,
ContrastsPlotter,
ContrastsProDA,
ContrastsROPECA,
ContrastsTable,
INTERNAL_FUNCTIONS_BY_FAMILY,
LR_test(),
Model,
build_model(),
contrasts_fisher_exact(),
get_anova_df(),
get_complete_model_fit(),
get_p_values_pbeta(),
isSingular_lm(),
linfct_all_possible_contrasts(),
linfct_factors_contrasts(),
linfct_from_model(),
linfct_matrix_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(),
sim_build_models_lm(),
sim_build_models_lmer(),
sim_make_model_lm(),
sim_make_model_lmer(),
summary_ROPECA_median_p.scaled()
Other modelling:
Contrasts,
ContrastsMissing,
ContrastsModerated,
ContrastsPlotter,
ContrastsProDA,
ContrastsROPECA,
ContrastsTable,
INTERNAL_FUNCTIONS_BY_FAMILY,
LR_test(),
Model,
build_model(),
contrasts_fisher_exact(),
get_anova_df(),
get_complete_model_fit(),
get_p_values_pbeta(),
isSingular_lm(),
linfct_all_possible_contrasts(),
linfct_factors_contrasts(),
linfct_from_model(),
linfct_matrix_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(),
sim_build_models_lm(),
sim_build_models_lmer(),
sim_make_model_lm(),
sim_make_model_lmer(),
summary_ROPECA_median_p.scaled()
Other modelling:
Contrasts,
ContrastsMissing,
ContrastsModerated,
ContrastsPlotter,
ContrastsProDA,
ContrastsROPECA,
ContrastsTable,
INTERNAL_FUNCTIONS_BY_FAMILY,
LR_test(),
Model,
build_model(),
contrasts_fisher_exact(),
get_anova_df(),
get_complete_model_fit(),
get_p_values_pbeta(),
isSingular_lm(),
linfct_all_possible_contrasts(),
linfct_factors_contrasts(),
linfct_from_model(),
linfct_matrix_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(),
sim_build_models_lm(),
sim_build_models_lmer(),
sim_make_model_lm(),
sim_make_model_lmer(),
summary_ROPECA_median_p.scaled()
Other modelling:
Contrasts,
ContrastsMissing,
ContrastsModerated,
ContrastsPlotter,
ContrastsProDA,
ContrastsROPECA,
ContrastsTable,
INTERNAL_FUNCTIONS_BY_FAMILY,
LR_test(),
Model,
build_model(),
contrasts_fisher_exact(),
get_anova_df(),
get_complete_model_fit(),
get_p_values_pbeta(),
isSingular_lm(),
linfct_all_possible_contrasts(),
linfct_factors_contrasts(),
linfct_from_model(),
linfct_matrix_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(),
sim_build_models_lm(),
sim_build_models_lmer(),
sim_make_model_lm(),
sim_make_model_lmer(),
summary_ROPECA_median_p.scaled()
istar <- prolfqua::sim_lfq_data_peptide_config(Nprot = 10, with_missing = FALSE)
#> creating sampleName from fileName column
#> completing cases
#> completing cases done
#> setup done
istar <- prolfqua::LFQData$new(istar$data,istar$config)
istar$data <- istar$data |> dplyr::group_by(protein_Id) |>
dplyr::mutate(abundanceC = abundance - mean(abundance)) |> dplyr::ungroup()
istar$factors()
#> # A tibble: 12 × 3
#> sample sampleName group_
#> <chr> <chr> <chr>
#> 1 A_V1 A_V1 A
#> 2 A_V2 A_V2 A
#> 3 A_V3 A_V3 A
#> 4 A_V4 A_V4 A
#> 5 B_V1 B_V1 B
#> 6 B_V2 B_V2 B
#> 7 B_V3 B_V3 B
#> 8 B_V4 B_V4 B
#> 9 Ctrl_V1 Ctrl_V1 Ctrl
#> 10 Ctrl_V2 Ctrl_V2 Ctrl
#> 11 Ctrl_V3 Ctrl_V3 Ctrl
#> 12 Ctrl_V4 Ctrl_V4 Ctrl
modelFunction <- strategy_lmer("abundanceC ~ group_ + (1|peptide_Id) ", model_name = "random_example")
mod <- build_model(
istar,
modelFunction)
#> Warning: There were 4 warnings in `dplyr::mutate()`.
#> The first warning was:
#> ℹ In argument: `linear_model = purrr::map(data, model_strategy$model_fun, pb =
#> pb)`.
#> ℹ In group 2: `protein_Id = "7cbcrd~5725"`.
#> Caused by warning in `value[[3L]]()`:
#> ! WARN :Error: grouping factors must have > 1 sampled level
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 3 remaining warnings.
#> Joining with `by = join_by(protein_Id)`
sum(mod$modelDF$exists_lmer)
#> [1] 6
sum(mod$modelDF$isSingular, na.rm=TRUE)
#> [1] 0
tmp <- strategy_lm("Intensity ~ condition", model_name = "parallel design")
tmp$model_fun(get_formula = TRUE)
#> Intensity ~ condition
#> <environment: 0x1557850d0>
tmp$isSingular
#> function(m){
#> anyNA <- any(is.na(coefficients(m)))
#> if (anyNA) {
#> return(TRUE)
#> } else {
#> if (df.residual(m) >= 2) {
#> return(FALSE)
#> }
#> return(TRUE)
#> }
#> }
#> <environment: namespace:prolfqua>
tmp <- strategy_rlm("Intensity ~ condition", model_name = "parallel design")
tmp$model_fun(get_formula = TRUE)
#> Intensity ~ condition
#> <environment: 0x31170a1e8>
tmp$isSingular
#> function(m){
#> anyNA <- any(is.na(coefficients(m)))
#> if (anyNA) {
#> return(TRUE)
#> } else {
#> if (df.residual(m) >= 2) {
#> return(FALSE)
#> }
#> return(TRUE)
#> }
#> }
#> <environment: namespace:prolfqua>
tmp <- strategy_glm("Intensity ~ condition", model_name = "parallel design")
tmp$model_fun(get_formula = TRUE)
#> Intensity ~ condition
#> <environment: 0x3110e7698>
tmp$isSingular
#> function(m){
#> anyNA <- any(is.na(coefficients(m)))
#> if (anyNA) {
#> return(TRUE)
#> } else {
#> if (df.residual(m) >= 2) {
#> return(FALSE)
#> }
#> return(TRUE)
#> }
#> }
#> <environment: namespace:prolfqua>