-
sushie.utils.estimate_her(X: Array | ndarray | bool_ | number | bool | int | float | complex, y: Array | ndarray | bool_ | number | bool | int | float | complex, covar: Array | ndarray | bool_ | number | bool | int | float | complex | None =
None, normalize: bool =True) Tuple[float, Array, float, float][source] Calculate proportion of expression variation explained by genotypes (cis-heritability; \(h_g^2\)).
- Parameters:
- X: Array | ndarray | bool_ | number | bool | int | float | complex¶
\(n \times p\) matrix for independent variables with no intercept vector.
- y: Array | ndarray | bool_ | number | bool | int | float | complex¶
\(n \times 1\) vector for gene expression.
- covar: Array | ndarray | bool_ | number | bool | int | float | complex | None =
None¶ \(n \times m\) matrix for covariates.
- normalize: bool =
True¶ Boolean value to indicate whether normalize X and y
- Returns:
- Return type:
Tuple[float, Array, float, float]
Example
Estimate cis-heritability for a gene:
import numpy as np from sushie.utils import estimate_her # Genotype matrix (100 samples, 500 SNPs) X = np.random.randn(100, 500) # Gene expression y = np.random.randn(100) # Estimate heritability g, h2g, lrt_stat, p_value = estimate_her(X, y) print(f"Heritability: {h2g:.3f}, p-value: {p_value:.4f}")