跳至主要内容

常態分佈相關檢定

單 normal distribution 的參數檢定

X1,,XniidN(θ,σ2) 2-par exp family with θ,σ2 unknownX_1,\cdots, X_n\overset{\text{iid}}{\sim}N(\theta, \sigma^2)\in\text{ 2-par exp family with }\theta, \sigma^2\text{ unknown}

Recall

<θ^=Xˉ=1ni=1nXiN(θ,σ2n)σ2^=S2=1n1i=1n(XiXˉ)2with (n1)S2σ2=(XiXˉ)2σ2χn12\perp\Bigg < \begin{align*} \hat{\theta}=\bar{X}&=\frac{1}{n}\sum_{i=1}^nX_i\sim N(\theta, \frac{\sigma^2}{n})\\ \hat{\sigma^2}=S^2&=\frac{1}{n-1}\sum_{i=1}^n(X_i-\bar{X})^2\quad\text{with }\frac{(n-1)S^2}{\sigma^2}=\frac{\sum(X_i-\bar{X})^2}{\sigma^2}\sim\chi^2_{n-1} \end{align*}
H0:θ=θ0 v.s. H1:θ>θ0H_0:\theta\overset{=}{\le}\theta_0\quad\text{ v.s. }\quad H_1:\theta>\theta_0

UMPU level α\alpha test is rejects H0H_0 if

xˉθ0S2/nθ=θ0tn1=n(xˉθ0)S>tn1,α\underbrace{\frac{\bar{x}-\theta_0}{\sqrt{S^2/n}}}_{\overset{\theta=\theta_0}{\sim}t_{n-1}}=\frac{\sqrt{n}(\bar{x}-\theta_0)}{S}>t_{n-1,\alpha}

事實上,這就是 LRT。

Note

tk=N(0,1)χk2/k> and χk2=kχ12t_k=\frac{N(0,1)}{\sqrt{\chi^2_k/k}}\Big>\perp\text{ and }\chi^2_k=\sum^k \chi^2_1 LLNXˉkP1    tkkPN(0,1)    tk,αkPZα\xRightarrow{\text{LLN}}\bar{X}\xrightarrow[k\to\infty]{P}1\implies t_k\xrightarrow[k\to\infty]{P}N(0,1)\implies t_{k,\alpha}\xrightarrow[k\to\infty]{P}Z_{\alpha}
H0:θθ0 v.s. H1:θ<θ0H_0:\theta\ge\theta_0 \text{ v.s. } H_1:\theta<\theta_0

UMPU level α\alpha test is reject H0H_0 if

n(xˉθ0)S<tn1,α=tn1,1α\frac{\sqrt{n}(\bar{x}-\theta_0)}{S}<-t_{n-1,\alpha}=t_{n-1,1-\alpha}

事實上,這就是 LRT。


H0:θ=θ0 v.s. H1:θθ0H_0:\theta=\theta_0\quad\text{ v.s. }\quad H_1:\theta\neq\theta_0

UMPU level α\alpha test is reject H0H_0 if

n(xˉθ0)S>tn1,α/2 or n(xˉθ0)S<tn1,α/2\frac{\sqrt{n}(\bar{x}-\theta_0)}{S}>t_{n-1,\alpha/2}\text{ or }\frac{\sqrt{n}(\bar{x}-\theta_0)}{S}<-t_{n-1,\alpha/2}     n(xˉθ0)S>tn1,α/2\iff \left|\frac{\sqrt{n}(\bar{x}-\theta_0)}{S}\right|>t_{n-1,\alpha/2}
H0:σ2=σ02 v.s. H1:σ2>σ02H_0:\sigma^2\overset{=}{\le}\sigma^2_0\quad\text{ v.s. }\quad H_1:\sigma^2>\sigma^2_0

UMPU level α\alpha test is reject H0H_0 if

(n1)S2σ02σ2=σ02χn12>χn1,α2\underbrace{\frac{(n-1)S^2}{\sigma^2_0}}_{\overset{\sigma^2=\sigma^2_0}{\sim}\chi^2_{n-1}}>\chi^2_{n-1,\alpha}

事實上,它會是 UMP, LRT。


H0:σ2σ02 v.s. H1:σ2<σ02H_0:\sigma^2\ge\sigma^2_0\quad\text{ v.s. }\quad H_1:\sigma^2<\sigma^2_0

