俺的学习笔记

Wednesday, November 21, 2018

Test of Proportion

Population Proportion

proportion就是比例的意思,这是population的一个参数。
What is the Population Proportion?
A population proportion is a fraction of the population that has a certain characteristic. For example, let’s say you had 1,000 people in the population and 237 of those people have blue eyes. The fraction of people who have blue eyes is 237 out of 1,000, or 237/1000. The letter p is used for the population proportion, so you would write this fact like this:
p = 237/1000.
You can also write 237/1000 as a decimal (by dividing 1000 by 237). If you did that, then p = 0.237.
それではProportion testというのは何ですか。
We'll start our exploration of hypothesis tests by focusing on population proportions. Specifically, we'll derive the methods used for testing (1) whether a single population proportion p equals a particular value, p0, say, and (2) whether the difference in two population proportions p1p2 equals a particular value p0, say, with the most common value being 0, and thereby allowing us to test whether two populations proportions are equal. Along the way, we'll learn two different approaches to hypothesis testing, one being the critical value approach and one being the P-value approach.
1.proportionであるpはP0に等しいかどうかの判断。
2.二つproportion p1とp2の差はp0に等しいかどうかの判断。特にp0=0の場合、p1とp2は等しいかの判断になる。
也就是说,proportion检验就是测量这样两件事:1,有一个proportion为p,测这个p是否等于某一特定的值p0?
2.如果有两个proportion,分别是p1和p2,测这两个proportion的差p1-p2是不是等于某一特定的值p0?特别是p0等于0的时候,就是测p1和p2是否相等。
具体的做法和例子在这里都有。
比如,在500个有肺癌的人里有480个抽烟,而500个健康的人里有400个抽烟。那么p1=480/500=0.96,p2=400/500=0.80。
现在我们要研究下面的事项:
1.肺癌群体和健康群体里面抽烟人的比例是相同的?
2.肺癌群体里抽烟的比例>健康人群?
3.肺癌群体里抽烟的比例<健康人群?
这就需要用到proportion test,用数学公式来说就是这样的
元假设(null hypothesis)
    H0:     pA=pB
    H0:     pA≤pB
    H0:     pA≥pB
代替假设(alternative hypothesis)
    Hα:     pA≠pB  (different)
    Hα:     pA>pB  (greater)
    Hα:     pA<pB  (less)
上面是“2 proportion test”,如果是“1 proportion test”,则是这样的:
比如我们用一组白鼠进行某种诱发癌症的试验,公母各半(p = 0.5)。我们从中抽出160只患癌症的老鼠,其中有95只公鼠,65只母鼠。那么我们想检验是不是公鼠更容易罹患癌症?
也就是我们期待的概率是0.5(不受性别影响),那么我们要研究如下事项:
1.公鼠患癌的比例(95/160)和期望值(0.5)相同吗?
2.公鼠患癌的比例>期望值(0.5)
3.公鼠患癌的比例<期望值(0.5)
假设我们观察到的比率(proportion)为p1,期望值为p0则用数学公式来说是这样的:
元假设(null hypothesis)
    H0:     p1=p0
    H0:     p1≤p0
    H0:     p1≥p0
代替假设(alternative hypothesis)
    Hα:     p1≠p0  (different)
    Hα:     p1>p0  (greater)
    Hα:     p1<p0  (less)

手动计算的方法,这里这里还有这里都讲的比较清楚。大意都是算出z值,然后从z值求出正态分布情况下的概率(就是p-value),然后做判断。如果不求甚解的话,直接用R来计算就省事多了。

Proportion Test in R

Test of Equal or Given Proportions

Description

prop.test can be used for testing the null that the proportions (probabilities of success) in several groups are the same, or that they equal certain given values.

Usage

prop.test(x, n, p = NULL,
          alternative = c("two.sided", "less", "greater"),
          conf.level = 0.95, correct = TRUE)

Arguments

xa vector of counts of successes, a one-dimensional table with two entries, or a two-dimensional table (or matrix) with 2 columns, giving the counts of successes and failures, respectively.
na vector of counts of trials; ignored if x is a matrix or a table.
pa vector of probabilities of success. The length of p must be the same as the number of groups specified by x, and its elements must be greater than 0 and less than 1.
alternativea character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter. Only used for testing the null that a single proportion equals a given value, or that two proportions are equal; ignored otherwise.
conf.levelconfidence level of the returned confidence interval. Must be a single number between 0 and 1. Only used when testing the null that a single proportion equals a given value, or that two proportions are equal; ignored otherwise.
correcta logical indicating whether Yates' continuity correction should be applied where possible.

https://onlinecourses.science.psu.edu/stat414/node/222/
https://newonlinecourses.science.psu.edu/statprogram/reviews/statistical-concepts/proportions

Labels: , ,

0 Comments:

Post a Comment

<< Home