Beginner's question on pymc example code

39 views
Skip to first unread message

Robert Willy

unread,
Dec 14, 2015, 8:46:12 PM12/14/15
to PyMC
Hi,

I have probability and stochastic process knowledge, but new to the advanced
MCMC etc. When I learn pymc, I have problems on one of its example code:

import pymc
import numpy as np

n = 5*np.ones(4,dtype=int)
x = np.array([-.86,-.3,-.05,.73])

alpha = pymc.Normal('alpha',mu=0,tau=.01)
beta = pymc.Normal('beta',mu=0,tau=.01)

@pymc.deterministic
def theta(a=alpha, b=beta):
"""theta = logit^{-1}(a+b)"""
return pymc.invlogit(a+b*x)

d = pymc.Binomial('d', n=n, p=theta, value=np.array([0.,1.,3.,5.]),\
observed=True)
/////////

I don't understand why the last line of function theta is:
return pymc.invlogit(a+b*x)
while the above comment line said: logit^{-1}(a+b)

That is, why there is extra 'x' in the return line.

Thanks,

Reply all
Reply to author
Forward
0 new messages