Given a response vector (or statistics from this vector), calculate a PIP threshold that should preserve close to a nominal 5% test size for Bayesian Kernel Machine Regression (BKMR) feature selection.
calculate_pip_threshold(
y,
absCV,
sampSize,
coeffs_ls = list(A = 0, K = 1.43462, C = 1.59948, betaAbsCV = 0.56615, betaSampSize =
0.51345),
na.rm = TRUE
)A single numeric value; the output of the Richard's Four-Parameter
Logistic Regression curve with the coefficient values supplied in
coeffs_ls.
a response vector for BKMR
If y is not supplied, the absolute value of the coefficient
of variation of the response
If y is not supplied, the number of observations included
in the response
A list of Richard's Curve parameters. See Details.
Remove missing values from y? Defaults to TRUE
CalculatePipThreshold function is designed to model the relationship between PIP(q95),
coefficient of variation (CV), and sample size using a form of four-parameter
logistic regression (Richard Curve). This function employs the nls function
from the R stats package, utilizing the Levenberg-Marquardt algorithm for
optimization to ensure robust parameter estimation.
$$
PIP(q_{95}) = A + \frac{K-A}{ (C + \exp(-\beta_1x_1) )^{\beta_2x_2} }
$$
Where-
A: Fixed left asymptote (0);
K: Right asymptote;
C: Constant;
\(\beta_1, \beta_2\): Midpoint shift parameters for CV and sample size;
x1: Log2-transformed |CV| (log2(|CV|));
x2: Log-transformed sample size (log10(Sample Size)).
The detailed explanation of how we calculated the values in coeffs_ls can
be found in <......>.
For more information on Richard's curve, see https://en.wikipedia.org/wiki/Generalised_logistic_function
calculate_pip_threshold(absCV = 7.5, sampSize = 300)
# should equal 0.6829892
Run the code above in your browser using DataLab