Stochastic genotype data is stored after min-max scaling: U_scaled = 2 * (U -
u_min) / (u_max - u_min). This function exactly inverts that transform using
the stored per-variant u_min and u_max values from a companion sidecar file
(.afreq or .stochastic_meta.tsv).
Usage
invertMinmaxScaling(X, uMin, uMax)
Arguments
- X
Numeric matrix (B x p) of min-max scaled values in [0, 2].
- uMin
Numeric vector of per-variant minimum values before scaling.
- uMax
Numeric vector of per-variant maximum values before scaling.
Value
Matrix of original U values with same dimensions.
Details
The recovered U satisfies U'U/B ~ Wishart(B, R)/B, the correct distributional
property for LD-based fine-mapping with dynamic variance tracking.
Examples
X <- matrix(runif(12), 4, 3)
invertMinmaxScaling(X, uMin = rep(0, 3), uMax = rep(1, 3))
#> [,1] [,2] [,3]
#> [1,] 0.3442688 0.127168212 0.3537884
#> [2,] 0.2755465 0.095204775 0.1993855
#> [3,] 0.3840791 0.278071481 0.3635688
#> [4,] 0.1722396 0.006668939 0.1200114