Created
March 18, 2018 13:34
-
-
Save psinger/f20945db6eaea674e87380adfda78c87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymc as mc | |
from scipy.special import zeta | |
def _model(data, discrete=True, xmin=1.): | |
alpha = mc.Exponential('alpha', 1. / 1.5) | |
@mc.stochastic(observed=True) | |
def custom_stochastic(value=data, alpha=alpha, xmin=xmin, discrete=discrete): | |
value = value[value >= xmin] | |
if discrete == True: | |
return np.sum(np.log(value**-alpha / zeta(alpha,xmin))) | |
else: | |
return np.sum(np.log((alpha-1) * xmin**(alpha-1) * value**-alpha)) | |
return locals() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment