SlideShare a Scribd company logo
1 of 57
One sample statistical tests,
continued…
Recall: Single population mean
(large n)
 Hypothesis test:
 Confidence Interval
n
s
Z
mean
null
mean
observed 

)
(
*
Z
mean
observed
interval
confidence /2
n
s



Single population mean (small
n, normally distributed trait)
 Hypothesis test:
 Confidence Interval
n
s
Tn
mean
null
mean
observed
1



)
(
*
T
mean
observed
interval
confidence /2
,
1
n
s
n 



What is a T-distribution?
 A t-distribution is like a Z distribution,
except has slightly fatter tails to reflect
the uncertainty added by estimating .
 The bigger the sample size (i.e., the
bigger the sample size used to estimate
), then the closer t becomes to Z.
 If n>100, t approaches Z.
T-distribution with only 1 degree of freedom.
T-distribution with 4 degrees of freedom.
T-distribution with 9 degrees of freedom.
T-distribution with 29 degrees of freedom.
T-distribution with 99 degrees of freedom. Looks a lot like Z!!
Student’s t Distribution
t
0
t (df = 5)
t (df = 13)
t-distributions are bell-
shaped and symmetric, but
have ‘fatter’ tails than the
normal
Standard
Normal
(t with df = )
Note: t Z as n increases
from “Statistics for Managers” Using Microsoft® Excel 4th Edition, Prentice-Hall 2004
Student’s t Table
Upper Tail Area
df .25 .10 .05
1 1.000 3.078 6.314
2 0.817 1.886 2.920
3 0.765 1.638 2.353
t
0 2.920
The body of the table
contains t values, not
probabilities
Let: n = 3
df = n - 1 = 2
 = .10
/2 =.05
/2 = .05
from “Statistics for Managers” Using Microsoft® Excel 4th Edition, Prentice-Hall 2004
t distribution values
With comparison to the Z value
Confidence t t t Z
Level (10 d.f.) (20 d.f.) (30 d.f.) ____
.80 1.372 1.325 1.310 1.28
.90 1.812 1.725 1.697 1.64
.95 2.228 2.086 2.042 1.96
.99 3.169 2.845 2.750 2.58
Note: t Z as n increases
from “Statistics for Managers” Using Microsoft® Excel 4th Edition, Prentice-Hall 2004
The T probability density
function
What does t look like mathematically? (You may at least recognize
some resemblance to the normal distribution function…)
Where:
v is the degrees of freedom
(gamma) is the Gamma function
is the constant Pi (3.14...)
The t-distribution in SAS
Yikes! The t-distribution looks like a mess! Don’t want to
integrate!
Luckily, there are charts and SAS! MUST SPECIFY
DEGREES OF FREEDOM!
The t-function in SAS is:
probt(t-statistic, df)
The normality assumption…
 Ttests (and all linear models, in fact) have a
“normality assumption”:
 If the outcome variable is not normally distributed
and the sample size is small, a ttest is
inappropriate
 it takes longer for the CLT to kick in and the
sample means do not immediately follow a t-
distribution…
 This is the source of the “normality
assumption” of the ttest…
Computer simulation of the distribution
of the sample mean (non-normal,
small n):
1. Pick any probability distribution and specify a mean and standard deviation.
2. Tell the computer to randomly generate 1000 observations from that
probability distributions
E.g., the computer is more likely to spit out values with high probabilities
3. Calculate 1000 T-statistics:
4. Plot the T-statistics in histograms.
5. Repeat for different sample sizes (n’s).
n
S
X
T
x
n 


n=2, underlying distribution is exponential (mean=1, SD=1)
This is NOT a t-distribution!
n=5, underlying distribution is exponential (mean=1, SD=1)
This is NOT a t-distribution!
n=10, underlying distribution is exponential (mean=1, SD=1)
This doesn’t yet follow a t-distribution!
n=30, underlying distribution is exponential (mean=1, SD=1)
Still not quite a t-distribution! Note the
left skew.
n=100, underlying distribution is exponential (mean=1, SD=1)
Now, pretty close to a T-distribution!
Conclusions
 If the underlying data are not normally
distributed AND n is small**, the means do
not follow a t-distribution (so using a ttest
will result in erroneous inferences).
 Data transformation or non-parametric
tests should be used instead.
 **How small is too small? No hard and fast
rule—depends on the true shape of the
underlying distribution. Here N>30 (closer
to 100) is needed.
Practice Problem:
 A manufacturer of light bulbs claims that its light
bulbs have a mean life of 1520 hours with an
unknown standard deviation. A random sample of 40
such bulbs is selected for testing. If the sample
produces a mean value of 1505 hours and a sample
standard deviation of 86, is there sufficient evidence
to claim that the mean life is significantly less than
the manufacturer claimed?
 Assume that light bulb lifetimes are roughly normally
distributed.
Answer
1. What is your null hypothesis?
Null hypothesis: mean life = 1520 hours
Alternative hypothesis: mean life < 1520 hours
2. What is your null distribution?
Since we have to estimate the standard deviation, we need to make inferences from a T-curve with
39 degrees of freedom.
3. Empirical evidence: 1 random sample of 40 has a mean of 1498.3 hours
5. Probably not sufficient evidence to reject the null. We cannot sue the light bulb manufacturer for
false advertising! Notice that using t-distribution to calculate the p-value didn’t change much!
With n>30, might as well use Z table.
)
5
.
13
40
86
s
,
1520
(
~ X
39
40 

t
X
137
.
)
11
.
1
(
11
.
1
5
.
13
1520
1505
39
39









t
P
value
p
t
Practice problem
 You want to estimate the average ages of
kids that ride a particular kid’s ride at
Disneyland. You take a random sample of 8
kids exiting the ride, and find that their ages
are: 2,3,4,5,6,6,7,7. Assume that ages are
roughly normally distributed.
a. Calculate the sample mean.
b. Calculate the sample standard deviation.
c. Calculate the standard error of the mean.
d. Calculate the 99% confidence interval.
Answer (a,b)
a. Calculate the sample mean.
b. Calculate the sample standard deviation.
0
.
5
8
40
8
7
7
6
6
5
4
3
2
8
8
1
8 












i
i
X
X
9
.
1
4
.
3
4
.
3
7
24
7
)
2
(
2
)
1
(
2
0
1
2
3
1
8
)
5
( 2
2
2
2
2
8
1
2
2















X
i
i
X
s
X
s
Answer (c)
c. Calculate the standard error of the mean.
67
.
8
9
.
1



n
s
s X
X
Answer (d)
d. Calculate the 99% confidence interval.
)
35
.
7
,
65
.
2
(
)
50
.
3
(
67
.
0
.
5
)
( 2
/
,


 
df
X t
s
mean
t7,.005=3.5
Example problem, class data:
A two-tailed hypothesis test:
A researcher claims that Stanford affiliates eat
fewer than the recommended intake of 5
fruits and vegetables per week.
We have data to address this claim: 24 people
in the class provided data on their daily fruit
and vegetable intake.
Do we have evidence to dispute her claim?
Histogram fruit and veggie
intake (n=24)…
Mean=3.7 servings
Median=3 servings
Mode=3 servings
Std Dev=1.7 servings
Answer
1. Define your hypotheses (null, alternative)
H0: P(average servings)=5.0
Ha: P(average servings)≠5.0 servings (two-sided)
2. Specify your null distribution
)
34
.
0
24
7
.
1
,
0
.
5
(
~ 23
24 
T
X
Answer, continued
5. Reject or fail to reject (~accept) the null hypothesis
Reject! Stanford affiliates eat significantly fewer than the
recommended servings of fruits and veggies.
T23 critical value
for p<.05, two
tailed = 2.07
3. Do an experiment
observed mean in our experiment = 3.7 servings
4. Calculate the p-value of what you observed
p-value < .05;
8
.
3
34
.
0
5
7
.
3
23 



T
95% Confidence Interval
4
.
4
0
.
3
)
34
.
0
(
*
07
.
2
7
.
3
)
error
standard
(
*
025
,.
23
24




T
X
H0: P(average servings)=5.0
The 95% CI excludes 5, so p-value <.05
Paired data (repeated
measures)
Patient BP Before (diastolic) BP After
1 100 92
2 89 84
3 83 80
4 98 93
5 108 98
6 95 90
What about these
data? How do you
analyze these?
Example problem: paired ttest
Patient Diastolic BP Before D. BP After Change
1 100 92 -8
2 89 84 -5
3 83 80 -3
4 98 93 -5
5 108 98 -10
6 95 90 -5
Null Hypothesis: Average Change = 0
Example problem: paired ttest
Change
-8
-5
-3
-5
-10
-5
6
6
36
6
5
10
5
3
5
8











X
5
.
2
5
32
5
1
16
1
9
1
4
5
...
)
6
3
(
)
6
5
(
)
6
8
( 2
2
2




















x
s
0
.
1
6
5
.
2


x
s
6
0
.
1
0
6
5 




T
With 5 df, T>2.571
corresponds to p<.05
(two-sided test)
Null Hypothesis: Average Change = 0
Example problem: paired ttest
Change
-8
-5
-3
-5
-10
-5
8.571)
-
,
(-3.43
(1.0)
*
2.571
6
-
:
CI
95%


Note: does not include 0.
Summary: Single population
mean (small n, normality)
 Hypothesis test:
 Confidence Interval
n
s
t
x
n
mean
null
mean
observed
1



)
(
*
t
mean
observed
interval
confidence /2
1,
-
n
n
sx



Summary: paired ttest
 Hypothesis test:
 Confidence Interval
n
s
t
d
n
0
d
mean
observed
1



)
(
*
t
d
mean
observed
interval
confidence /2
1,
-
n
n
sd



Where d=change
over time or
difference within
a pair.
Summary: Single population
mean (large n)
 Hypothesis test:
 Confidence Interval
n
s
t
Z
x
n
mean
null
mean
observed
1


 
)
(
*
]
Z
t
[
mean
observed
interval
confidence /2
/2
1,
-
n
n
sx

 


Examples of Sample Statistics:
Single population mean (known )
Single population mean (unknown )
Single population proportion
Difference in means (ttest)
Difference in proportions (Z-test)
Odds ratio/risk ratio
Correlation coefficient
Regression coefficient
…
Recall: normal approximation
to the binomial…
 Statistics for proportions are based on a
normal distribution, because the
binomial can be approximated as
normal if np>5
Recall: stats for proportions
For binomial:
)
1
(
)
1
(
2
p
np
p
np
np
x
x
x








For proportion:
n
p
p
n
p
p
n
p
np
p
p
p
p
)
1
(
)
1
(
)
1
(
ˆ
2
2
ˆ
ˆ










P-hat stands for “sample
proportion.”
Differs by
a factor of
n.
Differs
by a
factor
of n.
Sampling distribution of a
sample proportion
)
)
ˆ
1
(
ˆ
,
(
~
ˆ
n
p
p
p
Normal
p

n
p
p
s
n
p
p
p
p
p
p
)
ˆ
1
(
ˆ
)
1
(
ˆ
ˆ
ˆ







Always a normal
distribution!
p=true population proportion.
BUT… if you knew p you wouldn’t
be doing the experiment!
Practice Problem
A fellow researcher claims that at least 15% of smokers
fail to eat any fruits and vegetables at least 3 days a week.
You find this hard to believe and decide to check the
validity of this statistic by taking a random (representative)
sample of smokers. Do you have sufficient evidence to
reject your colleague’s claim if you discover that 17 of the
200 smokers in your sample eat no fruits and vegetables at
least 3 days a week?
Answer
1. What is your null hypothesis?
Null hypothesis: p=proportion of smokers who skip fruits and veggies frequently
>= .15
Alternative hypothesis: p < .15
2. What is your null distribution?
Var( ) = .15*.85/200 = .00064 SD( ) = .025
~ N (.15, .025)
3. Empirical evidence: 1 random sample: = 17/200 = .085
4. Z = (.085-.15)/.025 = -2.6
p-value = P(Z<-2.6) = .0047
5. Sufficient evidence to reject the claim.
p̂
p̂ p̂
OR, use computer simulation…
 1. Have SAS randomly pick 200 observations
from a binomial distribution with p=.15 (the
null).
 2. Divide the resulting count by 200 to get
the observed sample proportion.
 3. Repeat this 1000 times (or some arbitrarily
large number of times).
 4. Plot the resulting distribution of sample
proportions in a histogram:
How often did we get observed
values of 0.085 or lower when
true p=.15?
Only 4/1000 times!
Emprical p-value=.004
Practice Problem
In Saturday’s newspaper, in a story about poll results from Ohio, the
article said that 625 people in Ohio were sampled and claimed that the
margin of error in the results was 4%. Can you explain where that 4%
margin of error came from?
Answer
...
confidence
95%
represent
should
mean,
the
of
side
either
on
errors
standard
2
on,
distributi
normal
a
on
re
we'
Since,
errors.
standard
2
is
4%
%
2
50
1
250
5
25
5
.
625
5
.
*
5
.
ˆ 




p
S
Paired data proportions test…
 Analogous to paired ttest…
 Also takes on a slightly different form
known as McNemar’s test (we’ll see lots
more on this next term…)
Paired data proportions test…
 1000 subjects were treated with
antidepressants for 6 months and with
placebo for 6 months (order of tx was
randomly assigned)
 Question: do suicide attempts (yes/no)
differ depending on whether a subject is
on antidepressants or on placebo?
Paired data proportions test…
Data:
15 subjects attempted suicide in both conditions (non-
informative)
10 subjects attempted suicide in the antidepressant
condition but not the placebo condition
5 subjects attempted suicide in the placebo condition
but not the antidepressant condition
970 did not attempt suicide in either condition (non-
informative)
Data boils down to 15 observations…
In 10/15 cases (66.6%), antidepressant>placebo.
Paired proportions test…
Single proportions test:
Under the null hypothesis, antidepressants and placebo work
equally well. So,
Ho: among discordant cases, p (antidepressant>placebo) = 0.5
Observed p = .666
05
.
;
29
.
1
15
)
5
)(.
5
(.
5
.
666
.
)
1
)(
(
ˆ
0
0
0






 p
n
p
p
p
p
Z
Not enough evidence to reject the null!
Key one-sample Hypothesis
Tests…
Test for Ho: μ = μ0
Test for Ho: p = po:
n
s
x
t
x
n
0
1




n
p
p
p
p
Z
)
1
)(
(
ˆ
0
0
0



Tn-1 approaches Z
for large n.
** If np (expected
value)<5, use exact
binomial rather than Z
approximation…
Corresponding confidence
intervals…
For a mean:
For a proportion:
n
s
t
x x
n 
  2
/
,
1
n
p
p
Z
p
)
ˆ
1
)(
ˆ
(
ˆ 2
/


 
Tn-1 approaches Z
for large n.
** If np
(expected
value)<5, use
exact binomial
rather than Z
approximation
…
Symbol overload!
 n: Sample size
 Z: Z-statistic (standard normal)
 tdf: T-statistic (t-distribution with df degrees of
freedom)
 p: (“p-hat”): sample proportion
 X: (“X-bar”): sample mean
 s: Sample standard deviation
 p0: Null hypothesis proportion
 0: Null hypothesis mean

More Related Content

Similar to lecture8.ppt

Introduction to the t test
Introduction to the t testIntroduction to the t test
Introduction to the t testSr Edith Bogue
 
Z and t_tests
Z and t_testsZ and t_tests
Z and t_testseducation
 
Point Estimate, Confidence Interval, Hypotesis tests
Point Estimate, Confidence Interval, Hypotesis testsPoint Estimate, Confidence Interval, Hypotesis tests
Point Estimate, Confidence Interval, Hypotesis testsUniversity of Salerno
 
Chapter one on sampling distributions.ppt
Chapter one on sampling distributions.pptChapter one on sampling distributions.ppt
Chapter one on sampling distributions.pptFekaduAman
 
Advanced Statistics Homework Help
Advanced Statistics Homework HelpAdvanced Statistics Homework Help
Advanced Statistics Homework HelpExcel Homework Help
 
continuous probability distributions.ppt
continuous probability distributions.pptcontinuous probability distributions.ppt
continuous probability distributions.pptLLOYDARENAS1
 
Data Analysis (Hypothesis testing, Regression).pptx
Data Analysis (Hypothesis testing, Regression).pptxData Analysis (Hypothesis testing, Regression).pptx
Data Analysis (Hypothesis testing, Regression).pptxprachikamani11
 
C2 st lecture 10 basic statistics and the z test handout
C2 st lecture 10   basic statistics and the z test handoutC2 st lecture 10   basic statistics and the z test handout
C2 st lecture 10 basic statistics and the z test handoutfatima d
 
raghu veera stats.ppt
raghu veera stats.pptraghu veera stats.ppt
raghu veera stats.pptDevarajuBn
 
Estimating population values ppt @ bec doms
Estimating population values ppt @ bec domsEstimating population values ppt @ bec doms
Estimating population values ppt @ bec domsBabasab Patil
 

Similar to lecture8.ppt (20)

Introduction to the t test
Introduction to the t testIntroduction to the t test
Introduction to the t test
 
Talk 3
Talk 3Talk 3
Talk 3
 
Z and t_tests
Z and t_testsZ and t_tests
Z and t_tests
 
Point Estimate, Confidence Interval, Hypotesis tests
Point Estimate, Confidence Interval, Hypotesis testsPoint Estimate, Confidence Interval, Hypotesis tests
Point Estimate, Confidence Interval, Hypotesis tests
 
Advanced Statistics Homework Help
Advanced Statistics Homework HelpAdvanced Statistics Homework Help
Advanced Statistics Homework Help
 
Chapter one on sampling distributions.ppt
Chapter one on sampling distributions.pptChapter one on sampling distributions.ppt
Chapter one on sampling distributions.ppt
 
Resampling methods
Resampling methodsResampling methods
Resampling methods
 
STATISTIC ESTIMATION
STATISTIC ESTIMATIONSTATISTIC ESTIMATION
STATISTIC ESTIMATION
 
Statistics
StatisticsStatistics
Statistics
 
Stat2013
Stat2013Stat2013
Stat2013
 
Stats chapter 9
Stats chapter 9Stats chapter 9
Stats chapter 9
 
Advanced Statistics Homework Help
Advanced Statistics Homework HelpAdvanced Statistics Homework Help
Advanced Statistics Homework Help
 
lecture6.ppt
lecture6.pptlecture6.ppt
lecture6.ppt
 
continuous probability distributions.ppt
continuous probability distributions.pptcontinuous probability distributions.ppt
continuous probability distributions.ppt
 
Data Analysis (Hypothesis testing, Regression).pptx
Data Analysis (Hypothesis testing, Regression).pptxData Analysis (Hypothesis testing, Regression).pptx
Data Analysis (Hypothesis testing, Regression).pptx
 
T test statistics
T test statisticsT test statistics
T test statistics
 
C2 st lecture 10 basic statistics and the z test handout
C2 st lecture 10   basic statistics and the z test handoutC2 st lecture 10   basic statistics and the z test handout
C2 st lecture 10 basic statistics and the z test handout
 
raghu veera stats.ppt
raghu veera stats.pptraghu veera stats.ppt
raghu veera stats.ppt
 
Estimating population values ppt @ bec doms
Estimating population values ppt @ bec domsEstimating population values ppt @ bec doms
Estimating population values ppt @ bec doms
 
Stats chapter 10
Stats chapter 10Stats chapter 10
Stats chapter 10
 

Recently uploaded

Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfSocial Samosa
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Jack DiGiovanna
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Sapana Sha
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxEmmanuel Dauda
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...Florian Roscheck
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceSapana Sha
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改atducpo
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts ServiceSapana Sha
 

Recently uploaded (20)

Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptx
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts Service
 
Call Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort ServiceCall Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort Service
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts Service
 

lecture8.ppt

  • 1. One sample statistical tests, continued…
  • 2. Recall: Single population mean (large n)  Hypothesis test:  Confidence Interval n s Z mean null mean observed   ) ( * Z mean observed interval confidence /2 n s   
  • 3. Single population mean (small n, normally distributed trait)  Hypothesis test:  Confidence Interval n s Tn mean null mean observed 1    ) ( * T mean observed interval confidence /2 , 1 n s n    
  • 4. What is a T-distribution?  A t-distribution is like a Z distribution, except has slightly fatter tails to reflect the uncertainty added by estimating .  The bigger the sample size (i.e., the bigger the sample size used to estimate ), then the closer t becomes to Z.  If n>100, t approaches Z.
  • 5. T-distribution with only 1 degree of freedom.
  • 6. T-distribution with 4 degrees of freedom.
  • 7. T-distribution with 9 degrees of freedom.
  • 8. T-distribution with 29 degrees of freedom.
  • 9. T-distribution with 99 degrees of freedom. Looks a lot like Z!!
  • 10. Student’s t Distribution t 0 t (df = 5) t (df = 13) t-distributions are bell- shaped and symmetric, but have ‘fatter’ tails than the normal Standard Normal (t with df = ) Note: t Z as n increases from “Statistics for Managers” Using Microsoft® Excel 4th Edition, Prentice-Hall 2004
  • 11. Student’s t Table Upper Tail Area df .25 .10 .05 1 1.000 3.078 6.314 2 0.817 1.886 2.920 3 0.765 1.638 2.353 t 0 2.920 The body of the table contains t values, not probabilities Let: n = 3 df = n - 1 = 2  = .10 /2 =.05 /2 = .05 from “Statistics for Managers” Using Microsoft® Excel 4th Edition, Prentice-Hall 2004
  • 12. t distribution values With comparison to the Z value Confidence t t t Z Level (10 d.f.) (20 d.f.) (30 d.f.) ____ .80 1.372 1.325 1.310 1.28 .90 1.812 1.725 1.697 1.64 .95 2.228 2.086 2.042 1.96 .99 3.169 2.845 2.750 2.58 Note: t Z as n increases from “Statistics for Managers” Using Microsoft® Excel 4th Edition, Prentice-Hall 2004
  • 13. The T probability density function What does t look like mathematically? (You may at least recognize some resemblance to the normal distribution function…) Where: v is the degrees of freedom (gamma) is the Gamma function is the constant Pi (3.14...)
  • 14. The t-distribution in SAS Yikes! The t-distribution looks like a mess! Don’t want to integrate! Luckily, there are charts and SAS! MUST SPECIFY DEGREES OF FREEDOM! The t-function in SAS is: probt(t-statistic, df)
  • 15. The normality assumption…  Ttests (and all linear models, in fact) have a “normality assumption”:  If the outcome variable is not normally distributed and the sample size is small, a ttest is inappropriate  it takes longer for the CLT to kick in and the sample means do not immediately follow a t- distribution…  This is the source of the “normality assumption” of the ttest…
  • 16. Computer simulation of the distribution of the sample mean (non-normal, small n): 1. Pick any probability distribution and specify a mean and standard deviation. 2. Tell the computer to randomly generate 1000 observations from that probability distributions E.g., the computer is more likely to spit out values with high probabilities 3. Calculate 1000 T-statistics: 4. Plot the T-statistics in histograms. 5. Repeat for different sample sizes (n’s). n S X T x n   
  • 17. n=2, underlying distribution is exponential (mean=1, SD=1) This is NOT a t-distribution!
  • 18. n=5, underlying distribution is exponential (mean=1, SD=1) This is NOT a t-distribution!
  • 19. n=10, underlying distribution is exponential (mean=1, SD=1) This doesn’t yet follow a t-distribution!
  • 20. n=30, underlying distribution is exponential (mean=1, SD=1) Still not quite a t-distribution! Note the left skew.
  • 21. n=100, underlying distribution is exponential (mean=1, SD=1) Now, pretty close to a T-distribution!
  • 22. Conclusions  If the underlying data are not normally distributed AND n is small**, the means do not follow a t-distribution (so using a ttest will result in erroneous inferences).  Data transformation or non-parametric tests should be used instead.  **How small is too small? No hard and fast rule—depends on the true shape of the underlying distribution. Here N>30 (closer to 100) is needed.
  • 23. Practice Problem:  A manufacturer of light bulbs claims that its light bulbs have a mean life of 1520 hours with an unknown standard deviation. A random sample of 40 such bulbs is selected for testing. If the sample produces a mean value of 1505 hours and a sample standard deviation of 86, is there sufficient evidence to claim that the mean life is significantly less than the manufacturer claimed?  Assume that light bulb lifetimes are roughly normally distributed.
  • 24. Answer 1. What is your null hypothesis? Null hypothesis: mean life = 1520 hours Alternative hypothesis: mean life < 1520 hours 2. What is your null distribution? Since we have to estimate the standard deviation, we need to make inferences from a T-curve with 39 degrees of freedom. 3. Empirical evidence: 1 random sample of 40 has a mean of 1498.3 hours 5. Probably not sufficient evidence to reject the null. We cannot sue the light bulb manufacturer for false advertising! Notice that using t-distribution to calculate the p-value didn’t change much! With n>30, might as well use Z table. ) 5 . 13 40 86 s , 1520 ( ~ X 39 40   t X 137 . ) 11 . 1 ( 11 . 1 5 . 13 1520 1505 39 39          t P value p t
  • 25. Practice problem  You want to estimate the average ages of kids that ride a particular kid’s ride at Disneyland. You take a random sample of 8 kids exiting the ride, and find that their ages are: 2,3,4,5,6,6,7,7. Assume that ages are roughly normally distributed. a. Calculate the sample mean. b. Calculate the sample standard deviation. c. Calculate the standard error of the mean. d. Calculate the 99% confidence interval.
  • 26. Answer (a,b) a. Calculate the sample mean. b. Calculate the sample standard deviation. 0 . 5 8 40 8 7 7 6 6 5 4 3 2 8 8 1 8              i i X X 9 . 1 4 . 3 4 . 3 7 24 7 ) 2 ( 2 ) 1 ( 2 0 1 2 3 1 8 ) 5 ( 2 2 2 2 2 8 1 2 2                X i i X s X s
  • 27. Answer (c) c. Calculate the standard error of the mean. 67 . 8 9 . 1    n s s X X
  • 28. Answer (d) d. Calculate the 99% confidence interval. ) 35 . 7 , 65 . 2 ( ) 50 . 3 ( 67 . 0 . 5 ) ( 2 / ,     df X t s mean t7,.005=3.5
  • 29. Example problem, class data: A two-tailed hypothesis test: A researcher claims that Stanford affiliates eat fewer than the recommended intake of 5 fruits and vegetables per week. We have data to address this claim: 24 people in the class provided data on their daily fruit and vegetable intake. Do we have evidence to dispute her claim?
  • 30. Histogram fruit and veggie intake (n=24)… Mean=3.7 servings Median=3 servings Mode=3 servings Std Dev=1.7 servings
  • 31. Answer 1. Define your hypotheses (null, alternative) H0: P(average servings)=5.0 Ha: P(average servings)≠5.0 servings (two-sided) 2. Specify your null distribution ) 34 . 0 24 7 . 1 , 0 . 5 ( ~ 23 24  T X
  • 32. Answer, continued 5. Reject or fail to reject (~accept) the null hypothesis Reject! Stanford affiliates eat significantly fewer than the recommended servings of fruits and veggies. T23 critical value for p<.05, two tailed = 2.07 3. Do an experiment observed mean in our experiment = 3.7 servings 4. Calculate the p-value of what you observed p-value < .05; 8 . 3 34 . 0 5 7 . 3 23     T
  • 34. Paired data (repeated measures) Patient BP Before (diastolic) BP After 1 100 92 2 89 84 3 83 80 4 98 93 5 108 98 6 95 90 What about these data? How do you analyze these?
  • 35. Example problem: paired ttest Patient Diastolic BP Before D. BP After Change 1 100 92 -8 2 89 84 -5 3 83 80 -3 4 98 93 -5 5 108 98 -10 6 95 90 -5 Null Hypothesis: Average Change = 0
  • 36. Example problem: paired ttest Change -8 -5 -3 -5 -10 -5 6 6 36 6 5 10 5 3 5 8            X 5 . 2 5 32 5 1 16 1 9 1 4 5 ... ) 6 3 ( ) 6 5 ( ) 6 8 ( 2 2 2                     x s 0 . 1 6 5 . 2   x s 6 0 . 1 0 6 5      T With 5 df, T>2.571 corresponds to p<.05 (two-sided test) Null Hypothesis: Average Change = 0
  • 37. Example problem: paired ttest Change -8 -5 -3 -5 -10 -5 8.571) - , (-3.43 (1.0) * 2.571 6 - : CI 95%   Note: does not include 0.
  • 38. Summary: Single population mean (small n, normality)  Hypothesis test:  Confidence Interval n s t x n mean null mean observed 1    ) ( * t mean observed interval confidence /2 1, - n n sx   
  • 39. Summary: paired ttest  Hypothesis test:  Confidence Interval n s t d n 0 d mean observed 1    ) ( * t d mean observed interval confidence /2 1, - n n sd    Where d=change over time or difference within a pair.
  • 40. Summary: Single population mean (large n)  Hypothesis test:  Confidence Interval n s t Z x n mean null mean observed 1     ) ( * ] Z t [ mean observed interval confidence /2 /2 1, - n n sx     
  • 41. Examples of Sample Statistics: Single population mean (known ) Single population mean (unknown ) Single population proportion Difference in means (ttest) Difference in proportions (Z-test) Odds ratio/risk ratio Correlation coefficient Regression coefficient …
  • 42. Recall: normal approximation to the binomial…  Statistics for proportions are based on a normal distribution, because the binomial can be approximated as normal if np>5
  • 43. Recall: stats for proportions For binomial: ) 1 ( ) 1 ( 2 p np p np np x x x         For proportion: n p p n p p n p np p p p p ) 1 ( ) 1 ( ) 1 ( ˆ 2 2 ˆ ˆ           P-hat stands for “sample proportion.” Differs by a factor of n. Differs by a factor of n.
  • 44. Sampling distribution of a sample proportion ) ) ˆ 1 ( ˆ , ( ~ ˆ n p p p Normal p  n p p s n p p p p p p ) ˆ 1 ( ˆ ) 1 ( ˆ ˆ ˆ        Always a normal distribution! p=true population proportion. BUT… if you knew p you wouldn’t be doing the experiment!
  • 45. Practice Problem A fellow researcher claims that at least 15% of smokers fail to eat any fruits and vegetables at least 3 days a week. You find this hard to believe and decide to check the validity of this statistic by taking a random (representative) sample of smokers. Do you have sufficient evidence to reject your colleague’s claim if you discover that 17 of the 200 smokers in your sample eat no fruits and vegetables at least 3 days a week?
  • 46. Answer 1. What is your null hypothesis? Null hypothesis: p=proportion of smokers who skip fruits and veggies frequently >= .15 Alternative hypothesis: p < .15 2. What is your null distribution? Var( ) = .15*.85/200 = .00064 SD( ) = .025 ~ N (.15, .025) 3. Empirical evidence: 1 random sample: = 17/200 = .085 4. Z = (.085-.15)/.025 = -2.6 p-value = P(Z<-2.6) = .0047 5. Sufficient evidence to reject the claim. p̂ p̂ p̂
  • 47. OR, use computer simulation…  1. Have SAS randomly pick 200 observations from a binomial distribution with p=.15 (the null).  2. Divide the resulting count by 200 to get the observed sample proportion.  3. Repeat this 1000 times (or some arbitrarily large number of times).  4. Plot the resulting distribution of sample proportions in a histogram:
  • 48. How often did we get observed values of 0.085 or lower when true p=.15? Only 4/1000 times! Emprical p-value=.004
  • 49. Practice Problem In Saturday’s newspaper, in a story about poll results from Ohio, the article said that 625 people in Ohio were sampled and claimed that the margin of error in the results was 4%. Can you explain where that 4% margin of error came from?
  • 51. Paired data proportions test…  Analogous to paired ttest…  Also takes on a slightly different form known as McNemar’s test (we’ll see lots more on this next term…)
  • 52. Paired data proportions test…  1000 subjects were treated with antidepressants for 6 months and with placebo for 6 months (order of tx was randomly assigned)  Question: do suicide attempts (yes/no) differ depending on whether a subject is on antidepressants or on placebo?
  • 53. Paired data proportions test… Data: 15 subjects attempted suicide in both conditions (non- informative) 10 subjects attempted suicide in the antidepressant condition but not the placebo condition 5 subjects attempted suicide in the placebo condition but not the antidepressant condition 970 did not attempt suicide in either condition (non- informative) Data boils down to 15 observations… In 10/15 cases (66.6%), antidepressant>placebo.
  • 54. Paired proportions test… Single proportions test: Under the null hypothesis, antidepressants and placebo work equally well. So, Ho: among discordant cases, p (antidepressant>placebo) = 0.5 Observed p = .666 05 . ; 29 . 1 15 ) 5 )(. 5 (. 5 . 666 . ) 1 )( ( ˆ 0 0 0        p n p p p p Z Not enough evidence to reject the null!
  • 55. Key one-sample Hypothesis Tests… Test for Ho: μ = μ0 Test for Ho: p = po: n s x t x n 0 1     n p p p p Z ) 1 )( ( ˆ 0 0 0    Tn-1 approaches Z for large n. ** If np (expected value)<5, use exact binomial rather than Z approximation…
  • 56. Corresponding confidence intervals… For a mean: For a proportion: n s t x x n    2 / , 1 n p p Z p ) ˆ 1 )( ˆ ( ˆ 2 /     Tn-1 approaches Z for large n. ** If np (expected value)<5, use exact binomial rather than Z approximation …
  • 57. Symbol overload!  n: Sample size  Z: Z-statistic (standard normal)  tdf: T-statistic (t-distribution with df degrees of freedom)  p: (“p-hat”): sample proportion  X: (“X-bar”): sample mean  s: Sample standard deviation  p0: Null hypothesis proportion  0: Null hypothesis mean