Skip to contents

Convenience wrapper that creates a StrategyLogistf object.

Convenience wrapper that creates a StrategyRfit object.

Convenience wrapper that creates a StrategyLmer object.

Convenience wrapper that creates a StrategyLM object.

Convenience wrapper that creates a StrategyRLM object.

Usage

strategy_logistf(modelstr, model_name = "logistf", control = list())

strategy_rfit(modelstr, model_name = "rfit", control = list())

strategy_lmer(modelstr, model_name = "Model", control = list())

strategy_lm(modelstr, model_name = "Model", weights = NULL)

strategy_rlm(modelstr, model_name = "Model", control = list())

Arguments

modelstr

model formula

model_name

name of model

control

for strategy_rlm(): maxit (default 20) and acc (default 1e-4), the iteration limit and the relative change of the IRLS residuals that stops rlm; the criterion is relative, so it does not depend on the intensity scale, and 1e-4 is far below the precision of log2 intensities.

weights

optional character string naming a column in the data containing per-observation weights, passed to lm. Default NULL (unweighted).

Value

a StrategyLogistf object

a StrategyRfit object

a StrategyLmer object

a StrategyLM object

a StrategyRLM object

See also

Other modelling: AnovaExtractor, Contrasts, ContrastsComparison, ContrastsDEqMSFacade, ContrastsDEqMSVoomFacade, ContrastsFacadeBase, ContrastsFirth, ContrastsFirthFacade, ContrastsHurdleFacade, ContrastsHurdleNestedFacade, ContrastsLMFacade, ContrastsLMImputeFacade, ContrastsLimma, ContrastsLimmaFacade, ContrastsLimmaImputeFacade, ContrastsLimmaVoomFacade, ContrastsLimmaVoomImputeFacade, ContrastsLimpaFacade, ContrastsLimpaNestedFacade, ContrastsLmerNestedFacade, ContrastsModerated, ContrastsModeratedDEqMS, ContrastsPlotter, ContrastsRLMFacade, ContrastsROPECA, ContrastsROPECANestedFacade, ContrastsROPECAV2, ContrastsROPECAV2NestedFacade, ContrastsRfitFacade, ContrastsRfitImputeFacade, ContrastsTable, INTERNAL_FUNCTIONS_BY_FAMILY, Model, ModelFirth, ModelLimma, StrategyLM, StrategyLimma, StrategyLimpa, StrategyLmer, StrategyLogistf, StrategyRLM, StrategyRfit, build_contrast_analysis(), build_model(), build_model_glm_protein(), build_model_impute(), build_model_limma(), build_model_limma_impute(), build_model_limma_voom(), build_model_limma_voom_impute(), build_model_limpa(), compute_borrowed_variance(), compute_borrowed_variance_limma(), df.residual.rfit_prolfqua(), group_label(), impute_from_model(), impute_refit_singular(), list_facades(), lookup_facade(), lr_test(), merge_contrasts_results(), new_imputed_model(), nobs.rfit_prolfqua(), pivot_model_contrasts_to_wide(), prolfqua_analysis_methods, register_facade(), sigma.rfit_prolfqua(), strategy_limma(), strategy_limpa(), vcov.rfit_prolfqua()

Examples

tmp <- strategy_logistf("bin_resp ~ condition", model_name = "parallel design")
tmp$formula
#> bin_resp ~ condition
#> <environment: 0x5ed40cc6f470>

istar <- prolfqua::sim_lfq_data_peptide_config(n_proteins = 10, with_missing = TRUE,
  weight_missing = 0.5, seed = 3)
#> `protein_Id`: columns `proteinID`, `idtype2` united with separator '~'.
#> creating sampleName from file_name column
#> setup_analysis: dropped 6 unconfigured columns: average_prot_abundance, sd, mean, N, avg_peptide_abd, Replicate.
#> setup_analysis: added 60 rows with NA response for feature and sample combinations absent from the input.
lfq <- LFQData$new(istar$data, istar$config)
detection <- lfq$data_long()
detection$bin_resp <- as.integer(!is.na(detection[[lfq$response()]]))
config <- lfq$get_config()
config$bin_resp <- "bin_resp"
istar <- LFQData$new(detection, config)
df <- istar$summarize_hierarchy()
df2 <- df[df[[ncol(df)]] > 1, ]
istar2 <- istar$get_subset(df2)
istar2$data_long() |>
  dplyr::group_by(protein_Id) |>
  tidyr::nest() -> nestProtein
modelFunction <- strategy_logistf("bin_resp ~ group_ + peptide_Id",
  model_name = "random_example")
modelFunction$model_fun(nestProtein$data[[1]])
#> logistf::logistf(formula = self$formula, data = DFT, pl = FALSE, 
#>     control = do.call(logistf::logistf.control, self$control), 
#>     weights = Freq)
#> Model fitted by Penalized ML
#> Confidence intervals and p-values by Wald 
#> 
#> Coefficients:
#>        (Intercept)            group_B         group_Ctrl peptide_IdFLq7LKTq 
#>       2.101899e+00       6.773389e-01      -6.663876e-01       9.509484e-16 
#> peptide_IdJYhOpuPH peptide_IdLiw5EMKP peptide_IdVcatZJTa peptide_IdjrLUqOjg 
#>      -1.068335e+00       7.971977e-16      -1.068335e+00       1.197563e+00 
#> peptide_Idq2jTaC1y 
#>      -1.445323e+00 
#> 
#> Likelihood ratio test=10.07111 on 8 df, p=0.2600707, n=84
#> 
modelFunction$model_fun(nestProtein$data[[4]])
#> logistf::logistf(formula = self$formula, data = DFT, pl = FALSE, 
#>     control = do.call(logistf::logistf.control, self$control), 
#>     weights = Freq)
#> Model fitted by Penalized ML
#> Confidence intervals and p-values by Wald 
#> 
#> Coefficients:
#>        (Intercept)            group_B         group_Ctrl peptide_IdWcAw5ozd 
#>       8.375544e-03       8.360364e-11       9.365126e-01      -3.147690e-01 
#> peptide_IdgdnXrza3 peptide_IdxvlVt88v 
#>      -2.035803e-09      -6.303721e-01 
#> 
#> Likelihood ratio test=3.276542 on 5 df, p=0.657435, n=48
#> 
tmp <- strategy_rfit("Intensity ~ condition", model_name = "parallel design")
tmp$formula
#> Intensity ~ condition
#> <environment: 0x5ed40f2f9948>
modelFunction <- strategy_lmer("abundanceC ~ group_ + (1|peptide_Id)",
  model_name = "random_example")
modelFunction$formula
#> abundanceC ~ group_ + (1 | peptide_Id)
#> <environment: 0x5ed40f388cf0>
tmp <- strategy_lm("Intensity ~ condition", model_name = "parallel design")
tmp$formula
#> Intensity ~ condition
#> <environment: 0x5ed40f415720>
tmp$weights
#> NULL
tmp <- strategy_rlm("Intensity ~ condition", model_name = "parallel design")
tmp$formula
#> Intensity ~ condition
#> <environment: 0x5ed40f4cdb08>
strategy_rlm("Intensity ~ condition", control = list(maxit = 50))$control
#> $maxit
#> [1] 50
#> 
#> $acc
#> [1] 1e-04
#>