Skip to contents

Fits per-protein models, then re-fits failed/singular proteins after imputing missing values with the limit of detection (LOD) and clamping. Covariance is borrowed from successful fits so that variance is not underestimated by the constant imputation.

Usage

build_model_impute(
  lfqdata,
  model_strategy,
  modelName = paste0(model_strategy$model_name, "Imputed"),
  lod = NULL,
  borrow_method = c("sigma", "vcov"),
  df_method = c("observed", "borrowed")
)

Arguments

lfqdata

LFQData object (aggregated to protein level)

model_strategy

model strategy object (e.g. from strategy_lm)

modelName

model name (default appends "Imputed")

lod

numeric limit of detection; if NULL, auto-computed from data

borrow_method

"sigma" borrows scalar sigma and uses per-protein (X'X)^-1; "vcov" borrows element-wise median of full vcov matrices

df_method

"observed" uses max(n_observed - p, 1); "borrowed" uses median df from successful fits

Value

a object of class Model

Examples

istar <- sim_lfq_data_protein_config(Nprot = 30, weight_missing = 0.5)
#> creating sampleName from fileName column
#> completing cases
#> completing cases done
#> setup done
lfqdata <- LFQData$new(istar$data, istar$config)
lfqdata$rename_response("transformedIntensity")
strat <- strategy_lm(paste(lfqdata$config$get_response(), "~ group_"))
mod <- build_model_impute(lfqdata, strat)
#> Joining with `by = join_by(protein_Id)`
#> completing cases