Introduction to Inferential
statistics & Important
Statistical Tests
Dr. Adeel Ahmed Khan
MBBS, FCPS (Community Medicine)
Public Health Specialist
Ministry of Health, KSA
Learning objectives
Concepts of hypothesis testing
Point interval & Confidence intervals
T-tests
Choosing the right test
What is a non-parametric test?
Statistics scenarios
Statistics
Descriptive Inferential
Hypothesis
Estimation
testing
Point
estimates
Interval
estimates (CI)
Hypothesis Testing
Decision making process for evaluating claims about
a population
Researcher must define
Population under study
State particular hypothesis
Give significance level
Select a sample from the population
Collect the data
Calculate statistical test
Conclusion
Methods to test hypothesis
The Traditional method
The Confidence Interval method
The P-value method
Traditional method of Hypothesis
Testing
Statistical hypothesis
Is a assumption about a population parameter, which may be or
may not be correct
Null hypothesis - Ho
States that there is no difference between a parameter and a specific
value
The mean of a population , equals the hypothesized value o
Alternative hypothesis - H1
States the existence of a difference between a parameter and a
specific value
The mean of a population , is not equals the hypothesized value o
Steps to undertaking a Hypothesis test
Define study question
Set null and alternative hypothesis Choose a
suitable
Calculate a test statistic test
Calculate a p-value
Make a decision and interpret
your conclusions
T-tests
Paired or Independent (Unpaired) Data?
T-tests are used to compare two population means
₋ Paired data: same individuals studied at two
different times or under two conditions PAIRED
T-TEST
₋ Independent: data collected from two separate
groups INDEPENDENT SAMPLES T-TEST
Comparison of hours worked in 1988 to
today
Paired or unpaired?
If the same people have reported their hours for 1988 and
2014 have PAIRED measurements of the same variable
(hours)
Paired Null hypothesis: The mean of the paired differences
=0
If different people are used in 1988 and 2014 have
independent measurements
Independent Null hypothesis: The mean hours worked in
1988 is equal to the mean for 2014
H 0 : 1988 2014
SPSS data entry
Paired Data
Independent Groups
Example: Triglycerides
In a weight loss study, Triglyceride levels were
measured at baseline and again after 8 weeks
of taking a new weight loss treatment.
Example: t-Test Results
95% Confidence
Interval of the
Difference
Std. Std. Error
Mean Sig. (2-
Deviation Mean t df
tailed)
Lower Upper
Triglyceride level at
week 8 (mg/dl) -
-11.371 80.360 13.583 -38.976 16.233 -.837 34 .408
Triglyceride level at
baseline (mg/dl)
Null Hypothesis is:
P-value =
Decision (circle correct answer): Reject Null/ Fail to reject
Null
Conclusion:
Example: Solution
95% Confidence
Interval of the
Difference
Std. Std. Error
Mean Sig. (2-
Deviation Mean t df
tailed)
Lower Upper
Triglyceride level at
week 8 (mg/dl) -
-11.371 80.360 13.583 -38.976 16.233 -.837 34 .408
Triglyceride level at
baseline (mg/dl)
As p > 0.05, FAIL to reject the
null
P(t< -0.837) P(t>0.837)
NO evidence of a difference in =0.204 =0.204
the mean triglyceride before
and after treatment
-0.837 0.837
Example: Weight Loss
Weight loss was measured after taking either
a new weight loss treatment or placebo for 8
weeks
Treatment Std.
N Mean
group Deviation
Placebo 19 -1.36 2.148
New drug 18 -5.01 2.722
Example: t-Test Results
Levene's Test
95% CI of the
for Equality of T-test results
Difference
Variances
Sig. Mean Std. Error
F Sig. t df Lower Upper
(2-tailed) Difference Difference
Equal variances
2.328 .136 4.539 35 .000 3.648 .804 2.016 5.280
assumed
Equal variances
4.510 32.342 .000 3.648 .809 2.001 5.295
not assumed
Null Hypothesis is:
P-value =
Decision (circle correct answer): Reject Null/ Fail to reject
Null
Conclusion:
Example 2: Solution
Levene's Test
95% CI of the
for Equality of T-test results
Difference
Variances
Sig. Mean Std. Error
F Sig. t df Lower Upper
(2-tailed) Difference Difference
Equal variances
2.328 .136 4.539 35 .000 3.648 .804 2.016 5.280
assumed
Equal variances
4.510 32.342 .000 3.648 .809 2.001 5.295
not assumed
H0: μnew = μplacebo As p < 0.05, DO reject the null
IS evidence of a difference
P(t< -4.539) P(t>4.539)
in weight loss between Is < 0.001 Is < 0.001
treatment and placebo
-4.539 4.539
Uses of t-test
To compare mean of a single sample to a population mean
or a hypothetical mean
Population standard deviation is unknown
Underlying variable is normally distributed
Paired t-test
Appropriate test to compare means on the same and
related samples over a time or in different situations
Provides a hypothesis test of difference between
population means for a pair of random samples
Can be used as a before –after method or a repeated
measures method
Also called as dependent t-test
Example
An investigator wishes to test the effect of a treatment
on the well-being of depressed individuals; a score that
could range from 0 to 20, higher scores indicate greater
well-being (that is , treatment is having a positive effect).
The scores of nine individuals were recorded
before and after receiving treatment.
Use α=5% to test whether mean scores before and after
receiving treatment is different or not
Example
A diet claims to cause more than a 10 lb weight loss over
a six months period, a researcher designed a test using
16 individuals before and after weight. The samples are
paired by each individual.
Mean (differences) = 10.56
SD (Differences) = 11.56
a) Researcher wants to know is the diet truly delivers
greater than10 lb?
Dependent or independent sample….
A researcher was interested whether treatment A is
better than treatment B for abscess reduction? So he
randomly divided pts. in two groups. Gave treatment A to
first group and B to the other. Size of abscess was obs.
The researcher was interested in effectiveness of a
particular diet in slimming center. So wt of clients before
and after was obs.
Statistics
Descriptive
Estimation
Estimation: the process by which the sample
data is used to indicate the value of an
unknown quantity in the population:
Point estimate
Confidence intervals
Types of estimators
Point estimator gives a single value as an
estimate of the parameter of interest
Interval estimator specifies a range of values
of the parameter and our confidence that the
parameter value is in that range
Confidence Intervals
A range of values within which we are confident (in terms of
probability) that the true value of a pop parameter lies
A 95% CI is interpreted as 95% of the time the CI would
contain the true value of the pop parameter
i.e. 5% of the time the CI would fail to contain the true value
of the pop parameter
Exercise
Discuss what the interpretation is for the confidence interval from
this Example (Weight loss was measured after taking either a new
weight loss treatment or placebo for 8 weeks) highlighted below:
Large-Sample Confidence Interval for
x z
n
2
• where Z/2 is the Z value with an area /2 to its
right
• The parameter is the standard deviation of the
population from which sample is drawn and n is the
sample size.
• When is unknown (most cases) and n is large, the
value of can be approximated by the sample
standard deviation (s).
Two categorical variables
Are boys more likely to prefer maths and science than girls?
Variables:
Favourite subject (Nominal)
Gender (Binary/ Nominal)
Summarise using %’s/ stacked or multiple bar charts
Test: Chi-squared
Tests for a relationship between two categorical variables
Purpose of Chi square test
To present categorical data
Chi-square is used when the data is in
qualitative form (categories) and you want to
find out statistically significant difference
between the two or more categories
E.g. whether pts are normotensive, hypertensive,
hypotensive; male, female; smoker, non-smoker
Basics of a Chi-square test
For a given phenomenon, Chi-square
compares the given (observed) frequencies
with the expected frequencies
Contracted Did not
malaria Contract
malaria Total
Chloroquine 19 587 606
given
Chloroquine 193 2741 2934
not given
212 3328 3540
Example
A researcher is interested in finding out
whether drinking and smoking are dependent
upon each other? Test the hypothesis using α
= 0.05
Smokin None Low Medium Heavy Total
g status
Smoker 1880 2048 194 76 4198
s
Non- 4290 2430 172 37 6929
smoker
s
6170 4478 366 113 11,127
At 5% level of significance, test the
hypothesis that whether the prevalence of
alcohol consumption is differs between
different ethnicities
Ethnicities None Low Medium Heavy Total
Black 411 253 12 5 681
Hispanic 1459 757 53 10 2279
Caucasian 3732 3179 284 90 7285
Other 322 187 10 4 523
Total 5924 4376 359 109 10768
Choosing the right test
Choosing the right test
One of the most common queries in stats support
is ‘Which analysis should I use’
There are several steps to help the student decide
When a student is explaining their project, these
are the questions you need answers for
Choosing the right test
1) A clearly defined research question
2) What is the dependent variable and what type of variable is it?
3) How many independent variables are there and what data
types are they?
4) Are you interested in comparing means or investigating
relationships?
5) Do you have repeated measurements of the same variable for
each subject?
Research question
Clear questions with measurable quantities
Which variables will help answer these
questions
Think about what test is needed before
carrying out a study so that the right type of
variables are collected
Dependent variables
INDEPENDENT DEPENDENT
(explanatory/ (outcome)
affects
predictor) variable
variable
Does attendance have an association with exam
score?
Do women do more housework than men?
What variable type is the dependent?
Dependent
Continuous Categorical
Are boys better at maths?
How can ‘better’ be measured and what type
of variable is it?
Exam score (Scale)
Do boys think they are better at maths??
I consider myself to be good at maths (ordinal)
How many variables are involved?
Two – interested in the relationship
One dependent and one independent
One dependent and several independent variables: some
may be controls
Data types
Research question Dependent/ Independent/
outcome variable explanatory variable
Does attendance have an Exam score (scale) Attendance (Scale)
association with exam score?
Do women do more Hours of Gender (binary)
housework than men? housework per
week (Scale)
Exercise:
How would you investigate the following topics? State the
dependent and independent variables and their variable
types.
Research question Dependent/ Independent/
outcome variable explanatory variable
Were Americans more likely to
survive on board the Titanic?
Does weekly hours of work
influence the amount of time
spent on housework?
Which of 3 diets is best for
losing weight?
Exercise: Solution
How would you investigate the following topics? State the
:dependent and independent variables and their variable
types.
Research question Dependent/ Independent/
outcome variable explanatory variable
Were Americans more likely to Survival (Binary) Nationality (Nominal)
survive on board the Titanic?
Does weekly hours of work Hours of housework Hours of work (Scale)
(Scale)
influence the amount of time
spent on housework?
Which of 3 diets is best for Weight lost on diet Diet (Nominal)
losing weight? (Scale)
Comparing means
Dependent = Scale
Independent = Categorical
How many means are you comparing?
Do you have independent groups or repeated
measurements on each person?
Comparing means
Independent
t-test
2
Comparing BETWEEN
groups
3+
Comparing
means
Comparing
2 Paired t-test
measurements
WITHIN the same
subject
3+
Comparing means
Independent
t-test
2
Comparing BETWEEN
groups One way
3+ ANOVA
Comparing
means
Comparing
2 Paired t-test
measurements
WITHIN the same
subject
3+ Repeated
measures
ANOVA
ANOVA = Analysis of variance
Exercise – Comparing means
Research question Dependent Independent Test
variable variable
Do women do more Housework (hrs Gender
housework than men? per week) (Nominal)
(Scale)
Does Margarine X Cholesterol Occasion
reduce cholesterol? (Scale) (Nominal)
Everyone has
cholesterol measured
on 3 occasions
Which of 3 diets is best Weight lost on Diet
for losing weight? diet (Scale) (Nominal)
Exercise: Solution
Research question Dependent Independent Test
variable variable
Do women do more Housework (hrs Gender Independent t-
housework than men? per week) (Nominal) test
(Scale)
Does Margarine X Cholesterol Occasion Repeated
reduce cholesterol? (Scale) (Nominal) measures ANOVA
Everyone has
cholesterol measured
on 3 occasions
Which of 3 diets is best Weight lost on Diet One-way ANOVA
for losing weight? diet (Scale) (Nominal)
Tests investigating relationships
Investigating Dependent Independent Test
relationships between variable variable
2 categorical variables Categorical Categorical Chi-squared test
2 Scale variables Scale Scale Pearson’s correlation
Parametric or non-parametric?
Statistical tests fall into two types:
Assume data follows a
Parametric tests particular distribution e.g.
normal
Nonparametric techniques
Non-parametric are usually based on ranks/
signs rather than actual data
Parametric tests Non-parametric tests
Statistical tests for Distribution free statistics
population parameters
(means, variance, Used in place of their
proportion) parametric counterparts
when the assumption of
Basic assumption: normality can not be met
population is normally
distributed
Do these look normally distributed?
Do these look normally distributed?
yes
no yes
Non-parameteric tests
Non-Parametric Parametric Alternative
The Sign Test Z test
Wilcoxon rank sum test or Z test, t test (independent
Mann-Whitney U test samples)
t test (dependent samples)
Wilcoxon signed- rank test
ANOVA
Kruskal-Wallis test
Spearman rank correlation
Pearson coefficient
coefficient
Thanks