预备知识:
一维实参数的假设有一下三种形式: (1) 单边检验Ⅰ:𝐻0:𝜃≤𝜃0,𝐻1:𝜃>𝜃0. (2) 单边检验Ⅱ:𝐻0:𝜃≥𝜃0,𝐻1:𝜃<𝜃0. (3) 双边检验:𝐻0:𝜃=𝜃0,𝐻1:𝜃≠𝜃0.
一、总体均值的假设检验
1. 单个总体的情况
基本假设:𝑋~𝑁(𝜇,𝜎2),𝑋1,𝑋2,⋯,𝑋𝑛是来自总体𝑋的样本,随机变量服从或近似正态分布,具有方差齐性。
(1) 方差𝜎2已知时,用统计量𝒁=
̅−𝝁𝟎𝑿𝝈/√𝒏
~𝑵(𝟎,𝟏),双边拒绝域|𝑍|≥𝑍𝛼⁄2,单边检验Ⅰ拒
绝域|𝑍|≥𝑍𝛼;单边检验Ⅱ拒绝域|𝑍|≤−𝑍𝛼。 (2) 方差𝜎2未知时,用统计量𝑻=
̅−𝝁𝟎𝑿
~𝒕(𝒏−𝑺⁄√𝒏
𝟏),双边拒绝域|𝑇|≥𝑡𝛼⁄2(𝑛−1),单边检验
Ⅰ拒绝域|𝑇|≥𝑡𝛼(𝑛−1);单边检验Ⅱ拒绝域|𝑇|≤−𝑡𝛼(𝑛−1)。一般情况下总体方差未知,故较多的时候使用此方法。
2.两个总体的情况
基本假设:𝑋~𝑁(𝜇1,𝜎12),𝑋1,𝑋2,⋯,𝑋𝑛1是来自总体𝑋的样本,𝑌~𝑁(𝜇2,𝜎22),𝑌1,𝑌2,⋯,𝑌𝑛2是来自总体𝑌的样本,两样本独立。
(1) 方差𝜎12和𝜎22已知时,用统计量𝒁=
̅−𝒀̅𝑿𝝈𝟐𝝈𝟐
√𝟏+𝟐𝒏𝟏𝒏𝟐
~𝑵(𝟎,𝟏),双边拒绝域|𝑍|≥𝑍𝛼⁄2,单边
检验Ⅰ拒绝域|𝑍|≥𝑍𝛼;单边检验Ⅱ拒绝域|𝑍|≤−𝑍𝛼。
(2) 方差𝜎12=𝜎22=𝜎2未知时,用样本方差替代总体方差,统计量𝑻=
𝒏𝟐−𝟐),其中𝑆𝑤=√
(𝑛1−1)𝑆12)+(𝑛2−1)𝑆22𝑛1+𝑛2−2
̅−𝒀̅𝑿𝑺𝒘√
𝟏𝟏+𝒏𝟏𝒏𝟐
~𝒕(𝒏𝟏+
,双边拒绝域|𝑇|≥𝑡𝛼⁄2(𝑛1+𝑛2−2),单边
̅−𝒀̅𝑿𝑺𝟐𝑺𝟐√𝟏+𝟐𝒏𝟏𝒏𝟐
检验Ⅰ拒绝域|𝑇|≥𝑡𝛼(𝑛1+𝑛2−2);单边检验Ⅱ拒绝域|𝑇|≤−𝑡𝛼(𝑛1+𝑛2−2)。 (3) 方差𝜎12≠𝜎22且未知时,用Welch法近似t检验,用统计量𝑻=
̂)近似~𝒕(𝝊成立,其中𝜐̂=(𝑛+
1
𝑆12𝑆22𝑛2
)/(𝑛
2
(𝑆12)2
2(𝑛
1−1)
1
+𝑛
(𝑆22)2
22(𝑛
2−1)
),双边拒绝域|𝑇|≥𝑡𝛼⁄2(𝜐̂),单边
检验Ⅰ拒绝域|𝑇|≥𝑡𝛼(𝜐̂);单边检验Ⅱ拒绝域|𝑇|≤−𝑡𝛼(𝜐̂)。
3. 成对数据的t检验(paired/matched t-test)
数据是成对出现的,即(𝑋𝑖,𝑌𝑖)(𝑖=1,2,⋯,𝑛),则认为用成对t检验要优于两总体均值检验。所谓成对t检验就是令𝑍𝑖=𝑋𝑖−𝑌𝑖(𝑖=1,2,⋯,𝑛),对𝑍作单个总体均值检验。
R语言命令:
t.test(x, y = NULL, alternative = c(\"two.sided", \"less", \"greater\"), mu=0, paired = FALSE, var.equal = FALSE, conf.level = 0.95, ...)
x -- a (non-empty) numeric vector of data values.
y -- an optional (non-empty) numeric vector of data values.
alternative -- a character string specifying the alternative hypothesis, must be one of \"two.sided\" (default), "greater\" or \"less". You can specify just the initial letter. mu -- a number indicating the true value of the mean (or difference in means if you are performing a two sample test).
paired -- a logical indicating whether you want a paired t-test.
var.equal --a logical variable indicating whether to treat the two variances as being equal. If TRUE then the pooled variance is used to estimate the variance otherwise the Welch (or Satterthwaite) approximation to the degrees of freedom is used. conf.level --confidence level of the interval.
formula --a formula of the form lhs ~ rhs where lhs is a numeric variable giving the data values and rhs a factor with two levels giving the corresponding groups.
data --an optional matrix or data frame (or similar: see model.frame) containing the variables in the formula formula. By default the variables are taken from environment(formula). subset --an optional vector specifying a subset of observations to be used.
na.action --a function which indicates what should happen when the data contain NAs. Defaults to getOption(\"na.action").
二、总体方差的假设检验
基本假设:𝑋~𝑁(𝜇,𝜎2),𝑋1,𝑋2,⋯,𝑋𝑛是来自总体𝑋的样本。 1. 单个总体的情况
(1).均值𝜇已知,统计量𝝌𝟐=
̂𝟐𝒏𝝈𝝈𝟎
𝟐
2~𝝌𝟐(𝒏),其中𝜎̂2=∑𝑛𝑖=1(𝑋𝑖−𝜇),双边检验拒绝域
𝑛
1
𝜒2≥𝜒2𝛼/2(𝑛)或𝜒2≤𝜒21−𝛼/2(𝑛),单边检验Ⅰ拒绝域𝜒2≥𝜒2𝛼(𝑛),单边检验Ⅱ拒绝域𝜒2≤𝜒21−𝛼(𝑛)。
(2).均值𝜇未知,统计量𝝌𝟐=
(𝒏−𝟏)𝑺𝟐𝝈𝟎𝟐~𝝌𝟐(𝒏−𝟏),双边检验拒绝域𝜒2≥𝜒2𝛼(𝑛−1)或
2𝜒2≤𝜒21−𝛼(𝑛−1),单边检验Ⅰ拒绝域𝜒2≥𝜒2𝛼(𝑛−1),单边检验Ⅱ拒绝域𝜒2≤
2
𝜒21−𝛼(𝑛−1)。一般情况下总体均值未知,故较多时候使用此方法。
2. 两个总体的情况
基本假设:𝑋~𝑁(𝜇1,𝜎12),𝑋1,𝑋2,⋯,𝑋𝑛1是来自总体𝑋的样本,𝑌~𝑁(𝜇2,𝜎22),𝑌1,𝑌2,⋯,𝑌𝑛2是
来自总体𝑌的样本,两样本独立。 (1).均值𝜇1和𝜇2已知时,统计量𝑭=
1𝑛2
̂𝟏𝟐𝝈̂𝟐𝝈
𝟐𝑛1
~𝑭(𝒏𝟏,𝒏𝟐),其中𝜎̂12=𝑛∑𝑖=1(𝑋𝑖−𝜇1)2,𝜎̂22=
1
1
22∑𝑛单边检验Ⅰ拒绝𝑖−𝜇2),双边检验拒绝域𝐹≥𝐹𝛼/2(𝑛1,𝑛2)或𝐹≤𝐹1−𝛼/2(𝑛1,𝑛2),𝑖=1(𝑌
域𝐹≥𝐹𝛼(𝑛1,𝑛2),单边检验Ⅱ拒绝域𝐹≤𝐹1−𝛼(𝑛1,𝑛2)。
(2). 均值𝜇1和𝜇2未知时,统计量𝑭=
𝑺𝟏𝟐𝑺𝟐𝟐~𝑭(𝒏𝟏−𝟏,𝒏𝟐−𝟏),双边检验拒绝域𝐹≥
𝐹𝛼⁄2(𝑛1−1,𝑛2−1)或𝐹≤𝐹1−𝛼⁄2(𝑛1−1,𝑛2−1),单边检验Ⅰ拒绝域𝐹≥𝐹𝛼(𝑛1−1,𝑛2−1),单边检验Ⅱ拒绝域𝐹≤𝐹1−𝛼(𝑛1−1,𝑛2−1)。
R语言命令:
var.test(x, y, ratio = 1, alternative = c(\"two.sided\", "less", \"greater\"), conf.level = 0.95, ...)
x, y -- numeric vectors of data values, or fitted linear model objects (inheriting from class \"lm").
ratio -- the hypothesized ratio of the population variances of x and y.
alternative -- a character string specifying the alternative hypothesis, must be one of \"two.sided\" (default), \"greater\" or \"less\". You can specify just the initial letter. conf.level -- confidence level for the returned confidence interval.
formula -- a formula of the form lhs ~ rhs where lhs is a numeric variable giving the data values and rhs a factor with two levels giving the corresponding groups. data -- an optional matrix or data frame (or similar: see model.frame) containing the variables in the formula formula. By default the variables are taken from environment(formula). subset -- an optional vector specifying a subset of observations to be used.
na.action -- a function which indicates what should happen when the data contain NAs. Defaults to getOption(\"na.action").
三、二项分布总体的假设检验
预备知识:二项分布(binomial distribution)是指在只会产生两种可能结果的n次独立重复试验中,当每次试验的a结果概率π保持不变时,求出现a结果次数𝑋=0,1,2,⋯,𝑛的一种概率分布。𝑃(𝑋)=𝑋!(𝑛−𝑋)!𝜋𝑋(1−𝜋)𝑛−𝑥,𝑋=0,1,2,⋯,𝑛,有∑𝑛若一个随机𝑋=0𝑃(𝑋)=1。变量𝑋,它的可能取值是0,1,2,⋯,n,且相应的取值概率满足以上公式,则称次随机变量𝑋服从以𝑛和𝜋为参数的二项分布,记为𝑋~(𝑛,𝜋)。 1.单样本二项检验
近似正态法,当n较大,p和1-p均不太小的时候,比如𝑛𝑝(1−𝑝)>5时,统计量𝑢=(𝑝̂−𝑝0)/√𝑝0𝑞0/𝑛,双边检验拒绝域𝑢<𝑢𝛼/2,或者𝑢>𝑢1−𝛼/2。
精确方法,利用公式直接计算𝑃值大小,若大于检验水平则接受原假设,若小于检验水平则拒绝原假设。
R语言命令:
𝑛!
binom.test(x, n, p = 0.5, alternative = c(\"two.sided", \"less", \"greater\"), conf.level = 0.95)
精确检验
x -- number of successes, or a vector of length 2 giving the numbers of successes and failures, respectively.
n -- number of trials; ignored if x has length 2. p -- hypothesized probability of success.
alternative -- indicates the alternative hypothesis and must be one of "two.sided", \"greater\" or "less\". You can specify just the initial letter.
conf.level -- confidence level for the returned confidence interval.
2.两样本二项检验
一般情况是两样本率的比较,目的在于对相应的两总体率进行统计推断。假设两样本率分别为𝑃1和𝑃2,当𝑛1与𝑛2均较大,且𝑃1、1−𝑃1、𝑃2、1−𝑃2均不太小,如𝑛2𝑃2、𝑛1𝑃1、𝑛1(1−𝑃1)、𝑛2(1−𝑃2)均大于5时,可利用样本率的分布近似正态分布,以及独立的两个正态变量之差也服从正态分布的性质,采用正态近似法对两总体作统计推断。统计量𝑢=𝑆1√𝑛
𝑋1+𝑋2
1+𝑛2
𝑝−𝑝2
𝑝1−𝑝2
,其中𝑆𝑝1−𝑝2=
(1−𝑛1+𝑛2)(𝑛+𝑛)。
1
2
1
2
𝑋+𝑋11
四、泊松分布总体的假设检验
预备知识:泊松分布(Poisson distribution)作为二项分布的一种极限情况,已发展成为描述小概率事件发生规律的重要分布。随机变量X服从泊松分布,是指在足够多的n次独立试验中,𝑋取值为0,1,2,⋯的相应概率为𝑃(𝑋)=
𝑒−𝜆𝜆𝑋𝑋!
,𝑋=0,1,2,⋯。式中参数𝜆即为总体均
数,记做X~P(𝜆)。
使用条件:1普通性,在充分小的观测单位上𝑋的取值最多为1;2平稳性,𝑋的取值只与观测单位的大小相关,而与观测单位的位置无关;3独立增量性,在某个观测单位上𝑋的取值与其它各观测单位上𝑋的取值无关。
泊松分布的性质:1总体均数𝜆与总体方差相等;2当𝑛很大,而𝑝很小,且𝑛𝑝=𝜆为常数时,二项分布近似泊松分布;3当𝜆增大时,泊松分布渐进正态分布。一般而言,𝜆≥20时,泊松分布资料可作为正态分布做处理;4泊松分布具备可加性。𝑚个互相独立的随机变量服从泊松分布,它们的和也服从泊松分布,且均值为这𝑚个随机变量的均值之和。
1.泊松分布的单样本检验
当总体均数小于20时,可采用直接利用公式计算概率的方式对样本均数与已知均数之间的差别进行有无统计学意义的比较。
近似正态法,当 𝜆≥20时,可以用正态分布来近似,统计量𝑢=
(𝑋−𝜆)2
𝜆
𝑋−𝜆√𝜆,或者统计量𝑋2=
~𝜒21,双边检验拒绝域𝑋2>𝜒21,1−α。
2.泊松分布的两样本检验
两样本计数分别为𝑋1和𝑋2,可以利用正态近似法进行比较。 当两样本的观察单位数相等,即𝑛1=𝑛2, 𝑋1+𝑋2≥20时,统计量𝑢=
|𝑋1−𝑋2|√𝑋1+𝑋2;
。
5≤𝑋1+𝑋2<20时,统计量𝑢=
|𝑋1−𝑋2|−1√𝑋1+𝑋2当两样本的观察单位数不相等,即𝑛1≠𝑛2, 𝑋1+𝑋2≥20时,统计量𝑢=
̅̅̅−𝑋̅̅̅̅||̅𝑋122√𝑛12+𝑛21
2
𝑋𝑋;
5≤𝑋1+𝑋2<20时,统计量𝑢=
̅̅̅−𝑋̅̅̅̅|−1|̅𝑋12𝑋𝑋2√𝑛12+𝑛212
。
𝑋2
̅1̅=𝑋1和̅̅̅其中̅𝑋𝑋,检验统计量𝑢近似服从正态分布。 2=
𝑛1
𝑛2
R语言命令:
poisson.test(x, T = 1, r = 1, alternative = c(\"two.sided", \"less\", \"greater"), conf.level = 0.95)
精确检验
x -- number of events. A vector of length one or two.
T -- time base for event count. A vector of length one or two. r -- hypothesized rate or rate ratio
alternative -- indicates the alternative hypothesis and must be one of \"two.sided\", \"greater" or \"less". You can specify just the initial letter.
conf.level -- confidence level for the returned confidence interval.
因篇幅问题不能全部显示,请点此查看更多更全内容