Skip to contents

Stochastic genotype data (from rss_ld_sketch) is stored in PLINK2 pgen format 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 the companion .afreq file.

Usage

invert_minmax_scaling(X, u_min, u_max)

Arguments

X

Numeric matrix (B x p) of min-max scaled values in [0, 2].

u_min

Numeric vector of per-variant minimum values before scaling.

u_max

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.