小馬哥課堂-統計學-置信區間


Confidence interval(置信區間)

confidence interval (CI) is a type of interval estimate, computed from the statistics of the observed data, that might contain the true value of an unknown population parameter. The interval has an associated confidence level that, loosely speaking, quantifies the level of confidence that the parameter lies in the interval. More strictly speaking, the confidence level represents the frequency (i.e. the proportion) of possible confidence intervals that contain the true value of the unknown population parameter. In other words, if confidence intervals are constructed using a given confidence level from an infinite number of independent sample statistics, the proportion of those intervals that contain the true value of the parameter will be equal to the confidence level.

置信區間是 由 樣本統計量得到的 對總體參數的 區間估計。(P.S:第一次看到這句話的人,肯定要瘋,因為不知所雲,不要着急,本文保證你能理解這句話的含義。)

置信水平,真實的總體未知參數 落在 可能的置信區間的 概率。"可能的置信區間":這里面包含了誤差界限(margin of error)

置信區間是一個范圍,包含 未知總體參數值 的范圍。是基於 有限樣本 對 總體未知參數的 估計。

Confidence intervals consist of a range of potential values of the unknown population parameter. However, the interval computed from a particular sample does not necessarily include the true value of the parameter. Since the observed data are random samples from the true population, the confidence interval obtained from the data is also random.

The desired level of confidence is set by the researcher (not determined by data). Most commonly, the 95% confidence level is used. However, other confidence levels can be used, for example, 90% and 99%.

Factors affecting the width of the confidence interval include the size of the sample, the confidence level, and the variability in the sample. A larger sample will, all other things being equal, tend to produce a better estimate of the population parameter.

一般總體不可能被完全統計,只能采用隨機抽樣的方式來進行統計。In practice, however, we select one random sample and generate one confidence interval, which may or may not contain the true mean。實際上,我們只能進行隨機抽樣,然后計算出一個置信區間,但該置信區間不定包含 被估計參數的真值,因為抽樣值是從隨機獲取,那么置信區間也是不確定。

通常,對於總體參數的估計,有兩種類型:點估計(point estimate)和置信區間估計(CI estimate)。為方便表述,下面我以 對總體期望\(\mu\)的估計 為例進行說明。

置信區間估計的基於:

  1. 點估計,例如,對樣本均值進行估計;
  2. 設置置信水平,通常為95%,當然你可以設置其他任何值0-100都可以;
  3. 點估計的標准誤差(the standard error of the point estimate) 或者 抽樣的差異性(the sampling variability);

Strictly speaking a 95% confidence interval means that if we were to take 100 different samples and compute a 95% confidence interval for each sample, then approximately 95 of the 100 confidence intervals will contain the true mean value (μ). In practice, however, we select one random sample and generate one confidence interval, which may or may not contain the true mean. The observed interval may over- or underestimate μ. Consequently, the 95% CI is the likely range of the true, unknown parameter. The confidence interval does not reflect the variability in the unknown parameter. Rather, it reflects the amount of random error in the sample and provides a range of values that are likely to include the unknown parameter. Another way of thinking about a confidence interval is that it is the range of likely values of the parameter (defined as the point estimate + margin of error) with a specified level of confidence (which is similar to a probability).

Suppose we want to generate a 95% confidence interval estimate for an unknown population mean. This means that there is a 95% probability that the confidence interval will contain the true population mean. Thus, P( [sample mean] - margin of error < μ < [sample mean] + margin of error) = 0.95.

嚴格的來講,95%的置信區間是 如果我們進行抽樣,隨機抽取100個不同的樣本,然后為每個樣本計算一個95%置信區間,那么,100個置信區間中大約有95個會包含實際的總體期望\(\mu\)。現實情況中,我們抽取一個隨機樣本並得到一個置信區間,不一定能包含真實的總體期望。因此,95%的置信區間是一個可能包含真實總體參數的范圍。置信區間並不反映總體未知參數的差異性(variability),它反映的是樣本中隨機誤差,同時提供一個可能包含總體未知參數的可能范圍。置信區間也可以看作是 指定置信水平的點估計+誤差界限。

假設,我們要計算 對總體期望 95%的置信區間。即,有95%的可能性,置信區間包含真實的總體期望。P( [sample mean] - margin of error < μ < [sample mean] + margin of error) = 0.95.

示例1

今年,某果園的產量是200,000個蘋果,從中隨機抽取36個蘋果,其平均重量是112g(標准差為40g),求200,000個蘋果的平均重量在100到124克范圍的概率?

已知:

​ 總體:200,000

​ 樣本容量n:36 g,樣本均值:\(\overline x=112\) g,樣本標准差: \(S=40\) g

未知:

