View
226
Download
1
Embed Size (px)
Citation preview
Statistical Inference Statistical Inference
Lab ThreeLab Three
Bernoulli to Normal Through BinomialBernoulli to Normal Through Binomial
One flip Fair coin
Heads
Tails
Random Variable: k, # of headsp=0.5
1-p=0.5
For n flips, the prob. of k heads is [n!/k!(n-k)!]pk (1-p)n-k
For a sample of size n, the sample proportion of heads is p-hat = k/n, where p-hat is distributed binomially with mean p and variance p*(1-p)/n
For np>=5 n(1-p)>=5, Approximate Distribution of p-hatWith the normal distribution, p-hat~N[p, p*(1-p)/n]
Simulate a random sample of n=50Simulate a random sample of n=50
Simulate Ten Sample ProportionsSimulate Ten Sample Proportions
95% confidence Interval On First 95% confidence Interval On First sample proportion of 0.44sample proportion of 0.44
p
p
p
pervalconfidenceei
pob
pob
pob
nppwhere
ppob
ˆ
ˆ
ˆ
*96.1ˆint%95..
95.0]30.058.0[Pr
95.0]14.044.014.0[Pr
95.0]07071.0*96.1)44.0(07071.0*96.1[Pr
07071.050/5.0*5.0/)1(*
95.0]96.1/)ˆ(96.1[Pr
Distribution of p-hatDistribution of p-hatNormal Approximation to Binomial, n=50, p=0.5
0
1
2
3
4
5
6
0 0.2 0.4 0.6 0.8 1 1.2
sample proportion
den
sity
0.44
95% confidence interval
Around p-hat=0.44
Uniform to the NormalUniform to the Normal
Random variable x is distributed uniformly, on the number line from zero to one
x~U[0.5, 1/12]=U[,2]
density
x0 1
1
Uniform VariableUniform Variable
12/14/13/1)(
4/1)3/()2/1()()()(
])(*2[][)(
*)()()(
2/1)2/(*1*)(*
1)(,10,~
10
31
0
2222
222
0 0
0*
10
1
0
1
0
2
* *
*
xVar
xdxxfxExExxVar
ExxExxEExxExVar
xxdxdxxfxF
xdxxdxxfxEx
xfxUx
x xx
F(x)
x0 1
1
SimulationSimulation
Hypothesis test about population Hypothesis test about population mean from sample mean of 0.45mean from sample mean of 0.45
nnxVarnxVarnxVar
nnnExnxEnxE
nxx
n n
i
n
i
nn
i
n
i
n
i
/)/1()()/1()/1()(
)/1()/1()/1()/1()(
/
2
1 1
222
1
2
111
1
From central limit theorem )/,(~ 2 nNx
Distribution of Sample Mean of a Sample of 50 Random Draws of a Uniformly Distributed Variable
0
2
4
6
8
10
12
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Sample Mean
Den
sity
0.45
Is the sample mean of 0.45 significantly below expected value of 0.5?
)00167.0/,5.0(~ 2 nNx
CDF of Sample of 50 Random Draws from a Uniform Distribution
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1 1.2
Sample Mean
Pro
abab
ility
0.50.45
Hypothesis TestHypothesis Test
5.0:
5.0:0
aH
HStep #1: Formulate hypotheses
Step #2: Choose test statistic
23.10408.0/05.0
)50/29.0/()50.045.0(//()(/)(
x
xx
z
nxxz
Hypothesis TestHypothesis TestStep #3: Formulate probability statement. How low would z have to be to be significant?
Step #4: What level of significance should we choose?For example: 5%, i.e. 95% of time z would be above that value
Density Function for the Standardized Normal Variate
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
0.45
-5 -4 -3 -2 -1 0 1 2 3 4 5
Standard Deviations
Den
sity
2]1/)0[(2/1*]2/1[)( zezf
-1.645
0.050
Hypothesis testHypothesis test
• To be significantly below 0.5, a sample mean of 0.45, which corresponds to a z statistic of -1.23, would have to be even smaller, i.e. a z= -1.645 or even more negative. (The sample mean would have to be 0.421 or less)
• Therefore, accept null that population mean is 0.5
Sample means ordered by increasing size: smallest is 0.424,Not significantly below 0.5