Practical - 2 Test for difference between proportions using Python 1. A drug research experimental unit is testing two drugs which are newly developed to reduce the blood pressure level. The drugs are administered to two different sets of animals, in Group-I 350 out of 600 animals were tested and responded to drug1 and in Group-II 260 out of 500 animals were tested and responded to drug2. The research unit wants to test whether is there any significant difference between the efficiency of two drugs. Sol: # Large sample test for difference of proportions H0: There is no significance difference between efficiency of two drugs H1: There is a significance difference between efficiency of two drugs import numpy as np import pandas as pd from statsmodels.stats.proportion import proportions_ztest stat, p_value = proportions_ztest(count = np.array([350, 260]), nobs = np.array([600, 500]), alternative = 'two-sided') stat, p_value if p_value > 0.01: print("Accept H0") else: print("Reject H0")
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter