
Compute VPC quantile statistics from preprocessed data
Source:R/vpc_preprocess_df.R
df_vpccompute.RdInternal function. Always emits both standard and prediction-corrected
summary statistics: the std flavor uses raw OBSDV/SIMDV; the pc flavor
applies var_loqcens to SIMDV (when loq is supplied) and
var_predcorr() per (bin_var × strat_var × CMT) to both
OBSDV and SIMDV. The pc columns are returned with a pc_ prefix.
Arguments
- data
Preprocessed simulation data, typically from
df_vpcpreprocess().- pi
Numeric vector of length 2 specifying prediction interval quantiles. Default is
c(0.05, 0.95).- ci
Numeric scalar in
(0, 1)specifying the simulation interval (e.g.0.90for a 90% CI). Default is0.90.- bin_var
String. Binning variable name. Default is
"BIN_MID".- strat_var
String or
NULL. Stratification variable name. Default isNULL.- irep_name
String. Replicate identifier column name. Default is
"SIM".- lower_bound
Numeric. Forwarded to
var_predcorr()in the pc flavor.- mode
One of
"auto"(default),"rank", or"drop". Controls how BLQ-encoded values flow into quantile aggregation per-flavor:"auto"uses"rank"for the std flavor and"drop"for the pc flavor (the historical defaults);"rank"and"drop"apply to both flavors.- loq
Numeric vector of unique LOQ values present in
data(length 1 when LLOQ is constant), orNULL. Defaults toattr(data, "loq"). When non-NULL, the std stats includesim_prop_blq_low/med/hi(BLQ detection reads per-row thresholds fromdata$LOQ). The pc stats do not emit apc_sim_prop_blq_*set — LOQ has no meaning on the prediction-corrected scale.
Value
A list of two data.frames with class c("vpc_stats", "list"):
statsWide summary with both std and pc columns. Std columns are unprefixed (
obs_low/med/hi,sim_low_*etc.); pc-flavor observed and simulated quantile columns carry apc_prefix (pc_obs_low,pc_sim_low_med, etc.).obs_n,obs_n_blq,obs_prop_blq,sim_prop_blq_*,ci,pi_low,pi_hiare single (not duplicated). Carries attributesn_replicates,loq, andstrat_var.obsFirst-replicate observation rows with
MDV == 0, carrying bothOBSDV(std) andPC_OBSDV(prediction-corrected).