UMPU level α\alpha test is reject H0H_0 if

(n1)S2σ02<χn1,1α2\frac{(n-1)S^2}{\sigma^2_0}<\chi^2_{n-1,1-\alpha}
H0:σ2=σ02 v.s. H1:σ2σ02H_0:\sigma^2=\sigma^2_0\quad\text{ v.s. }\quad H_1:\sigma^2\neq\sigma^2_0

UMPU level α\alpha test is

ϕ(x~)={1if (n1)S2σ02>k1 or (n1)S2σ02<k20otherwise\phi(\utilde{x})=\begin{cases} 1 & \text{if }\frac{(n-1)S^2}{\sigma^2_0}>k_1\text{ or }\frac{(n-1)S^2}{\sigma^2_0}<k_2\\ 0 & \text{otherwise} \end{cases}

with k1,k2k_1, k_2 s.t. Eσ02ϕ(x~)=αE_{\sigma^2_0}\phi(\utilde{x})=\alpha and Eσ02[Tϕ(x~)]=αEσ02T=(n1)αE_{\sigma^2_0}[T\phi(\utilde{x})]=\alpha\cdot E_{\sigma^2_0}T=(n-1)\alpha

i.e.k2k1gn1(t)dt=1α and k2k1tgn1(t)dt=(n1)(1α) where gn1 is pdf of χn12\text{i.e.}\qquad\int_{k_2}^{k_1}g_{n-1}(t) dt=1-\alpha \text{ and } \int_{k_2}^{k_1}tg_{n-1}(t) dt=(n-1)(1-\alpha) \text{ where }g_{n-1}\text{ is pdf of }\chi^2_{n-1}

    \implies 只有數值解。此時我們通常會用 equal-tailed test,即左右拒絕區域面積都是 α/2\alpha/2χ2\chi^2 不對稱)。