​ 總體均值:\(\mu\),總體標准差:\(\sigma\)

求:

​ $$P(100 \le \mu \le 124)$$

如果反復以樣本容量36進行抽樣,然后求樣本均值,繪制樣本均值的頻率圖,根據CLT,那么樣本均值的抽樣分布是服從正態分布的。$\sigma_{\overline x} = \frac {\sigma}{\sqrt n} $

根據小馬哥課堂-統計學-大數定理\(\mu_{\overline x} = \mu\)\(\mu_{\overline x}\):the mean of the sampling distribution of the sampling mean

\[\begin{array}{rcl} P(100\le\mu \le 124) &=>& \\ P(100\le \mu_{\overline x} \le 124) &=>& \\ \end{array} \]

又因為 \(z=\frac {x-\mu}{\sigma}\)\(\overline x\)服從正態分布,那么\(\displaystyle z=\frac{\overline x-\mu_{\overline x}}{\sigma_{\overline x}},\mu_{\overline x}=\overline x+z\cdot\sigma_{\overline x}\)

\[\displaystyle \begin{array}{rcl} P(100\le \mu_{\overline x} \le 124) &=>& \\ P(100\le \overline x+z\cdot\sigma_{\overline x}\le 124)&=>&整理得 \\ P(\frac{100-\overline x}{\sigma_{\overline x}} \le z \le \frac{124-\overline x}{\sigma_{\overline x}})\end{array} \]

根據小馬哥課堂-統計學-標准誤差一節可知,\(\displaystyle \sigma_{\overline x}=\frac {\sigma}{\sqrt n} \approx \frac{S}{\sqrt n}=\frac {40}{6}=6.67\)\(\sigma_{\overline x}\):the standard deviation of the sampling distribution of the sampling mean,(樣本標准差(the standard deviation of the sample) 估計 總體標准差(the standard deviation of the population))

\[\displaystyle \begin{array}{rcl} P(\frac{100-\overline x}{\sigma_{\overline x}} \le z \le \frac{124-\overline x}{\sigma_{\overline x}}) &=> & \\ P(\frac{100-112}{6.67} \le z \le \frac{124-112}{6.67}) &=>& \\ P(-1.8\le z\le 1.8) & & (\overline x 落在 樣本均值的抽樣分布 的1.8個標准差之間的概率) \end{array} \]

根據小馬哥課堂-統計學-z分數一節查z-table可知,\(P(z \le 1.8)=0.9641\)

\[P(-1.8 \le z \le 1.8)=(P(z \le 1.8)-0.5)\cdot 2=0.4641\cdot 2=0.9282 \]

所以 200,000個蘋果的平均重量在100到124克范圍的概率是92.82% .也可以說,92.82%的置信水平,蘋果的real mean weight落在的置信區間[100,124]。

示例2

In practice, we often do not know the value of the population standard deviation (σ). However, if the sample size is large (n > 30), then the sample standard deviations can be used to estimate the population standard deviation.

在現實環境中,我們很少能知道總體的方差。但是,如果抽樣樣本的容量n>30,那么可以用樣本標准差(S)估計總體標准差(\(\sigma\)),同時,樣本均值的分布服從正態分布,那么我們就可以用z-table去估算 置信區間或者執行水平。

已知,根據大數定理和中心極限定理,樣本均值的分布服從 期望=\(\mu_\overline{x} = \mu​\),標准差=\(\sigma_{\overline x}=\frac{\sigma}{\sqrt n}​\)的正態分布。根據z-table,標准正態分布滿足\(P(-1.96 \le z \le 1.96) = 0.95​\),即,變量z有95%的可能性落在-1.96~1.96之間。那么,\(z=\frac{\overline x-\mu_{\overline x}}{\sigma_{\overline x}}=\frac{\overline x-\mu}{\frac{\sigma}{\sqrt n}}​\)

\[\begin{array}{rcl} P(-1.96 \le \frac{\overline x-\mu}{\frac{\sigma}{\sqrt n}} \le 1.96) &=&0.95 \\ P(\overline x-1.96\cdot\frac{\sigma}{\sqrt n} \le\mu \le \overline x+1.96\cdot\frac{\sigma}{\sqrt n}) &=& 0.95 \\\end{array} \]

那么,\(\mu\)所在的范圍是\(\overline x\pm1.96\cdot\frac{\sigma}{\sqrt n}\), 誤差界限是\(1.96\cdot\frac{\sigma}{\sqrt n}\)

置信區間與置信水平,樣本容量的關系

  1. 在置信水平固定的情況下,樣本容量越大,置信區間越窄,抽樣誤差越小;
  2. 在樣本容量相同的情況下,置信水平越高,置信區間越寬;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM