ผลต่างระหว่างรุ่นของ "Probstat/notes/sample means and sample variances"

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
 
(ไม่แสดง 41 รุ่นระหว่างกลางโดยผู้ใช้คนเดียวกัน)
แถว 1: แถว 1:
== Sample ==
+
: ''This is part of [[probstat]]''
 +
 
 
Consider a certain distribution.  The mean <math>\mu</math> of the distribution is the expected value of a random variable <math>X</math> sample from the distribution.  I.e.,
 
Consider a certain distribution.  The mean <math>\mu</math> of the distribution is the expected value of a random variable <math>X</math> sample from the distribution.  I.e.,
  
แถว 9: แถว 10:
  
 
<center>
 
<center>
<math>\sigma^2=Var(X)=E[(X-\mu)^2]=E[X^2] = E[X]^2.</math>.
+
<math>\sigma^2=Var(X)=E[(X-\mu)^2]=E[X^2] - E[X]^2.</math>
 
</center>
 
</center>
  
 
And finally, the standard deviation is <math>\sigma = \sqrt{Var(X)}</math>.
 
And finally, the standard deviation is <math>\sigma = \sqrt{Var(X)}</math>.
  
Suppose that you take <math>n</math> samples <math>X_1,X_2,\ldots,X_n</math> independently from this distribution.  (Note that <math>X_1,X_2,\ldots,X_n</math> are random variables.
+
== Sample Statistics ==
 +
 
 +
Suppose that you take <math>n</math> samples <math>X_1,X_2,\ldots,X_n</math> independently from this distribution.  (Note that <math>X_1,X_2,\ldots,X_n</math> are random variables.)
  
 
=== Sample means ===
 
=== Sample means ===
แถว 26: แถว 29:
 
is called a '''sample mean.'''  Since <math>X_1,X_2,\dots,X_n</math> are random variables, the mean <math>\bar{X}</math> is also a random variable.
 
is called a '''sample mean.'''  Since <math>X_1,X_2,\dots,X_n</math> are random variables, the mean <math>\bar{X}</math> is also a random variable.
  
Thus, we can compute:
+
We hope that <math>\bar{X}</math> approximates <math>\mu</math> well.  We can compute:
  
 +
<center>
 
<math>E[\bar{X}]= E\left[\frac{1}{n}\sum_{i=1}^n X_i\right] = \frac{1}{n}E\left[\sum_{i=1}^n X_i\right] = \frac{1}{n}\sum_{i=1}^n E[X_i] = \frac{1}{n} n\mu = \mu</math>
 
<math>E[\bar{X}]= E\left[\frac{1}{n}\sum_{i=1}^n X_i\right] = \frac{1}{n}E\left[\sum_{i=1}^n X_i\right] = \frac{1}{n}\sum_{i=1}^n E[X_i] = \frac{1}{n} n\mu = \mu</math>
 +
</center>
  
and
+
and since <math>X_1,X_2,\ldots,X_n</math> are independent, we have that
  
<math>Var(\bar{X}) = \frac{\sigma^2}{n}.</math>
+
<center>
 +
<math>Var(\bar{X}) = Var\left(\frac{X_1+X_2+\cdots+X_n}{n}\right) = \frac{1}{n^2}Var(X_1+X_2+\cdots+X_n) = \frac{1}{n^2}\cdot n\cdot Var(X) = \frac{\sigma^2}{n}.</math>
 +
</center>
  
 
=== Sample variances and sample standard deviations ===
 
=== Sample variances and sample standard deviations ===
 +
We can also use the sample to estimate <math>\sigma^2</math>.
 +
 +
The statistic
 +
 +
<center>
 +
<math>S^2 = \frac{\sum_{i=1}^n (X_i - \bar{X})^2}{n-1}</math>
 +
</center>
 +
 +
is called a '''sample variance'''.  The sample standard deviation is <math>S = \sqrt{S^2} = \sqrt{\frac{\sum_{i=1}^n (X_i - \bar{X})^2}{n-1}}</math>.
 +
 +
Note that the denominator is <math>n-1</math> instead of <math>n</math>.
 +
 +
We can show that <math>E[S^2] = \sigma^2</math>.
 +
 +
<center>
 +
<math>
 +
\begin{array}{rcl}
 +
\mathrm{E}[S^2] &=& \mathrm{E}\left[\frac{\sum_{i=1}^n (X_i - \bar{X})^2}{n-1}\right] \\
 +
&=& \mathrm{E}\left[\frac{\sum_{i=1}^n (X_i^2 -2X_i\bar{X} + \bar{X}^2}{n-1}\right] \\
 +
&=& \frac{1}{n-1}\left( \sum_{i=1}^n E[X_i^2] - 2\cdot\sum_{i=1}^n E[X_i\bar{X}] + \sum_{i=1}^n E[\bar{X}^2] \right) \\
 +
&=& \frac{1}{n-1}\left( \sum_{i=1}^n E[X_i^2]
 +
- 2\cdot\sum_{i=1}^n E\left[X_i\left((1/n)\sum_{j=1}^n X_j\right)\right]
 +
+ \sum_{i=1}^n E\left[\left((1/n)\sum_{j=1}^n X_j\right)^2\right] \right) \\
 +
&=& \frac{1}{n-1}\left( \sum_{i=1}^n E[X_i^2]
 +
- (2/n)\cdot\sum_{i=1}^n \sum_{j=1}^n E\left[X_i\cdot X_j\right]
 +
+ n\cdot E\left[\left((1/n)\sum_{j=1}^n X_j\right)^2\right] \right) \\
 +
&=& \frac{1}{n-1}\left( \sum_{i=1}^n E[X_i^2]
 +
- (2/n)\cdot\sum_{i=1}^n \sum_{j=1}^n E\left[X_i\cdot X_j\right]
 +
+ (1/n)\cdot E\left[\left(\sum_{j=1}^n X_j\right)^2\right] \right) \\
 +
\end{array}
 +
</math>
 +
</center>
 +
 +
We note that since <math>X_i</math> and <math>X_j</math> are independent, we have that
 +
 +
<center><math>E[X_iX_j] = E[X_i]E[X_j] = \mu\cdot\mu = \mu^2</math>.</center>
 +
 +
Let's deal with the middle term here.
 +
 +
<center>
 +
<math>
 +
\begin{array}{rcl}
 +
\sum_{i=1}^n \sum_{j=1}^n E\left[X_i\cdot X_j\right] &=& \sum_{i=1}^n E[X_iX_i] + \sum_{i=1}^n\sum_{j\neq i} E[X_iX_j]\\
 +
&=& \sum_{i=1}^n E[X_i^2] + \sum_{i=1}^n\sum_{j\neq i} E[X_i]E[X_j]\\
 +
&=& n E[X^2] + n(n-1)E[X]E[X]\\
 +
&=& n E[X^2] + n(n-1)\mu^2\\
 +
\end{array}
 +
</math>
 +
</center>
 +
 +
Let's work on the third term which ends up being the same as the middle term.
 +
 +
<center>
 +
<math>
 +
E\left[\left(\sum_{j=1}^n X_j\right)^2\right] = E\left[\sum_{j=1}^n \sum_{k=1}^n X_jX_k\right]
 +
= \sum_{j=1}^n \sum_{k=1}^n E[X_jX_k] = n E[X^2] + n(n-1)\mu^2.
 +
</math>
 +
</center>
 +
 +
Let's put everything together:
 +
 +
<center>
 +
<math>
 +
\begin{array}{rcl}
 +
\mathrm{E}[S^2]
 +
&=& \frac{1}{n-1}\left( \sum_{i=1}^n E[X_i^2]
 +
- (2/n)\cdot\sum_{i=1}^n \sum_{j=1}^n E\left[X_i\cdot X_j\right]
 +
+ (1/n)\cdot E\left[\left(\sum_{j=1}^n X_j\right)^2\right] \right) \\
 +
&=& \frac{1}{n-1}\left( n E[X^2]
 +
- (2/n)(n E[X^2] + n(n-1)\mu^2)
 +
+ (1/n)(n E[X^2] + n(n-1)\mu^2) \right) \\
 +
&=& \frac{1}{n-1}\left( n E[X^2]
 +
- 2E[X^2] - 2(n-1)\mu^2
 +
+ E[X^2] + (n-1)\mu^2 \right) \\
 +
&=& \frac{1}{n-1}\left((n-1) E[X^2] - (n-1)\mu^2  \right) \\
 +
&=& E[X^2] - \mu^2 = \sigma^2\\
 +
\end{array}
 +
</math>
 +
</center>
 +
 +
=== Summary ===
 +
 +
Sample means:
 +
 +
<center>
 +
<math>\bar{X} = \frac{X_1+X_2+\cdots+X_n}{n} = \frac{1}{n}\sum_{i=1}^n X_i</math>
 +
</center>
 +
 +
Sample variance:
 +
 +
<center>
 +
<math>S^2 = \frac{\sum_{i=1}^n (X_i - \bar{X})^2}{n-1}</math>
 +
</center>
 +
 +
==== Properties of sample means and sample variances ====
 +
 +
{{กล่องเทา|
 +
* <math>E[\bar{X}] = \mu</math>
 +
* <math>Var[\bar{X}] = \sigma^2/n</math>
 +
* <math>E[S^2] = \sigma^2</math>
 +
}}
 +
 +
== Distribution of sample means ==
 +
While we know basic properties of sample means <math>\bar{X}</math>, if we want to perform other statistical calculation (i.e., computing confidence intervals or testing hypotheses), it is very useful to know the ''exact'' distribution of <math>\bar{X}</math>.
 +
 +
For a general population, it will be hard to deal the the distribution of <math>\bar{X}</math> exactly.  However, if the population is normal, we are in a very good shape.
 +
 +
Recall the definition of <math>\bar{X}</math>:
 +
 +
<center>
 +
<math>\bar{X} = (X_1+X_2+\cdots+X_n)/n.</math>
 +
</center>
 +
 +
Therefore, <math>\bar{X}</math> is a sum of independent normally distributed random variables.  A nice property of normal random variables is that the sum of normally distributed random variables remains a normal random variable.  Since a normal random variable is uniquely determined by its mean and variance, we have the following observation.
 +
 +
{{กล่องเทา|
 +
'''Distribution of sample means of normal populations.'''
 +
 +
If the population is normally distributed with mean <math>\mu</math> and variance <math>\sigma^2</math>, the distribution of <math>\bar{X}</math> is normal with mean <math>\mu</math> and variance <math>\sigma^2/n</math>.
 +
}}
 +
 +
=== Examples ===
 +
'''Ex1.''' Suppose that the population has mean <math>\mu = 15</math> and variance <math>\sigma^2 = 15</math>.  If you select a sample of size 20, what is the probability that the sample mean <math>\bar{X}</math> is greater than 17?
 +
 +
'''Solution:'''
 +
 +
The sample mean <math>\bar{X}</math> is normal with mean <math>\mu=15</math> and variance <math>\sigma^2/n = 15/20 = 0.75</math>.  Therefore,
 +
 +
<center>
 +
<math>\frac{\bar{X} - 15}{\sqrt{0.75}}</math>
 +
</center>
 +
 +
is unit normal.
 +
 +
Note that
 +
 +
<center>
 +
<math>
 +
P\{\bar{X} > 17\} = P\{\frac{\bar{X} - 15}{\sqrt{0.75}} > \frac{17 - 15}{\sqrt{0.75}}\} \approx P\{\frac{\bar{X} - 15}{\sqrt{0.75}} > 2.309 \}
 +
</math>
 +
</center>
  
=== Confidence intervals ===
+
We can look at the standard normal table and find out that <math>P\{ 0 \leq Z \leq 2.31\} = 0.48956</math>, for a unit normal random variable ''Z''Thus, the probability
Recall that the random variable <math>\bar{X}</math> is a normal random variable with mean <math>\mu</math> and s.d. <math>\sigma/\sqrt{n}</math> Therefore,
 
  
 
<center>
 
<center>
<math>\sqrt{n}(\bar{X}-\mu)/\sigma</math>
+
<math>
 +
P\{\bar{X} > 17\} \approx 0.5 - 0.48956 = 0.0104,
 +
</math>
 
</center>
 
</center>
  
will be a unit normal random variable.
+
which is roughly 1%.
 +
 
 +
'''Ex2.'''
 +
 
 +
: ''To be added...''
  
We consider how <math>\bar{X}</math> deviates from the true mean <math>\mu</math>.
+
== Why do we use normal distributions? ==
 +
Normal random variables appear very often in our treatment of statistics.  This is not just a coincidence.  See [[probstat/notes/limit theorems|limit theorems]].

รุ่นแก้ไขปัจจุบันเมื่อ 09:41, 5 ธันวาคม 2557

This is part of probstat

Consider a certain distribution. The mean of the distribution is the expected value of a random variable sample from the distribution. I.e.,

.

Also recall that the variance of the distribution is

And finally, the standard deviation is .

Sample Statistics

Suppose that you take samples independently from this distribution. (Note that are random variables.)

Sample means

The statistic

is called a sample mean. Since are random variables, the mean is also a random variable.

We hope that approximates well. We can compute:

and since are independent, we have that

Sample variances and sample standard deviations

We can also use the sample to estimate .

The statistic

is called a sample variance. The sample standard deviation is .

Note that the denominator is instead of .

We can show that .

We note that since and are independent, we have that

.

Let's deal with the middle term here.

Let's work on the third term which ends up being the same as the middle term.

Let's put everything together:

Summary

Sample means:

Sample variance:

Properties of sample means and sample variances

Distribution of sample means

While we know basic properties of sample means , if we want to perform other statistical calculation (i.e., computing confidence intervals or testing hypotheses), it is very useful to know the exact distribution of .

For a general population, it will be hard to deal the the distribution of exactly. However, if the population is normal, we are in a very good shape.

Recall the definition of :

Therefore, is a sum of independent normally distributed random variables. A nice property of normal random variables is that the sum of normally distributed random variables remains a normal random variable. Since a normal random variable is uniquely determined by its mean and variance, we have the following observation.

Distribution of sample means of normal populations.

If the population is normally distributed with mean and variance , the distribution of is normal with mean and variance .

Examples

Ex1. Suppose that the population has mean and variance . If you select a sample of size 20, what is the probability that the sample mean is greater than 17?

Solution:

The sample mean is normal with mean and variance . Therefore,

is unit normal.

Note that

We can look at the standard normal table and find out that , for a unit normal random variable Z. Thus, the probability

which is roughly 1%.

Ex2.

To be added...

Why do we use normal distributions?

Normal random variables appear very often in our treatment of statistics. This is not just a coincidence. See limit theorems.