i.e.ϕ={1 if (n1)S2σ02>χn1,α/22 or (n1)S2σ02<χn1,1α/220 otherwise\text{i.e.}\qquad\phi^*=\begin{cases} 1 &\text{ if }\frac{(n-1)S^2}{\sigma^2_0}>\chi^2_{n-1,\alpha/2}\text{ or }\frac{(n-1)S^2}{\sigma^2_0}<\chi^2_{n-1,1-\alpha/2}\\ 0 &\text{ otherwise} \end{cases}

Fact: ϕ[n]Dϕ\phi^*\rightarrow[n\to\infty]{D}\phi

雙 normal distribution 的參數檢定

<X1,,XniidN(θx,σx2)Y1,,YmiidN(θy,σy2)\perp\Big<\begin{align*} X_1, \cdots, X_n\overset{\text{iid}}{\sim}N(\theta_x, \sigma^2_x)\\ Y_1, \cdots, Y_m\overset{\text{iid}}{\sim}N(\theta_y, \sigma^2_y) \end{align*}     <XˉYˉN(θxθy,σx2n+σy2m)n(XiXˉ)2σx2+m(YiYˉ)2σy2χn+m22\implies \perp\Bigg<\begin{align*} &\bar{X}-\bar{Y}\sim N(\theta_x-\theta_y, \frac{\sigma^2_x}{n}+\frac{\sigma^2_y}{m})\\ &\frac{\sum^n(X_i-\bar{X})^2}{\sigma^2_x}+\frac{\sum^m(Y_i-\bar{Y})^2}{\sigma^2_y}\sim\chi^2_{n+m-2} \end{align*}     XˉYˉ(θxθy)σx2n+σy2m[n(XiXˉ)2σx2+m(YiYˉ)2σy2]/(n+m2)=d<N(0,1)χn+m22n+m2tn+m2=σx2=σ2=σy2XˉYˉ(θxθy)(1n+1m)Sp2tn+m2Sp2=(n1)Sx2+(m1)Sy2n+m2\begin{align*} \implies& \frac{\bar{X}-\bar{Y}-(\theta_x-\theta_y)}{\sqrt{\frac{\sigma^2_x}{n}+\frac{\sigma^2_y}{m}}\sqrt{\left[\frac{\sum^n(X_i-\bar{X})^2}{\sigma^2_x}+\frac{\sum^m(Y_i-\bar{Y})^2}{\sigma^2_y}\right]/(n+m-2)}}\xlongequal{\text{d}}\perp\Big<\frac{N(0,1)}{\sqrt{\frac{\chi^2_{n+m-2}}{n+m-2}}}\sim t_{n+m-2}\\ \xlongequal{\sigma^2_x=\sigma^2=\sigma^2_y}&\frac{\bar{X}-\bar{Y}-(\theta_x-\theta_y)}{\sqrt{(\frac{1}{n}+\frac{1}{m})S^2_p}}\sim t_{n+m-2}\quad S^2_p=\frac{(n-1)S^2_x+(m-1)S^2_y}{n+m-2} \end{align*}
H0:σx2τ0σy2 v.s. H1:σx2>τ0σy2    H0:σx2/σy2τ0 v.s. H1:σx2/σy2>τ0H_0:\sigma^2_x\le\tau_0\sigma^2_y\quad\text{ v.s. }\quad H_1:\sigma^2_x>\tau_0\sigma^2_y\iff H_0:\sigma^2_x/\sigma^2_y\le\tau_0\quad\text{ v.s. }\quad H_1:\sigma^2_x/\sigma^2_y>\tau_0 Sx2/σx2Sy2/σy2=dχn12/(n1)χm12/(m1)Fn1,m1\frac{S^2_x/\sigma^2_x}{S^2_y/\sigma^2_y}\overset{\text{d}}{=}\frac{\chi^2_{n-1}/(n-1)}{\chi^2_{m-1}/(m-1)}\sim F_{n-1, m-1}

UMPU level α\alpha test is reject H0H_0 if Sx2/σx2Sy2/σy2>Fn1,m1,α    Sx2Sy2>τ0Fn1,m1,α\frac{S^2_x/\sigma^2_x}{S^2_y/\sigma^2_y}>F_{n-1,m-1,\alpha}\iff \frac{S^2_x}{S^2_y}>\tau_0\cdot F_{n-1,m-1,\alpha} with

β(σx2σy2=τ>τ0)=P(Sx2/σx2Sy2/σy2>σy2σx2τ0Fn1,m1,α)=P(Fn1,m1>τ0τFn1,m1,α)\beta(\frac{\sigma^2_x}{\sigma^2_y}=\tau>\tau_0)=P(\frac{S^2_x/\sigma^2_x}{S^2_y/\sigma^2_y}>\frac{\sigma^2_y}{\sigma^2_x}\tau_0\cdot F_{n-1,m-1,\alpha})=P(F_{n-1,m-1}>\frac{\tau_0}{\tau}\cdot F_{n-1,m-1,\alpha})
H0:σx2τ0σy2 v.s. H1:σx2<τ0σy2H_0:\sigma^2_x\ge\tau_0\sigma^2_y\quad\text{ v.s. }\quad H_1:\sigma^2_x<\tau_0\sigma^2_y

UMPU level α\alpha test is reject H0H_0 if Sx2Sy2<τ0Fn1,m1,1α\frac{S^2_x}{S^2_y}<\tau_0\cdot F_{n-1,m-1,1-\alpha}


H0:σx2=τ0σy2 v.s. H1:σx2τ0σy2H_0:\sigma^2_x=\tau_0\sigma^2_y\quad\text{ v.s. }\quad H_1:\sigma^2_x\neq\tau_0\sigma^2_y

Usually, we use equal-tailed test. I.e. Reject H0H_0 if

Sy2Sx2>1τ0Fn1,m1,α/2 or Sy2Sx2<1τ0Fn1,m1,1α/2\frac{S^2_y}{S^2_x}>\frac{1}{\tau_0}\cdot F_{n-1,m-1,\alpha/2}\text{ or }\frac{S^2_y}{S^2_x}<\frac{1}{\tau_0}\cdot F_{n-1,m-1,1-\alpha/2}

Assume σx2=σy2=σ2\sigma^2_x=\sigma^2_y=\sigma^2

H0:θxθy v.s. H1:θx>θyH_0:\theta_x\le\theta_y\quad\text{ v.s. }\quad H_1:\theta_x>\theta_y

UMPU level α\alpha test is reject H0H_0 if

xˉyˉSp2(1n+1m)tn+m2>tn+m2,α\underbrace{\frac{\bar{x}-\bar{y}}{\sqrt{S^2_p(\frac{1}{n}+\frac{1}{m})}}}_{\sim t_{n+m-2}}>t_{n+m-2,\alpha}
H0:θx=θy v.s. H1:θxθyH_0:\theta_x=\theta_y\quad\text{ v.s. }\quad H_1:\theta_x\neq\theta_y

UMPU level α\alpha test is reject H0H_0 if

xˉyˉSp2(1n+1m)>tn+m2,α/2Called two-sample t-test\left|\frac{\bar{x}-\bar{y}}{\sqrt{S^2_p(\frac{1}{n}+\frac{1}{m})}}\right|>t_{n+m-2,\alpha/2}\qquad\text{Called two-sample t-test}

Remark:

  1. σx2σy2\sigma^2_x\neq\sigma^2_y 時,目前還沒有結論。

  2. σx2=σ2=σ2    XN(θx,σ2)YN(θy,σ),E[Sx2]=σ2=E[Sy2]=E[Sp2]\sigma^2_x=\sigma^2=\sigma^2\implies X\sim N(\theta_x, \sigma^2)\perp Y\sim N(\theta_y, \sigma), E[S^2_x]=\sigma^2=E[S^2_y]=E[S^2_p], and

    (n1)Sx2σ2χn12(m1)Sy2σ2χm12(n+m2)Sp2σ2χn+m22\frac{(n-1)S^2_x}{\sigma^2}\sim\chi^2_{n-1}\quad\frac{(m-1)S^2_y}{\sigma^2}\sim\chi^2_{m-1}\quad\frac{(n+m-2)S^2_p}{\sigma^2}\sim\chi^2_{n+m-2}

        Sp2\implies S^2_p 的方差會是三個中最小的。


當 X 和 Y 的資料量都為 n 時

H0:θx=θy v.s. H1:θxθyH_0:\theta_x=\theta_y\quad\text{ v.s. }\quad H_1:\theta_x\neq\theta_y

UMPU level α\alpha test is reject H0H_0 if

xˉyˉSp2/n>t2n2,α/2\left|\frac{\bar{x}-\bar{y}}{S_p\sqrt{2/n}}\right|>t_{2n-2,\alpha/2}

Paired Data

有時資料成對出現的,比如同一個人在不同時間的數據。此時,每對之間的數據可能會是相關的,而不同對之間的數據仍然會是獨立的。

(X1Y1),(X2Y2),,(XnYn)iidN(θx,θy,σx2,σy2,ρ)\begin{pmatrix} X_1\\ Y_1 \end{pmatrix}, \begin{pmatrix} X_2\\ Y_2 \end{pmatrix}, \cdots, \begin{pmatrix} X_n\\ Y_n \end{pmatrix} \overset{\text{iid}}{\sim} N(\theta_x, \theta_y, \sigma^2_x, \sigma^2_y, \rho) H0:θx=θy v.s. H1:θxθyH_0:\theta_x=\theta_y\quad\text{ v.s. }\quad H_1:\theta_x\ne\theta_y     Di=YiXi,i=1,2,,nidN(θxθy,σ2)\implies D_i=Y_i-X_i, i=1,2,\cdots,n\overset{\text{id}}{\sim} N(\theta_x-\theta_y, \sigma^2)

這樣我們就把問題轉換成了單樣本的問題。其中 σ2=σ2(σx2,σy2,ρ)\sigma^2=\sigma^2(\sigma^2_x, \sigma^2_y, \rho) 的函數,但因為 σx2,σy2,ρ\sigma^2_x, \sigma^2_y, \rho 都是未知的,所以 σ2\sigma^2 也是未知的。

    H0:μ=0 v.s. H1:μ0\implies H_0:\mu=0\quad\text{ v.s. }\quad H_1:\mu\ne 0

UMPU level α\alpha test reject H0H_0 if

n(YˉXˉ)Sp>tn1,1α2 where Sp2=1n(DiDˉ)n1\left|\frac{\sqrt{n}(\bar{Y}-\bar{X})}{S_p}\right|>t_{n-1,1-\frac{\alpha}{2}}\quad\text{ where }S_p^2=\frac{\sum^n_1(D_i-\bar{D})}{n-1}

稱為 paired t-test