Heritability estimation¶
Heritability¶
-
limix.her.
estimate
(y, lik, K, M=None, verbose=True)[source] Estimate the so-called narrow-sense heritability.
It supports Normal, Bernoulli, Probit, Binomial, and Poisson phenotypes. Let \(N\) be the sample size and \(S\) the number of covariates.
Parameters: - y (array_like) – Either a tuple of two arrays of N individuals each (Binomial
phenotypes) or an array of N individuals (Normal, Poisson, or
Bernoulli phenotypes). If a continuous phenotype is provided (i.e., a Normal
one), make sure they have been normalised in such a way that its values are
not extremely large; it might cause numerical errors otherwise. For example,
by using
limix.qc.mean_standardize()
orlimix.qc.quantile_gaussianize()
. - lik ("normal", "bernoulli", "probit", binomial", "poisson") – Sample likelihood describing the residual distribution.
- K (array_like) – \(N\)-by-\(N\) covariance matrix. It might be, for example, the
estimated kinship relationship between the individuals. The provided matrix will
be normalised via the function
limix.qc.normalise_covariance()
. - M (array_like, optional) – \(N\) individuals by \(S\) covariates.
It will create a \(N\)-by-\(1\) matrix
M
of ones representing the offset covariate ifNone
is passed. If an array is passed, it will used as is. Defaults toNone
. - verbose (bool, optional) –
True
to display progress and summary;False
otherwise.
Returns: Estimated heritability.
Return type: Examples
>>> from numpy import dot, exp, sqrt >>> from numpy.random import RandomState >>> from limix.her import estimate >>> >>> random = RandomState(0) >>> >>> G = random.randn(150, 200) / sqrt(200) >>> K = dot(G, G.T) >>> z = dot(G, random.randn(200)) + random.randn(150) >>> y = random.poisson(exp(z)) >>> >>> print('%.3f' % estimate(y, 'poisson', K, verbose=False)) 0.183
Notes
It will raise a
ValueError
exception if non-finite values are passed. Please, refer to thelimix.qc.mean_impute()
function for missing value imputation.- y (array_like) – Either a tuple of two arrays of N individuals each (Binomial
phenotypes) or an array of N individuals (Normal, Poisson, or
Bernoulli phenotypes). If a continuous phenotype is provided (i.e., a Normal
one), make sure they have been normalised in such a way that its values are
not extremely large; it might cause numerical errors otherwise. For example,
by using