Commit 7b5d6a49 authored by Hanna  JULIENNE's avatar Hanna JULIENNE
Browse files

Impg model function

parent fa8b3139
"""
function for SNP imputation
"""
import numpy
def ImpG_model(Zt, Sig_t, Sig_i_t):
"""
Argument:
Zt : (vector) the vector of known Z scores
"""
np.fill_diagonal(Sig_t.values, 1.01)
Sig_t.fillna(0, inplace=True)
Sig_t_inv =np.linalg.inv(Sig_t)
Var = np.diag(Sig_t)[0] - np.einsum('ij,jk,ki->i', Sig_i_t, Sig_t_inv ,Sig_i_t.transpose())
mu = np.dot(Sig_i_t, np.dot(Sig_t_inv, Zfile.loc[index_known, 'Z']))
return((Var, mu))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment