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

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.

主站蜘蛛池模板: 冕宁县| 泗阳县| 会昌县| 白河县| 鄂尔多斯市| 白水县| 志丹县| 扶绥县| 利辛县| 金塔县| 双江| 如皋市| 湖北省| 伊金霍洛旗| 双桥区| 枣强县| 布拖县| 民和| 奉化市| 永嘉县| 修水县| 天津市| 长顺县| 铜陵市| 曲阜市| 马关县| 亚东县| 新巴尔虎右旗| 沂水县| 万盛区| 德州市| 乌恰县| 四平市| 凯里市| 石家庄市| 衡阳县| 黑龙江省| 丰台区| 南木林县| 原阳县| 田阳县|