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

Hypothesis testing for proportions

With hypothesis testing, we attempt to decide between two competing hypotheses that are statements about the value of the population proportion. These hypotheses are referred to as the null or alternative hypotheses; this idea is better illustrated in the following diagram:

If the sample is unlikely to be seen at the null hypothesis for true, then we reject the null hypothesis and assume that the alternative hypothesis must be true. We measure how unlikely a sample is by computing a p value, using a test statistic. p values represent the probability of observing a test statistic that is, at least, as contradictory to the null hypothesis as the one computed. Small p values indicate stronger evidence against the null hypothesis. Statisticians often introduce a cutoff and say that if the p value is less than, say, 0.05, then we should reject the null hypothesis in favor of the alternative. We can choose any cutoff we want, depending on how strong we want the evidence against the null hypothesis to be before rejecting it. I don't recommend making your cutoff greater than 0.05. So, let's examine this in action.

Let's say that the website's administrator claims that 30% of visitors to the website clicked on the advertisement—is this true? Well, the sample proportion will never exactly match this number, but we can still decide whether the sample proportion is evidence against this number. So, we're going to test the null hypothesis that p = 0.3, which is what the website administrator claims, against the alternative hypothesis that p ≠ 0.3So, now let's go ahead and compute the p value.

First, we're going to import the proportions_ztest() function. We give it how many successes there were in the data, the total number of observations, the value of p under the null hypothesis, and, additionally, we tell it what type of alternative hypothesis we're using:

We can see the result here; the first value is the test statistic and the second one is the p value. In this case, the value is 0.0636, which is greater than 0.05. Since this is greater than our cutoff, we conclude that there is not enough statistical evidence to disagree with the website administrator.

主站蜘蛛池模板: 资溪县| 大厂| 株洲市| 阿巴嘎旗| 阳高县| 徐水县| 林西县| 外汇| 浦县| 河西区| 罗江县| 永城市| 乡宁县| 堆龙德庆县| 隆子县| 灌云县| 八宿县| 新巴尔虎右旗| 彰化市| 嘉善县| 和平县| 昌平区| 丹东市| 布拖县| 西宁市| 秀山| 阳泉市| 桐庐县| 大冶市| 南江县| 吴川市| 奉化市| 德清县| 万全县| 宁海县| 靖州| 乡宁县| 灵台县| 南宫市| 运城市| 西宁市|