SHARE
TWEET

Untitled

a guest Jul 17th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Specify the grid on X,Z parameter space.
  2. n_int = 5  # choose number of intervals for grid on theta.
  3. X = np.linspace(-80, 100, n_int)
  4. Z = X
  5. X_grid, Z_grid = np.meshgrid(X, Z)
  6.  
  7. # prior probabilities on the X and Z values.
  8. muX = 10
  9. sigmaX = 20
  10. muZ = 10
  11. sigmaZ = 20
  12.  
  13. # Correlation between X and Z
  14. rho = 0.6
  15.  
  16. # compute vector of means for likelihood
  17. meanZgivenX = muZ + rho * sigmaZ*(X_grid - muX)/sigmaX
  18. varZgivenX = (1 - rho**2) * sigmaZ**2
  19. sigmaZgivenX = np.sqrt(varZgivenX)
  20.  
  21. # compute likelihood
  22. pZgivenX = norm.pdf(X_grid, meanZgivenX, sigmaZgivenX)
  23.      
  24. 0.0020  0.0000  0.0000  0.0000  0.0000
  25. 0.0213  0.0132  0.0005  0.0000  0.0000
  26. 0.0001  0.0060  0.0249  0.0060  0.0001
  27. 0.0000  0.0000  0.0005  0.0132  0.0213
  28. 0.0000  0.0000  0.0000  0.0000  0.0020
  29.      
  30. [[0.00716329 0.04781825 0.09003692 0.04781825 0.00716329]
  31.  [0.00716329 0.04781825 0.09003692 0.04781825 0.00716329]
  32.  [0.00716329 0.04781825 0.09003692 0.04781825 0.00716329]
  33.  [0.00716329 0.04781825 0.09003692 0.04781825 0.00716329]
  34.  [0.00716329 0.04781825 0.09003692 0.04781825 0.00716329]]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top