官术网_书友最值得收藏!

Testing for common proportions

Now, let's move on to comparing the proportions between two samples. We want to know whether the samples were drawn from populations with the same proportion or not. This could show up in the context, such as A/B testing, where a website wants to determine which of two types of ads generates more clicks.

We can still use the statsmodels function, proportions_ztest(), but we now pass NumPy arrays to the count and nobs arguments, which contain the relevant data for the two samples.

So, our website wants to conduct an experiment. The website will show some of its visitors different versions of an advertisement created by a sponsor. Users are randomly assigned by the server to either Version A or Version B. The website will track how often Version A was clicked on and how often Version B was clicked on by its users. On a particular day, 516 visitors saw Version A and 510 saw Version B. 108 of those who saw Version A clicked on it, and 144 who saw Version B clicked on it. So, we want to know which ad generated more clicks.

We're going to be testing the following hypotheses:

Let's go ahead and import the numpy library. When we import NumPy, we're going to use NumPy arrays to contain our data, as follows:

We will then assign the arrays and define the alternative as two-sided, as follows:

We end up with a p value of around 0.0066, which is small in our case, so we reject the null hypothesis. It appears that the two ads do not have the same proportion of clicks. We have looked at hypothesis testing for proportions. We will now look at applying everything that we have learned to mean values.

主站蜘蛛池模板: 翁源县| 米脂县| 太保市| 怀仁县| 女性| 精河县| 华安县| 漠河县| 晋宁县| 衢州市| 海南省| 黔西| 平阳县| 犍为县| 遵化市| 广德县| 宣武区| 邹平县| 三明市| 将乐县| 舒兰市| 右玉县| 墨脱县| 泽库县| 奇台县| 上饶县| 怀宁县| 邵阳市| 扶绥县| 新宁县| 木兰县| 婺源县| 偏关县| 称多县| 吐鲁番市| 香港 | 洮南市| 金秀| 龙海市| 尚志市| 杭锦后旗|