python - logp in stochastic variables of pymc -


i have intrinsic confusion regarding logp. explain through anexample on na webpage don't fall short of explaining well.

i wrote disaster_model.py illlustrated in tutorial: http://pymc-devs.github.io/pymc/tutorial.html

i launched python shell , after importing required modules, did following

in [2]: import disaster_model out[2]: -2.9780301980174  in [3]: disaster_model.switchpoint.logp out[3]: -4.709530201312334  in [4]: disaster_model.late_mean.logp out[4]: -2.407183392124894  in [5]: disaster_model.early_mean.logp out[5]: -2.9780301980174  m = mcmc(disaster_model) m.sample(iter = 10000, burn = 1000, thin = 10)  in [11]: m.switchpoint.logp out[11]: -4.709530201312334  in [12]: m.early_mean.logp out[12]: -3.2263189370368117  in [13]: m.late_mean.logp out[13]: -0.9012784557735074  in [14]: m.disasters.logp out[14]: -164.37141285002255 

i reemphasize line (written in disaster_model.py)

disasters = poisson('disasters', mu=rate, value=disasters_array, observed=true

hence value of disasters never going change.

now question

1) why did log probabilities change of every variable except switchpoint?

(kindly explain why log probabilties should change, , if should, why swithpoint's didn't)

2) what old , new log probabilities represent ?

(it ipython shell , not python, hardly matters)

rather late reply, anyway. questions.

1) why did log probabilities change of every variable except switchpoint?

the logp property gives log-probability of variable, given parents. prior distribution of switchpoint discrete uniform distribution 0 110 years, , parents lower , upper bounds of uniform distribution. no matter value of switchpoint considered, probability mass 1/111, prior log-probability ln(1/111) = -4.70953, , never change.

the log-probabilities change other variables (early_mean , late_mean) mcmc algorithm hops through space of stochastic variables because prior distributions defined exponential, not uniform.

2) old , new log probabilities represent ?

in question, log-probabilities represent log-prior probability of stochastic variables early_mean, late_mean , switchpoint, "current" values. can verify early_mean evaluating np.log(scipy.stats.expon.pdf(m.early_mean.value, scale=1)) , comparing m.early_mean.logp. note scale parameter in exponential distribution reflects scale parameter defined in disaster_model.py.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -