Advertisement
Guest User

Untitled

a guest
Aug 13th, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. #!/usr/bin/env python
  2. """
  3. A contrived toy model to see if I can get this thing to work
  4.  
  5. """
  6. import pylab
  7. import numpy as np
  8. import pymc
  9. from pymc.Matplot import plot as mcplot
  10.  
  11. N = 1000
  12. true_alpha = 2
  13. noise = 0.001
  14. # Simulated flux densities
  15. s_arr = pymc.rpareto(true_alpha, 1, size=N)
  16.  
  17. alpha = pymc.Uniform('alpha', 1, 3)
  18. flux = pymc.Pareto('flux', alpha=alpha, m=1, size=N)
  19. flux_meas = pymc.Normal('flux_meas', mu=flux, tau=noise**-2, observed=True,
  20.                              value=pymc.rnormal(s_arr, tau=noise**-2, size=N))
  21.  
  22.    
  23.  
  24. M = pymc.MCMC([alpha, flux, flux_meas])
  25. M.sample(5000, 1000, 10)
  26. mcplot(M)
  27. pylab.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement