| Title: | Quantum Toxic Burden Index |
|---|---|
| Description: | Compute the Quantum Toxic Burden Index from multi-exposure panels using a fixed quantum-inspired entanglement encoder; method reference (2026) <doi:10.5281/zenodo.20476574>. Provides percentile encoding, optional potency-weighted readout, and synergy diagnostics for environmental mixture burden scores. |
| Authors: | January G. Msemakweli [aut, cre] |
| Maintainer: | January G. Msemakweli <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.2 |
| Built: | 2026-06-10 08:17:53 UTC |
| Source: | https://github.com/january-msemakweli/qtbi |
Build the n-qubit entanglement statevector for one subject
build_statevector(percentiles, synergy = 0.6)build_statevector(percentiles, synergy = 0.6)
percentiles |
Numeric vector of exposure percentiles in |
synergy |
Synergy strength in |
Complex statevector of length 2^n.
Gate schedule for circuit diagrams
circuit_gate_schedule(n_exposures = 4L, n_metals = NULL)circuit_gate_schedule(n_exposures = 4L, n_metals = NULL)
n_exposures |
Number of exposures (qubits). |
n_metals |
Deprecated alias for |
List with gate schedule metadata.
Diagnose QTBI encoder behavior on processed data
diagnose_qtbi( data, synergy_grid = seq(0, 1, by = 0.05), synergy_ref = NULL, verbose = TRUE )diagnose_qtbi( data, synergy_grid = seq(0, 1, by = 0.05), synergy_ref = NULL, verbose = TRUE )
data |
A |
synergy_grid |
Grid of synergy values for sensitivity curves. |
synergy_ref |
Reference synergy for summary statistics (defaults to
the value used in |
verbose |
If |
A qtbi_diagnosis object (also printed when verbose = TRUE).
Computes within-cohort exposure percentiles, runs the fixed entanglement encoder, and returns the input data with percentile and QTBI columns added.
estimate_qtbi( data, chemicals, synergy_strength = 0.6, qtbi_col = "qtbi", percentile_prefix = "pct_", exposure_names = NULL, pct_cols = NULL, reference_doses = NULL, reference_index = NULL )estimate_qtbi( data, chemicals, synergy_strength = 0.6, qtbi_col = "qtbi", percentile_prefix = "pct_", exposure_names = NULL, pct_cols = NULL, reference_doses = NULL, reference_index = NULL )
data |
A data frame containing exposure columns. |
chemicals |
Character vector of exposure column names. |
synergy_strength |
Synergy strength in |
qtbi_col |
Name for the QTBI score column (default |
percentile_prefix |
Prefix for percentile columns (default |
exposure_names |
Optional display names for plots (defaults to |
pct_cols |
Optional percentile column names (same length as |
reference_doses |
Optional named numeric vector of oral reference doses
in mg/kg/day, with names matching |
reference_index |
Name of the index chemical for potency ratios. Defaults
to the first |
A qtbi_data object (data frame) with QTBI and percentile columns.
df <- data.frame( Pb = c(1, 2, 3, 4), As = c(4, 3, 2, 1), Cd = c(2, 2, 3, 3), Hg = c(1, 3, 2, 4) ) out <- estimate_qtbi( df, chemicals = c("Pb", "As", "Cd", "Hg"), synergy_strength = 0.6, reference_doses = c(Pb = 6.3e-4, As = 6.0e-5, Cd = 5.0e-4, Hg = 1.0e-4), reference_index = "Pb" ) out$qtbidf <- data.frame( Pb = c(1, 2, 3, 4), As = c(4, 3, 2, 1), Cd = c(2, 2, 3, 3), Hg = c(1, 3, 2, 4) ) out <- estimate_qtbi( df, chemicals = c("Pb", "As", "Cd", "Hg"), synergy_strength = 0.6, reference_doses = c(Pb = 6.3e-4, As = 6.0e-5, Cd = 5.0e-4, Hg = 1.0e-4), reference_index = "Pb" ) out$qtbi
Convert exposures to within-cohort percentiles
exposure_percentile(x)exposure_percentile(x)
x |
Numeric exposure vector. |
Numeric percentiles in (0, 1].
Test for a qtbi_data object
is_qtbi_data(x)is_qtbi_data(x)
x |
Object to test. |
TRUE if x inherits from "qtbi_data".
Marginal toxic probabilities from a QTBI statevector
marginal_toxic_probs(state)marginal_toxic_probs(state)
state |
Complex statevector from |
Numeric vector of marginal toxic probabilities.
When potency weights are applied at readout, rescale them so their sum equals
the number of exposures in the panel. This keeps weighted QTBI on the same
scale as the unweighted sum of marginals, which aids comparison
between weighted and unweighted analyses.
normalize_potency_weights(weights, target_sum = NULL)normalize_potency_weights(weights, target_sum = NULL)
weights |
Named numeric vector of raw potency ratios from
|
target_sum |
Target sum for the rescaled weights. Defaults to the
number of exposures ( |
Named numeric vector of rescaled weights aligned with weights.
Build percentile matrix from a data frame
percentile_matrix(data, chemicals)percentile_matrix(data, chemicals)
data |
Data frame containing exposure columns. |
chemicals |
Character vector of column names. |
Numeric matrix with one percentile column per chemical.
Computes outcome-independent weights as the ratio of the index chemical reference dose to each component reference dose:
potency_weights_from_reference_doses( reference_doses, chemicals, reference_index = NULL )potency_weights_from_reference_doses( reference_doses, chemicals, reference_index = NULL )
reference_doses |
Named numeric vector of oral reference doses in
mg/kg/day, with one value per exposure in |
chemicals |
Character vector of exposure identifiers in panel order.
Names must match |
reference_index |
Name of the index chemical. Defaults to the first
entry in |
Lower reference doses (more potent toxicants) receive larger weights.
Named numeric vector of potency weights aligned with chemicals.
Compute QTBI from percentile matrix
qtbi_from_pcts(pct_mat, synergy = 0.6, weights = NULL)qtbi_from_pcts(pct_mat, synergy = 0.6, weights = NULL)
pct_mat |
Numeric matrix of within-cohort percentiles (rows = subjects). |
synergy |
Synergy strength in |
weights |
Optional named numeric potency weights aligned with columns. |
Numeric vector of QTBI scores.
Compute QTBI from a statevector
qtbi_from_state(state, weights = NULL)qtbi_from_state(state, weights = NULL)
state |
Complex statevector from |
weights |
Optional named numeric potency weights aligned with qubits.
When |
Scalar QTBI score (sum of marginal toxic probabilities).
Compute QTBI from one percentile vector
qtbi_from_vector(pct_vec, synergy = 0.6, weights = NULL)qtbi_from_vector(pct_vec, synergy = 0.6, weights = NULL)
pct_vec |
Numeric vector of within-cohort percentiles. |
synergy |
Synergy strength in |
weights |
Optional named numeric potency weights aligned with |
Scalar QTBI score.
Prints a topic index for the main qtbi functions and optionally opens
documentation for a specific topic. Use this when you want a guided entry
point to the package; standard R help remains available via ?function_name
and help(package = "qtbi").
qtbi_help(topic = NULL)qtbi_help(topic = NULL)
topic |
Optional character string naming a function or topic to open. If omitted, a summary index is printed. |
Invisibly returns NULL. When topic is supplied, the corresponding
help page is opened as a side effect.
qtbi_help() qtbi_help("estimate_qtbi")qtbi_help() qtbi_help("estimate_qtbi")
Retrieve QTBI metadata stored on a processed data frame
qtbi_meta(data)qtbi_meta(data)
data |
A |
List with chemicals, synergy strength, and percentile column names.
Full circuit diagnostics for a cohort percentile matrix
synergy_diagnostics( pct_mat, synergy_grid = seq(0, 1, by = 0.05), synergy_ref = 0.6, exposure_names = NULL, metal_names = NULL, weights = NULL )synergy_diagnostics( pct_mat, synergy_grid = seq(0, 1, by = 0.05), synergy_ref = 0.6, exposure_names = NULL, metal_names = NULL, weights = NULL )
pct_mat |
Numeric matrix of within-cohort percentiles (rows = subjects). |
synergy_grid |
Grid of synergy values in |
synergy_ref |
Reference synergy for summary statistics. |
exposure_names |
Labels for exposures (columns of |
metal_names |
Deprecated alias for |
weights |
Optional potency weights aligned with columns of |
List with cohort_band, marginals, monotonicity, synergy_ref, sens_ref.
Synergy sensitivity on cohort median percentiles
synergy_sensitivity( pct_mat, synergy_grid = seq(0, 1, by = 0.05), weights = NULL )synergy_sensitivity( pct_mat, synergy_grid = seq(0, 1, by = 0.05), weights = NULL )
pct_mat |
Numeric matrix of within-cohort percentiles. |
synergy_grid |
Grid of synergy values in |
weights |
Optional potency weights aligned with columns of |
Data frame with synergy, qtbi, and additive_baseline columns.