Skip to content

Commit

Permalink
mvn
Browse files Browse the repository at this point in the history
  • Loading branch information
horta committed Apr 17, 2019
1 parent 404c5aa commit 500295f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions limix/vardec/_vardec.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class VarDec(object):
.. doctest::
>>> from limix.vardec import VarDec
>>> from limix.stats import multivariate_normal as mvn
>>> from numpy import ones, eye, concatenate, zeros, exp
>>> from numpy.random import RandomState
>>>
Expand All @@ -34,8 +35,8 @@ class VarDec(object):
>>> K1 /= K1.diagonal().mean()
>>> K1 += eye(nsamples) * 1e-4
>>>
>>> mvn = random.multivariate_normal
>>> y = M @ random.randn(3) + mvn(zeros(nsamples), K0) + mvn(zeros(nsamples), K1)
>>> y = M @ random.randn(3) + mvn(random, zeros(nsamples), K0)
>>> y += mvn(random, zeros(nsamples), K1)
>>>
>>> vardec = VarDec(y, "normal", M)
>>> vardec.append(K0)
Expand All @@ -47,7 +48,7 @@ class VarDec(object):
Variance decomposition
======================
<BLANKLINE>
𝐲 ~ 𝓝(π™ΌπœΆ, 0.425⋅𝙺 + 1.776⋅𝙺 + 0.000⋅𝙸)
𝐲 ~ 𝓝(π™ΌπœΆ, 0.385⋅𝙺 + 1.184⋅𝙺 + 0.000⋅𝙸)
>>> y = exp((y - y.mean()) / y.std())
>>> vardec = VarDec(y, "poisson", M)
>>> vardec.append(K0)
Expand All @@ -59,7 +60,7 @@ class VarDec(object):
Variance decomposition
======================
<BLANKLINE>
𝐳 ~ 𝓝(π™ΌπœΆ, 0.000⋅𝙺 + 0.397⋅𝙺 + 0.000⋅𝙸) for yα΅’ ~ Poisson(Ξ»α΅’=g(zα΅’)) and g(x)=eΛ£
𝐳 ~ 𝓝(π™ΌπœΆ, 0.000⋅𝙺 + 0.350⋅𝙺 + 0.000⋅𝙸) for yα΅’ ~ Poisson(Ξ»α΅’=g(zα΅’)) and g(x)=eΛ£
"""

def __init__(self, y, lik="normal", M=None):
Expand Down

0 comments on commit 500295f

Please sign in to comment.