Learn R Programming

SVEMnet (version 3.2.0)

svem_wmt_multi: Whole-model tests for multiple SVEM responses (WMT wrapper)

Description

Convenience wrapper around svem_significance_test_parallel for running whole-model tests (WMT) on multiple responses that share the same dataset and mixture constraints. This helper:

  • takes a formula or a list of formulas and a single data frame,

  • calls svem_significance_test_parallel() for each response,

  • extracts per-response p-values and converts them to WMT multipliers via a chosen transform, and

  • optionally plots the WMT objects together using plot.svem_significance_test and prints a compact summary of p-values and multipliers.

The resulting multipliers vector is designed to be passed directly to downstream scoring functions (for example, as an optional WMT argument to svem_score_random()), with response names matched by names().

Usage

svem_wmt_multi(
  formulas,
  data,
  mixture_groups = NULL,
  wmt_transform = c("neglog10", "one_minus_p"),
  wmt_control = list(seed = 123),
  plot = TRUE,
  verbose = TRUE
)

Value

A list of class "svem_wmt_multi" with components:

wmt_objects

Named list of WMT objects (one per response), as returned by svem_significance_test_parallel(). Entries are NULL where a WMT call failed.

p_values

Named numeric vector of per-response p-values (bounded away from 0/1), or NA when unavailable.

multipliers

Named numeric vector of per-response WMT multipliers derived from the p-values using wmt_transform.

wmt_transform

The transformation used.

wmt_control

The list of arguments passed through to svem_significance_test_parallel().

Arguments

formulas

A single formula or a (preferably named) list of formulas, one per response. If unnamed, response names are inferred from the left-hand side of each formula; non-unique names are made unique.

data

Data frame containing the predictors and responses referenced in formulas.

mixture_groups

Optional mixture and simplex constraints passed to svem_significance_test_parallel.

wmt_transform

Character; transformation used to convert WMT p-values into multipliers. One of:

  • "neglog10": \(f(p) = [-\log_{10}(p)]^{\text{strength}}\),

  • "one_minus_p": \(f(p) = (1 - p)^{\text{strength}}\).

Currently, strength = 1 is used internally.

wmt_control

Optional list of extra arguments passed directly to svem_significance_test_parallel. By default this is list(seed = 123) so that WMT calls are reproducible; you may override or extend this (e.g. list(seed = 999, nPerm = 300)). Any entries not recognized by svem_significance_test_parallel are ignored by that function.

plot

Logical; if TRUE (default), attempt to plot all successfully computed WMT objects together via plot.svem_significance_test.

verbose

Logical; if TRUE (default), print progress and a compact summary of p-values and multipliers.

See Also

svem_significance_test_parallel, plot.svem_significance_test

Examples

Run this code
# \donttest{
data(lipid_screen)

spec <- bigexp_terms(
  Potency ~ PEG + Helper + Ionizable + Cholesterol +
    Ionizable_Lipid_Type + N_P_ratio + flow_rate,
  data             = lipid_screen,
  factorial_order  = 3,
  polynomial_order = 3,
  include_pc_2way  = TRUE,
  include_pc_3way  = FALSE
)

form_pot <- bigexp_formula(spec, "Potency")
form_siz <- bigexp_formula(spec, "Size")
form_pdi <- bigexp_formula(spec, "PDI")

mix <- list(list(
  vars  = c("PEG", "Helper", "Ionizable", "Cholesterol"),
  lower = c(0.01, 0.10, 0.10, 0.10),
  upper = c(0.05, 0.60, 0.60, 0.60),
  total = 1.0
))

set.seed(123)
wmt_out <- svem_wmt_multi(
  formulas       = list(Potency = form_pot,
                        Size    = form_siz,
                        PDI     = form_pdi),
  data           = lipid_screen,
  mixture_groups = mix,
  wmt_transform  = "neglog10",
  wmt_control    = list(seed = 123),
  plot           = TRUE
)

wmt_out$p_values
wmt_out$multipliers

## later: pass wmt_out$multipliers into svem_score_random()
# }

Run the code above in your browser using DataLab