Skip to contents

Performs global sensitivity analysis using either PRCC (Partial Rank Correlation Coefficients with LHS sampling) or eFAST (extended Fourier Amplitude Sensitivity Test). For each sampled parameter set, the function runs simulations via sg_sim(), reduces trajectories to scalar GSO summaries, and computes sensitivity indices for each output–statistic pair.

Usage

sg_globalsens_sim(
  method = c("PRCC", "eFAST"),
  model,
  params,
  par_bounds,
  n_sim,
  stimes,
  output,
  stat_comp = c("mean", "min", "max"),
  et,
  theta = NULL,
  cov = NULL
)

Arguments

method

Character string. "PRCC" or "eFAST".

model

GMO. RxODE2 model to simulate from.

params

Character vector of parameter names to vary.

par_bounds

A tibble or data frame with columns PAR, LB, UB.

n_sim

Integer. Number of samples (LHS size for PRCC, base frequency size for eFAST).

stimes

Numeric vector. Sampling time points; a component of GSI. Default is NULL.

output

A character vector of outputs to keep. Passed to sg_sim().

stat_comp

A character vector of summary statistics to compute. Supported internally: "mean","median","min","max","sd","cmax","SS".

et

Data.frame. Event table; a component of GSI.

theta

Named vector or data frame. Population or baseline parameter values; a component of GSI. For sensitivity analysis, parameters listed in params are replaced by sampled values. Default is NULL.

cov

Covariates passed to sg_sim(). Default is NULL.

Value

List with:

result

Tibble containing sensitivity analysis results. For PRCC method columns include: PAR, VAR, STAT, estimate, p.value. For eFAST method columns include: PAR, VAR, STAT, TYPE, VALUE, METHOD.

summary

Tibble of scalar summaries used for sensitivity computation: sim.id, VAR, STAT, value.

design

Data.frame of sampled parameter values (real scale) with sim.id. For PRCC this corresponds to LHS samples. For eFAST this corresponds to the FAST design matrix.

bounds

Parameter bounds used in the analysis.

Examples

# \donttest{
# Example model
library(rxode2)
library(tibble)
source(system.file("extdata", "RxODE_model", "example_rxode_model.R", package = "SimuRg")) # mod_ex
#>  
#>  


# Set up event table
et_base <- tribble(
  ~id, ~time, ~evid, ~cmt, ~amt, ~addl, ~ii, ~IGFR, ~POPN,
  1,   0,     1,     1,    10,   2,     24,  112,   1
)

# Define parameter bounds
inits <- rxInits(mod_ex)
par_bounds <- tibble::tibble(
  PAR = c("POPCL", "POPVC"),
  LB  = inits[c("POPCL", "POPVC")] * (1 - 0.9),
  UB  = inits[c("POPCL", "POPVC")] * (1 + 0.9)
)

# Run eFAST sensitivity analysis
res_efast <- sg_globalsens_sim(
  method = c("eFAST"),
  model = mod_ex,
  params = c("POPCL"),
  par_bounds = par_bounds,
  n_sim = 100,
  stimes = seq(0, 168, 10),
  output = "Cc",
  cov = c("IGFR", "POPN"),
  et = et_base,
  stat_comp = c("mean")
)

# Run PRCC sensitivity analysis
res_prcc <- sg_globalsens_sim(
  method = c("PRCC"),
  model = mod_ex,
  params = c("POPCL", "POPVC"),
  par_bounds = par_bounds,
  n_sim = 100,
  stimes = seq(0, 168, 10),
  output = "Cc",
  cov = c("IGFR", "POPN"),
  et = et_base,
  stat_comp = c("mean")
)
# }