[text] tet

Viewer

  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. from scipy.stats import norm
  4.  
  5. # Values for z-distribution
  6. z_values = np.linspace(-5, 5, 100)
  7. y_values = norm.pdf(z_values)
  8.  
  9. # Plotting the standard normal distribution
  10. plt.figure(figsize=(10, 5))
  11. plt.plot(z_values, y_values, label='Standard Normal Distribution')
  12.  
  13. # Highlight critical regions for two-tailed test
  14. plt.fill_between(z_values, 0, y_values, where=z_values <= -2.576, color='red', alpha=0.5, label='Critical Region (left tail)')
  15. plt.fill_between(z_values, 0, y_values, where=z_values >= 2.576, color='red', alpha=0.5, label='Critical Region (right tail)')
  16.  
  17. # Marking the test statistic
  18. plt.axvline(-4.048, color='k', linestyle='dashed', label='Test Statistic z=-4.048')
  19.  
  20. plt.title('Z-Distribution with Critical Regions and Test Statistic')
  21. plt.xlabel('Z-Value')
  22. plt.ylabel('Probability Density')
  23. plt.legend()
  24. plt.show()
  25.  

Editor

You can edit this paste and save as new:


File Description
  • tet
  • Paste Code
  • 02 May-2024
  • 906 Bytes
You can Share it: