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.4194463 0.3707938 0.4932903
#> [2,] 0.4450334 0.2132463 0.4459137
#> [3,] 0.4747233 0.1099931 0.4205331
#> [4,] 0.2857899 0.4557114 0.2082503