You are on page 1of 61

Statistics

A branch of mathematics concerned with collection,


classification, analysis, and interpretation of numerical
facts, for drawing inferences on the basis of their
quantifiable likelihood (probability). The data are
represented by means of graphs and tables.
Types of Variables
1. Independent and Dependent variables

Independent variable is sometimes called


an experimental or predictor variable. It is a variable
that is being manipulated in an experiment in order to
observe the effect on a dependent variable,
sometimes called an outcome variable. The
dependent variable is simply a variable that is
dependent on an independent variable(s).

2. Categorical and Continuous Variables


Categorical variables are also known as discrete or
qualitative variables. Categorical variables can be
further categorized as either nominal or ordinal
o Nominal variables are variables that have two or more
categories, but which do not have an intrinsic order. For
example, a types of dwellings can be categorized into
owned, rented or squatting.
Another Ex. gender, which can be categorized as
either "male" or "female".
o Ordinal variables are variables that have two or more
categories just like nominal variables only the
categories can also be ordered or ranked. Examples
are possible answers using likert scale. Scale of 1 – 5
where 5 is the most positive and 1 the most negative
description.

 Intervening variable - a variable that is used to explain


the relationship between variables.

 Moderating variable - changes the strength of an effect


between independent and dependent variables. For
example, psychotherapy may reduce stress levels for
women more than men, so sex moderates the effect
between psychotherapy and stress levels.

SAMPLING METHODS
Sampling is concerned with the selection of a subset of
individuals from within a statistical population to estimate
characteristics of the whole population. Two advantages of
sampling are that the cost is lower and data collection is
faster than measuring the entire population.
The sampling process comprises several stages:
 Defining the population of concern
 Determining the sample size
 Implementing the sampling plan

 Sampling and data collecting

Probability sampling includes: Simple Random


Sampling, Systematic Sampling, Stratified Sampling,
Probability and Cluster or Multistage Sampling. These
various ways of probability sampling have two things in
common:
1. Every element has a known nonzero probability of
being sampled and
2. involves random selection at some point.

Probability methods
This is the best overall group of methods to use and can
subsequently use the most powerful statistical analyses
on the results.

Method Best when


Simple random sampling Whole population is available.
Stratified There are specific sub-groups
sampling (random within to investigate (eg. demographic
target groups) groupings).
Systematic When a stream of
sampling (every nth representative people are
person) available (eg. in the street).
Cluster sampling (all in When population groups are
limited groups) separated and access to all is
difficult, eg. in many distant
cities.

Nonprobability sampling

Nonprobability sampling is any sampling method where


some elements of the population have no chance of
selection (these are sometimes referred to as 'out of
coverage'/'undercovered'), or where the probability of
selection can't be accurately determined. It involves the
selection of elements based on assumptions regarding the
population of interest, which forms the criteria for
selection.
Quota methods
For a particular analysis and valid results, you can
determine the number of people you need to sample.
In particular when you are studying a number of groups
and when sub-groups are small, then you will need
equivalent numbers to enable equivalent analysis and
conclusions.
Method Best when
You have access to a wide
Quota sampling (get only
population, including sub-
as many as you need)
groups
You know the population
Proportionate quota distribution across groups,
sampling (in proportion to and when normal sampling
population sub-groups) may not give enough in
minority groups
There is likely to a wide
Non-proportionate quota
variation in the studied
sampling (minimum number
characteristic within minority
from each sub-group)
groups
Selective methods
Sometimes your study leads to target particular groups.

Method Best when


Purposive sampling (based You are studying particular
on intent) groups
Expert sampling (seeking
You want expert opinion
'experts')
Snowball sampling (ask for You seek similar subjects
recommendations) (eg. young drinkers)
When sought 'typical' opinion
Modal instance
may get lost in a wider study,
sampling (focus on 'typical'
and when you are able to
people)
identify the 'typical' group
You are specifically seeking
Diversity
differences, eg. to identify
sampling (deliberately
sub-groups or potential
seeking variation)
conflicts

Convenience methods
Good sampling is time-consuming and expensive. Not all
experimenters have the time or funds to use more
accurate methods. There is a price, of course, in the
potential limited validity of results.
Descriptive and Inferential Statistics
When analysing data, such as the marks achieved by 100
students for a piece of coursework, it is possible to use both
descriptive and inferential statistics in your analysis of their
marks. Typically, in most research conducted on groups of
people, you will use both descriptive and inferential
statistics to analyse your results and draw conclusions.

Descriptive Statistics
Descriptive statistics is the term given to the analysis of data
that helps describe, show or summarize data in a
meaningful way such that, for example, patterns might
emerge from the data. Descriptive statistics do not,
however, allow us to make conclusions beyond the data we
have analysed or reach conclusions regarding any
hypotheses we might have made. They are simply a way to
describe our data.
Descriptive statistics are very important because if we
simply presented our raw data it would be hard to visualize
what the data was showing, especially if there was a lot of
it. Descriptive statistics therefore enables us to present the
data in a more meaningful way, which allows simpler
interpretation of the data. For example, if we had the results
of 100 pieces of students' coursework, we may be
interested in the overall performance of those students. We
would also be interested in the distribution or spread of the
marks. Descriptive statistics allow us to do this. How to
properly describe data through statistics and graphs is an
important topic and discussed in other Laerd Statistics
guides. Typically, there are two general types of statistic
that are used to describe data:
o Measures of central tendency: these are ways of
describing the central position of a frequency
distribution for a group of data. In this case, the
frequency distribution is simply the distribution and
pattern of marks scored by the 100 students from the
lowest to the highest. We can describe this central
position using a number of statistics, including the
mode, median, and mean. You can read about
measures of central tendency here.

o Measures of spread: these are ways of summarizing


a group of data by describing how spread out the
scores are. For example, the mean score of our 100
students may be 65 out of 100. However, not all
students will have scored 65 marks. Rather, their
scores will be spread out. Some will be lower and
others higher. Measures of spread help us to
summarize how spread out these scores are. To
describe this spread, a number of statistics are
available to us, including the range, quartiles, absolute
deviation, variance and standard deviation.
o Measures of Variability
The most common measures of variability:
Range - the difference between the lowest and
highest values.
Example: In {4, 6, 9, 3, 7} the lowest value is
3, and the highest is 9.
Variance is a measurement of the spread
between numbers in a data set. It is calculated by
taking the differences between each number in the set
and the mean, squaring the differences (to make them
positive) and dividing the sum of the squares by the
number of values in the set.

Standard deviation. –

Standard deviation is the measure of spread most


commonly used in statistical practice when the mean is
used to calculate central tendency. Thus, it measures
spread around the mean. Because of its close links with the
mean, standard deviation can be greatly affected if the
mean gives a poor measure of central tendency.
Standard deviation is also influenced by outliers one
value could contribute largely to the results of the standard
deviation. In that sense, the standard deviation is a good
indicator of the presence of outliers. This makes standard
deviation a very useful measure of spread for symmetrical
distributions with no outliers.
Standard deviation is also useful when comparing the
spread of two separate data sets that have approximately
the same mean. The data set with the smaller standard
deviation has a narrower spread of measurements around
the mean and therefore usually has comparatively fewer
high or low values. An item selected at random from a data
set whose standard deviation is low has a better chance of
being close to the mean than an item from a data set whose
standard deviation is higher.
Generally, the more widely spread the values are, the
larger the standard deviation is. For example, imagine that
we have to separate two different sets of exam results from
a class of 30 students the first exam has marks ranging
from 31% to 98%, the other ranges from 82% to 93%. Given
these ranges, the standard deviation would be larger for the
results of the first exam.

When we use descriptive statistics it is useful to summarize


our group of data using a combination of tabulated
description (i.e., tables), graphical description (i.e., graphs
and charts) and statistical commentary (i.e., a discussion of
the result
Descriptive statistics provide information about our
immediate group of data. For example, we could calculate
the mean and standard deviation of the exam marks for the
100 students and this could provide valuable information
about this group of 100 students. Any group of data like this,
which includes all the data you are interested in, is called
a population. A population can be small or large, as long
as it includes all the data you are interested in. For example,
if you were only interested in the exam marks of 100
students, the 100 students would represent your
population. Descriptive statistics are applied to populations,
and the properties of populations, like the mean or standard
deviation, are called parameters as they represent the
whole population (i.e., everybody you are interested in).

Most data fall into one of two groups: numerical or


categorical.
 Numerical data. These data have meaning as a
measurement, such as a person’s height, weight, IQ,
or blood pressure; or they’re a count, such as the
number of stock shares a person owns, how many
teeth a dog has, or how many pages you can read of
your favorite book before you fall asleep. (Statisticians
also call numerical data quantitative data.)
Numerical data can be further broken into two types:
discrete and continuous.
o Discrete data represent items that can be counted;
they take on possible values that can be listed out
and cannot be divided.
Example:

 Number of children in a household


 Number of languages a person speaks
 Number of people sleeping in stats class
o

o Continuous data represent measurements; their


possible values cannot be counted and can only
be described using intervals on the real number
line from zero to infinity.
o Example:
 Height of children
 Weight of cars
 Time to wake up in the morning
 Speed of train
Photo By: rocksee

INFERENTIAL STATISTICS
Parametric Statistics
Parametric tests are tests applied to data
that are normally distributed, the levels of
measurement of which are expressed in interval
and ratio.
Examples:

t-test for Independent Samples

t-test for Correlated Sample

Z-test for Two Sample Means

F-test (ANOVA)

r (Pearson Product Moment Coefficient
of Correlation)
 Multiple Regression Analysis
When to use parametric tests -
1.When the distribution is normal
The normal distribution is a symmetric distribution
with no skew. The tails are exactly the same. A left-
skewed distribution has a long left tail. Left-skewed distributions
are also called negatively-skewed distributions.

When the data are expressed in interval


and ratio data
Interval data provide numbers that
reflect differences among items. They have
no true zero value. Ex. scores of intelligence
test, and time as reckoned from the
calendar

Interval scales are numeric scales in which we


know not only the order, but also the exact
differences between the values. The classic
example of an interval scale
is Celsius temperature because the difference
between each value is the same. For example,
the difference between 60 and 50 degrees is a
measurable 10 degrees, as is the difference between
80 and 70 degrees. Time is another good example of
an interval scale in which the increments are known,
consistent, and measurable.

Ratio data are the highest type of scale. The basic


difference between the interval and the ratio scale is
that the interval scale has no true zero scale value
while ratio scale has an absolute zero value. Ratio
scale tell us about the order, exact value between
units-which allows for a wide range of both descriptive
and inferential statistics to be applied. Ex. measures of
length, width, weight and others.

t-test for independent samples

the t-test is a test of difference between


two independent groups. The means are
compared X1 against X2.
When do we use the t-test for independent
samples
 When we compare the means of two
independent groups
 When the sample is less than 30
 When data are normally distributed
 When data are expressed in interval and
ratio
The formula used to calculate the t-test is,

X1 – X2
t = SS1 + SS2 1 + 1
n1 + n2 -2 n1 n2

X1 = mean of group 1
X2 = mean of group 2
SS1 = sum of squares of group 1
SS2 = sum of squares of group 2
n1 = number of observations in group 1
n2 = number of observations in group 2

SS1 = ∑x12 - (∑x1)2


n1
SS2 = ∑x2 (∑x2)2
2-

n2
Ex. Problem: Is there a significant difference between
the performance of the male and the
female students in spelling?

Hypothesis:
Ho: There is no significant difference between the
performance of the male and female
students in spelling

Ho: X1 = X2
H1: X1 ≠X2

Male Female
14 12
18 9
17 11
16 5
4 10
14 3
12 7
10 2
9 6
17 13

Solution:

Male Female
X1 X12 X2 X 22
14 196 12 144
18 324 9 81
17 289 11 121
16 256 5 25
4 16 10 100
14 196 3 9
12 144 7 49
10 100 2 4
9 81 6 36
17 289 13 169
∑x1 = 131 ∑x12 = 1891 ∑x2 =78 ∑x22 = 738
n1 = 10 n2 = 10
x1 = 13.1 x2 = 7.8

SS1 = 1891 - (131)2


10
1891 – 1716.1
174.9
SS2 = 738 - (78)2
10
738 – 608.4
129.6

13.1 – 7.8
174.9+129.6 1 + 1
10 +10-2 10 10

= 2.88
How to solve t-test for independent samples using
Microsoft Office Excel

Step 1. Enter the data in the first 2 columns


Step 2. Click Tools on the Menu Bar and select Data
Analysis
Step 3. The Data Analysis dialogue box appears
Select t-test: Two-Sample Assuming Equal
Variances and click OK
Step 4. Enter the values of the Variable Range 1 and
Variable Range 2
Enter the level of significance of 0.05
Step 5. On the output option select output range.
Click anywhere in the blank worksheet and
click OK.

If the t-computed value is greater than the t-tabular


value reject null hypothesis
If the p-value is lower than the level of significance
reject null hypothesis
Ex. Two groups of experimental rats were injected
with tranquilizer at 1.0 mg and 1.5 mg dose
respectively. The time given in seconds that took them
to fall asleep is hereby given. Test the null hypothesis
that the difference in dosage has no effect on the
length of time it took them to fall asleep at .05 level

X1(1.0mg) X2 (1.5mg)
9.8 12
13.2 7.4
11.2 9.8
9.5 11.5
13 13
12.1 12.5
9.8 9.8
12.3 10.5
7.9 13.5
10.2
9.7
t-test for correlated samples

This is applied when the mean before and after are


being compared.
It is used to find out if a difference exists between the
before and after means. If there is a difference in
favor of the posttest then the treatment or
intervention is effective. However, if there is no
significant difference then the treatment is not
effective.

Formula:

where: ∑d = the mean difference between the pretest and


N posttest.
N = sample size

∑ d2= the sum of squares of the difference


between pre test and post test

Example: An experimental study was conducted on


the effect of programmed materials in English on the
performance of 20 selected college students. Before
the program was implemented, the pretest was
administered and after 5 months the same instrument
was used to get the posttest result. Test at .05 level of
significance
Problem: Is there a significant difference between the
students’ pretest and posttest score on the use of the
programmed materials in English?
Ho : There is no significant difference between the
petest and posttest or the se of the programmed
materials did not affect the students performance in
English.
H1: The posttest result is higher than the pretest result
Pretest Posttest
X1 X2 D D2
20 25 -5 25
30 35 -5 25
10 25 -15 225
15 25 -10 100
20 20 0 0
10 20 -10 100
18 22 -4 16
14 20 -6 36
15 20 -5 25
20 15 5 25
18 30 -12 144
15 10 5 25
15 16 -1 1
20 25 -5 25
18 10 8 64
40 45 -5 25
10 15 -5 25
10 10 0 0
12 18 -6 36
20 25 -5 25
∑D = -81 ∑D2 = 947
D = -81
20
= -4.05
For df = n-1, 20-1 =19

Using MS Office Excel program


1. Enter the data for pretest and posttest variance
2. Select t-test: Paired Two –Sample for Means

Z-test for two-sample mean test


 Used to compare the means of two independent groups
of samples drawn from the normal population, if there
are more than 30 samples for every group.

 Used to find out if there are significant difference


between the population s by only comparing the
sample mean of the population

Formula:
Z= X 1 - X2
S12 + S22
n1 n2

X1 = mean of sample 1
X2 = mean sample 2
S12 = variance of sample 1
S22 = variance of sample 2
n1 = size of sample 1
n2 = size of sample 2
Example:
An admission test was
administered to incoming freshmen in
the colleges of nursing and
Veterinary Medicine with 50 students
each college randomly selected
X1 X2
90 90 85 83
87 89 87 85
88 90 85 88
86 87 85 86
89 88 85 84
90 90 85 88
89 87 84 86
87 86 86 84
90 87 85 83
90 85 87 85
90 86 88 86
89 90 85 85
88 90 85 85
87 86 88 85
90 89 88 84
90 89 87 85
87 90 85 85
88 89 86 87
89 87 84 85
90 85 84 87
87 87 86 85
88 90 86 84
90 85 85 86
86 89 85 87
88 90 86 84

Microsoft office Excel


1. Enter the data
2. Select tools and click data analysis
3. Select z-test: two sample for mean

Table
Level of significance
test .01 .05
One-tailed +2.33 +1.645
Two-tailed + 2.575 +1.96

CORRELATION COEFFICIENT R
In statistics, the correlation coefficient r measures the strength and
direction of a linear relationship between two variables on
a scatterplot. The value of r is always between +1 and –1. To
interpret its value, see which of the following values your
correlation r is closest to:

 Exactly –1. A perfect downhill (negative) linear relationship

 –0.70. A strong downhill (negative) linear relationship

 –0.50. A moderate downhill (negative) relationship

 –0.30. A weak downhill (negative) linear relationship

 0. No linear relationship

 +0.30. A weak uphill (positive) linear relationship

 +0.50. A moderate uphill (positive) relationship

 +0.70. A strong uphill (positive) linear relationship

 Exactly +1. A perfect uphill (positive) linear relationship

The scatterplot indicates if linear relationship exists.


Scatterplots with correlations of a) +1.00; b) –0.50; c) +0.85; and d) +0.15.

The above figure shows examples of what various correlations look


like, in terms of the strength and direction of the relationship. Figure
(a) shows a correlation of nearly +1, . If the trend of the line graph is
going upward, the value of r is positive. This indicates that if the
value of x axis increases the value of y also increases.

Figure (b) shows a correlation of –0.50,. If the trend of the line


graph is going downward, the value of r is negative. It indicates that
as the value of x increases the corresponding value of y decreases, x
and y being nrgatively correlated.
Figure (c) shows a correlation of +0.85.

Figure (d) shows a correlation of +0.15.

Comparing Figures (a) and (c), Figure (a) is nearly a perfect


uphill straight line, and Figure (c) shows a very strong uphill linear
pattern (but not as strong as Figure (a)). Figure (b) is going downhill
but the points are somewhat scattered in a wider band, showing a
linear relationship is present, but not as strong as in Figures (a) and
(c). Figure (d) doesn’t show much of anything happening its
correlation is very close to 0.

Pearson r is used to analyze if a relationship exists between two


variables, x and y. If there is a relationship that exists, then the extent
that of x influences y can be determined by means of the coefficient of
determination which is equal to the square of r and multiplied by
100%.

Formula:
Step one: Make a chart with your data for two variables, labeling the
variables (x) and (y), and add three more columns labeled (xy), (x^2),
and (y^2). A simple data chart might look like this:

Person Age (x) Score (y) (xy) (x2) (y2)

3
Step two: Complete the chart using basic multiplication of the variable
values.

Person Age (x) Score (y) (xy) (x2) (y2)

1 20 30 600 400 900

2 24 20 480 576 400

3 17 27 459 289 729

Step three: After you have multiplied all the values to complete the
chart, add up all of the columns from top to bottom.

Person Age (x) Score (y) (xy) (x2) (y2)

1 20 30 600 400 900

2 24 20 480 576 400

3 17 27 459 289 729

Total 61 77 1539 1265 2029

Step four: Use this formula to find the Pearson correlation


coefficient value.
Step five: Once you complete the formula above by plugging in
all the correct values, the result is your coefficient value! If the
value is a negative number, then there is a negative correlation
of relationship strength, and if the value is a positive number,
then there is a positive correlation of relationship strength. The
ideal sample size to calculate a Pearson correlation coefficient
should be more than ten people
Pearson correlation coefficient will be complete with the
test of statistical significance. When conducting statistical tests,
statistical significance must be present in order to establish a
probability of the results without error.

F-test
Another parametric test used to compare the means of two
or more groups of independent samples. It is also known as
Analysis of Variance (ANOVA). This is used in comparing the
means of two or more independent groups. Data to be analyzed
are normal and expressed in interval and ratio .
Kinds of ANOVA:
 One-way analysis – only one variable is involved
 Two-way analysis of variance – two variables are
Involved (column and row variables) also used in
looking at intera – used to know if there are
significant differences between and among
columns and rows and ) also used in looking at
interaction effect between the variables being
analyzed.
Steps in computing F-test
1. Compute the CF,

CF = (GT)2
N
2. TSS – total sum of squares minus the CF, or the correction
factor
TSS = ∑x2 – CF or ∑x12 + ∑x22 + ∑x32 + ∑x42 + … -CF
3. BSS – between sum of squares minus the CF or correction
factor
BSS = (∑x1)2 + (∑x2)2 + (∑x3)2 + ((∑x4)2… -CF
n1 n2 n3 n4
4. WSS – within sum of squares
WSS = TSS – BSS

5. MSB – mean squares between


MSB = BSS/df
df = total number of groups minus 1
6. MSW – mean squares within
MSW = WSS/df
df = total df – between groups df
total df = total number of observations minus 1
7. F-computed value = MSB/MSW
8. The F-computed value must be compared with the F-
tabular value at a given level of significance with the
corresponding df’s of BSS and WSS
9. If the computed value is greater than F-tabular value,
disconfirm the null hypothesis. This means that there is a
significant difference between and among the means of
different groups.
Example: In a learning experiment, 4 groups of students
made the following numbers of correct responses in a series
of 10 trials. Determine if the groups differed significantly in
their performance. Test at .05 level of significance.
Trial X1 X1 2 X2 X22 X3 X32 X4 X42
1 8 64 7 49 3 9 2 4
2 6 36 7 49 4 16 8 64
3 10 100 10 100 5 25 8 64
4 12 144 10 100 6 36 8 64
5 11 121 12 144 6 36 7 49
6 13 169 12 144 5 25 7 49
7 10 100 13 169 4 16 5 25
8 8 64 14 196 3 9 6 36
9 6 36 15 225 2 4 4 16
10 10 100 10 100 4 16 2 4
∑X1 ∑X12 ∑X2 ∑X22 ∑X3 ∑X32 ∑X4 ∑X42
94 934 110 1276 42 192 57 375
GT = ∑X1 + ∑X2 + ∑X3 + ∑X4 (94 + 110 + 42 + 57) = 303
CF = (303)2 / 40 = 91809/40 = 2295.225
TSS = ∑X12 + ∑X22 + ∑X32 + ∑X42 - CF
= (934 + 1276 + 192 + 375) - 2295.225
= 2777 – 2295.225
481.775
BSS = (∑X1)2 + (∑X2)2 + (∑X3)2 + (∑X4)2 – CF
n1 n2 n3 n4
(883.6 + 1210 + 176.4 + 324.9) – 2295.225
2594.9 – 2295.225
299.675
WSS = TSS – BSS
481.775 – 299.675
182.1
BMS = BSS/df = 299.675/3 = 99.89
WMS = WSS/df = 182.1/36 = 5.06
F computed = BMS/WMS = 99.89/5.06 = 19.74

How to solve for the F-test one-way ANOVA using MS Office


Excel
1. Enter the data
2. On the menu Bar, select Tools. In the drop down menu,
click Data Analysis
3. In the Data Analysis dialogue box select Anova: Single
Factor. Click Ok.
4. In the Anova:Single Factor dialogue box, enter the values
for Input Range (column A, B & C). select Columns in the
Grouped by option. Type 0.05 for Alpha.
5. In the output range options, select output range and click
on any blank part of the worksheet and click Ok.
Problem: The following data represent the operating
time in hours of the the 3 types of scientific pocket
calculators before a recharge is required. Determine the
difference in the operating time of the three calculators.
Test at .05 level of significance.
Brand
FX1 FX2 FX3
4.9 6.4 4.8
5.3 6.8 5.4
4.6 5.6 6.7
6.1 6.5 7.9
4.3 6.3 6.2
6.9 6.7 5.3
5.3 5.9
4.1
4.3

F-test two-way ANOVA


-Involves two variables, the column and the row variables
Example: Forty-five language students were randomly
assigned to one of three instructors and to one of the three
methods of teaching.
TEACHER FACTOR (column)
A B C
Method of 40 50 40 130
Teaching 1
41 50 41 132
(row)
40 48 40 128

39 48 38 125
38 45 38 121
Total 198 241 197 ∑=636
Method of 40 45 50 135
Teaching 2
41 42 46 129
39 42 43 124
38 41 43 122
38 40 42 120
Total 196 210 224 ∑=630
Method of 40 40 40 120
Teaching 3
43 45 41 129
41 44 41 126
39 44 39 122
38 43 38 119
Total 201 216 199 ∑=616
Grand Total 595 667 620 = 1,882
CF = (1882)2/45 = 78709.42
SSt = 402 + 412 + … + 392 + 382 – CF
= 79218 – 78709.42
508.58
SSr = (130)2 + (132)2 + (128)2 + ….(122)2 + (119)2-CF
3 3 3 3 3
78820.67 – 78709.42 = 111.25
SSc = (595)2 + ( 667 )2 + (620)2 - CF
15
= 78887.6 – 78709.42
178.18
SSw = SSt – (SSr + SSc) = 508.58 – (111.25 + 178.18)
219.15
df t = 45-1 =44
dfr = 15-1 =14
dfc =3-1 = 2
dfw = 44- (14+2) = 28

MSc = SSc/dfc = 178.18/2 = 89.09


MSr = SSr/dfr = 111.25/14 = 7.95
MSw = SSw/dfw = 219.15/28 = 7.83
F computed c = 89.09/7.83 = 11.37
F computed r = 7.95/7.83 = 1.015
F Tabular c = 2/28 = 3.3404
F tabular r = 14/28 = 2.0635
Interpretation: F computed › F tabular –significant
F compted ‹F tabular – not significant
Excel
Enter data
Data analysis
Anova: Two-factor without replication

F-test two-way ANOVA with interaction

CF = (1882)2/45 = 78709.42
SSt = 402 + 412 + … + 392 + 382 – CF
= 79218 – 78709.42
508.58

SSw = 79218 – (198)2 + (196)2 + (201)2 + (241)2 +


5 5 5 5
(210)2 + (216)2 + (197)2 + (224)2 +
5 5 5 5
(199)2
5
= 79218 – 79088.8
= 129.2
SSc = (595)2 + ( 667 )2 + (620)2 - CF
15
= 78887.6 – 78709.42
178.18
SSr = (636)2 + (630)2 + (616)2
15
78723.47 – 78709.42
14.05
SS c. r = SSt – SSw – SSc – SSr
508.58 – 129.2 - 178.18 - 14.05
187.15
degrees of freedom
dft = N-1 = 45-1 = 44
dfw = k(n-1) = 9(5-1) = 9(4) = 36 or dft – dfc-dfr-df c.r
dfc = (c-1) = (3-1) = 2
dfr = (r-1) = (3-1) = 2
df c.r = (c-1)(r-1) = (3-1)(3-1) = (2)(2) = 4
ANOVA Table
Sources F-Value
SS df MS Computed tabular Interpretation

Between 178.18 2 89.09 24.82 3.26 S


Columns
Rows
14.05 2 7.02 1.95 3.26 NS
Interaction
187.15 4 46.79 13.03 2.63 S
Within
129.20 36 3.59

Total 508.58 44

F-value computed:
Columns = MSc = 89.09 = 24.82
MSw 3.59
Row = MSr = 7.02 = 1.96
MSw 3.59
Interaction = MSI = 46.79 = 13.03
MSw 3.59
F-tabular at .05
Columns df = 2/36 =3.26
Row df = 2/36 = 3.26
Interaction df = 4/36 = 2.63

Problem: 1. Is there a significant difference in the


performance of the students under the
three different teachers?

2.Is there a significant difference in the


performance of the students under the
three different methods of teaching?
3.Is there an interaction effect between
teacher and the method of teaching factors?

NONPARAMETRIC TEST
 Tests that do not require a normal distribution
 They utilize both nominal and ordinal data
Nominal data come from categories such as male and
female; yes or no response; political affiliations, religious
groupings and other categories.
Ordinal data are data expressed in rankings showing an
order, such as rank 1, rank 2, etc. O, VS S, F, P and SA, A , D, SD
Commonly used tests under the nonparametric tests:
Examples of Nonparametric tests

Chi-square

Wilcoxon Rank –Sum test

Kruskal-Wallis Test or H-test

Spearman Rank-Order Coefficient

Chi-square is a test of difference between the observed and


expected frequencies

Chi Square Tests


-test of Goodness-of-Fit
- test of Homogeinity
-test of Independence

chi-square goodness of fit test. The test is applied when you


have one categorical variable from a single population. It is used
to determine whether sample data are consistent with a
hypothesized distribution.

When to Use the Chi-Square Goodness of Fit Test

The chi-square goodness of fit test is appropriate when the


following conditions are met:

 The sampling method is simple random sampling.


 The variable under study is categorical.
 The expected value of the number of sample observations in
each level of the variable is at least 5.

This approach consists of four steps: (1) state the hypotheses, (2)
formulate an analysis plan, (3) analyze sample data, and (4)
interpret results.

Test of goodness –of-Fit

O= observed frequencies
E= observed frequencies
Problem

The grades in statistics course for a particular semester are:

Grades Observed
1.25 14
1.50 18
1.75 32
2.0 20
2.25 16

Test the hypothesis that the distribution of grades is uniform

Use a 0.05 level of significance.

 State the hypotheses. The first step is to state the


null hypothesis and an alternative hypothesis.
 Null hypothesis: The distribution of grades is

uniform
 Alternative hypothesis: At least one of the

proportions in the null hypothesis is false.

 Analyze sample data. Applying the chi-square


goodness of fit test to sample data, compute the
degrees of freedom
DF = k - 1 = 5 - 1 = 4
(E1) = 100/5 =20

Χ2 = Σ [ (Oi - Ei)2 / Ei ]
Χ2 = [ (14 - 20)2 / 20 ] + [ (18 - 20)2 / 20 ] + [ (32 -
20)2 / 20 ] + [ (20- 20)2/20] + [(16-20)2/20]
Χ2 = (36 / 20) + (4/ 20) + ( 144/20) + ( 0)+ (16/20)
= 1.8 + 0.20 + 7.20 + 0.8 = 10.0
 Interpret results. Critical X2 value ( df =4; α=.05) =
9.488 Since the computed value > than critical value ,
reject the null hypothesis.
Chi-Square Test of Homogeneity

Chi-square test of homogeneity is a test applied to a single categorical


variable from two or more different populations. It is used to determine
whether frequency counts are distributed identically across different
populations.

For example, in a survey of TV viewing preferences, we might ask


respondents to identify their favorite program. We might ask the same
question of two different populations, such as males and females. We could
use a chi-square test for homogeneity to determine whether male viewing
preferences differed significantly from female viewing preferences.
The sample problem at the end of the lesson considers this

When to Use Chi-Square Test for Homogeneity

The test procedure described in this lesson is appropriate when the following
conditions are met:

 For each population, the sampling method is simple random sampling.


 The variable under study is categorical.
 If sample data are displayed in a contingency table (Populations x
Category levels), the expected frequency count for each cell of the
table is at least 5.

State the Hypotheses

Every hypothesis test requires the analyst to state a null hypothesis and
an alternative hypothesis. The hypotheses are stated in such a way that
they are mutually exclusive. That is, if one is true, the other must be false;
and vice versa.

The alternative hypothesis (Ha) is that at least one of the null hypothesis
statements is false.

Using sample data from the contingency tables, find the degrees of
freedom, expected frequency counts, test statistic, and the critical value.

 Degrees of freedom. The degrees of freedom (DF) is equal to:

DF = (r - 1) * (c - 1)

where r is the number of populations, and c is the number of levels for the
categorical variable.

 Expected frequency counts. The expected frequency counts are computed


separately for each population at each level of the categorical variable, according
to the following formula.

Er,c = (nr * nc) / n

where Er,c is the expected frequency count for population r at level c of the
categorical variable, nr is the total number of observations from population r, nc is
the total number of observations at treatment level c, and n is the total sample
size.
 Test statistic. The test statistic is a chi-square random variable (Χ2)
defined by the following equation.

Χ2 = Σ [ (Or,c - Er,c)2 / Er,c ]

where Or,c is the observed frequency count in population r for


level c of the categorical variable, and Er,c is the expected frequency
count in population r for level c of the categorical variable.

 P-value. The P-value is the probability of observing a sample statistic


as extreme as the test statistic.

Problem

In a study of the television viewing habits of children, a developmental


psychologist selects a random sample of 300 first graders - 100 boys and
200 girls. Each child is asked which of the following TV programs they like
best: The Lone Ranger, Sesame Street, or The Simpsons. Results are
shown in the contingency table below.

Viewing Preferences
Row total
Lone Ranger Sesame Street The Simpsons

Boys 50 30 20 100

Girls 50 80 70 200

Column total 100 110 90 300

Do the boys' preferences for these TV programs differ significantly from the
girls' preferences? Use a 0.05 level of significance.

Solution
The solution to this problem takes four steps: (1) state the hypotheses, (2)
formulate an analysis plan, (3) analyze sample data, and (4) interpret
results. We work through those steps below:

 State the hypotheses. The first step is to state the null hypothesis
and an alternative hypothesis.
 Null hypothesis: The null hypothesis states that the proportion
of boys who prefer the Lone Ranger is identical to the
proportion of girls. Similarly, for the other programs. Thus,

H0: Pboys who prefer Lone Ranger = Pgirls who prefer Lone Ranger
H0: Pboys who prefer Sesame Street = Pgirls who prefer Sesame Street
H0: Pboys who prefer The Simpsons = Pgirls who prefer The Simpsons

 Alternative hypothesis: At least one of the null hypothesis


statements is false.

Formulate an analysis plan. For this analysis, the significance level


is 0.05. Using sample data, we will conduct a chi-square test for
homogeneity

 Formulate an analysis plan. For this analysis, the significance level


is 0.05. Using sample data, we will conduct a chi-square test for
homogeneity.
 Analyze sample data. Applying the chi-square test for homogeneity
to sample data, we compute the degrees of freedom, the expected
frequency counts, and the chi-square test statistic.

DF = (r - 1) * (c - 1) = (2 - 1) * (3 - 1) = 2

Er,c = (nr * nc) / n


E1,1 = (100 * 100) / 300 = 10000/300 = 33.3
E1,2 = (100 * 110) / 300 = 11000/300 = 36.7
E1,3 = (100 * 90) / 300 = 9000/300 = 30.0
E2,1 = (200 * 100) / 300 = 20000/300 = 66.7
E2,2 = (200 * 110) / 300 = 22000/300 = 73.3
E2,3 = (200 * 90) / 300 = 18000/300 = 60.0

Χ2 = Σ [ (Or,c - Er,c)2 / Er,c ]


Χ2 = (50 - 33.3)2/33.3 + (30 - 36.7)2/36.7 + (20 - 30)2/30
+ (50 - 66.7)2/66.7 + (80 - 73.3)2/73.3 + (70 - 60)2/60
Χ2 = (16.7)2/33.3 + (-6.7)2/36.7 + (-10.0)2/30 + (-16.7)2/66.7 +
(3.3)2/73.3 + (10)2/60
Χ2 = 8.38 + 1.22 + 3.33 + 4.18 + 0.61 + 1.67 = 19.39

where DF is the degrees of freedom, r is the number of populations, c


is the number of levels of the categorical variable, nr is the number of
observations from population r, nc is the number of observations from
level c of the categorical variable, n is the number of observations in
the sample, Er,c is the expected frequency count in population r for
level c, and Or,c is the observed frequency count in population r for
level c.

The P-value is the probability that a chi-square statistic having 2


degrees of freedom is more extreme than 19.39.

 Interpret results. Since the P-value (0.0000) is less than the


significance level (0.01), we reject the null hypothesis. Critical X2
value ( df=2; α.05) = 9.210

Chi-Square Test for Independence

Chi-square test for independence is the test applied when you have
two categorical variables from a single population. It is used to determine
whether there is a significant association between the two variables.

When to Use Chi-Square Test for Independence

The test is appropriate when the following conditions are met:

 The sampling method is simple random sampling.


 The variables under study are each categorical.
 If sample data are displayed in a contingency table, the expected
frequency count for each cell of the table is at least 5.

This approach consists of four steps: (1) state the hypotheses, (2)
formulate an analysis plan, (3) analyze sample data, and (4) interpret
results.

State the Hypotheses

H0: Variable A and Variable B are independent.


Ha: Variable A and Variable B are not
independent.

The alternative hypothesis is that knowing the level of Variable A can help
you predict the level of Variable B which suggests that the variables are
related

 Test method. Use the chi-square test for independence to determine


whether there is a significant relationship between two categorical
variables.

Using sample data, find the degrees of freedom, expected frequencies, test
statistic, and the P-value associated with the test statistic.

 Degrees of freedom. The degrees of freedom (DF) is equal to:

DF = (r - 1) * (c - 1)

where r is the number of levels for one catagorical variable, and c is


the number of levels for the other categorical variable.

 Expected frequencies. The expected frequency counts are


computed separately for each level of one categorical variable at
each level of the other categorical variable. Compute r * c expected
frequencies, according to the following formula.
Er,c = (nr * nc) / n

where Er,c is the expected frequency count for level r of Variable A


and level c of Variable B, nris the total number of sample
observations at level r of Variable A, nc is the total number of sample
observations at level c of Variable B, and n is the total sample size.

 Test statistic. The test statistic is a chi-square random variable (Χ2)


defined by the following equation.

Χ2 = Σ [ (Or,c - Er,c)2 / Er,c ]

where Or,c is the observed frequency count at level r of Variable A


and level c of Variable B, and Er,c is the expected frequency count at
level r of Variable A and level c of Variable B.

Interpret Results

Problem

A public opinion poll surveyed a simple random sample of 1000 voters.


Respondents were classified by gender (male or female) and by voting
preference (Republican, Democrat, or Independent). Results are shown in
the contingency table below.
Voting Preferences
Row total
Republican Democrat Independent

Male 200 150 50 400

Female 250 300 50 600

Column total 450 450 100 1000

Is there a gender gap? Do the men's voting preferences differ significantly


from the women's preferences? Use a 0.05 level of significance.

Solution

The solution to this problem takes four steps: (1) state the hypotheses, (2)
formulate an analysis plan, (3) analyze sample data, and (4) interpret
results. We work through those steps below:

 State the hypotheses. The first step is to state the null


hypothesis and an alternative hypothesis.

H0: Gender and voting preferences are independent.


Ha: Gender and voting preferences are not independent.

DF = (r - 1) * (c - 1) = (2 - 1) * (3 - 1) = 2

Er,c = (nr * nc) / n


E1,1 = (400 * 450) / 1000 = 180000/1000 = 180
E1,2 = (400 * 450) / 1000 = 180000/1000 = 180
E1,3 = (400 * 100) / 1000 = 40000/1000 = 40
E2,1 = (600 * 450) / 1000 = 270000/1000 = 270
E2,2 = (600 * 450) / 1000 = 270000/1000 = 270
E2,3 = (600 * 100) / 1000 = 60000/1000 = 60
Χ2 = Σ [ (Or,c - Er,c)2 / Er,c ]
Χ2 = (200 - 180)2/180 + (150 - 180)2/180 + (50 - 40)2/40
+ (250 - 270)2/270 + (300 - 270)2/270 + (50 - 60)2/60
Χ2 = 400/180 + 900/180 + 100/40 + 400/270 + 900/270 + 100/60
Χ2 = 2.22 + 5.00 + 2.50 + 1.48 + 3.33 + 1.67 = 16.2

where DF is the degrees of freedom, r is the number of levels of


gender, c is the number of levels of the voting preference, nr is the
number of observations from level r of gender, nc is the number of
observations from level c of voting preference, n is the number of
observations in the sample, Er,c is the expected frequency count when
gender is level r and voting preference is level c, and Or,c is the
observed frequency count when gender is level r voting preference is
level

 Interpret results. Since the computed value of 16.20 is > than 9.210
at .05 level of significance , reject the null hypothesis. Thus, we
conclude that there is a relationship between gender and voting
preference.

Wilcoxon Rank-Sum Test – it is used to compare if there is a


significant difference between two independent groups. It is the
counterpart of the t-test under the parametric test.

It is used when:

 Sample size is very small


 When we compare the means of two independent groups

Steps:

1. Rank the observations from lowest value to the highest value of both
groups
2. After ranking, assign the rank to the respective observation
3. Add the ranks of group 1, W1
4. Add the ranks of group 2, W2
5. Determine the number of observation in group 1 and group 2 that is
n1 and n2 respectively
6. Use the formula

U1 = W1 – n1(n1 + 1)/2
U2 = W2 – n2(n2+1)/2

Where: U1 = Wilcoxon rank-Sum Test


W1= sum ranks of group 1
n1 = sample size of group 1
U2 = Wilkoxon Rank –sum Test
W2= sum ranks of group 2
n2 = sample size of group 2

*
Problem: Of the 18 selected patients who had advanced stage of leukemia,
ten were treated with new serum and eight now. The survival time, in years
was reckoned from the time , in years was reckoned from the time
experiment was conducted from the time the experiment was conducted,

Treatment 2.9 3.1 5.3 4.2 4.5 3.9 2.0 3.7 4.1 4.0
No Treatment 1.9 0.50 9.0 2.2 3.1 2.0 1.7 2.5

Ranking the data from the lowest to the highest value

No. Observation Rank


1 .5 1
2 .9 2
3 1.7 3
4 1.9 4
5 2.0 5.5
6 2.0 5.5
7 2.2 7
8 2.5 8
9 2.9 9
10 3.1 10.5
11 3.1 10.5
12 3.7 12
13 3.9 13
14 4.0 14
15 4.1 15
16 4.2 16
17 4.5 17
18 5.3 18

With treatment Rank No Treatment Rank


2.9 9 1.9 4
3.1 10.5 O.5 1
5.3 18 0.9 2
4.2 16 2.2 7
4.5 17 3.1 10.5
3.9 13 2.0 5.50 1
2.0 5.5 1.7 3.0
3.7 12 2.5 8
4.1 15 W2 = 41
4.0 14
W1 =130

U1 = W1 – n1(n1 +1)/2 = 130 – 10 (10+1)/2 = 130-110/2


= 130 -55 =75
U2 = 41 – 8(8 +1)/2 41 – 72/2 = 41-36 = 5
If the computed value is lower than the tabular value disconfirm Ho

Spearman Rank Order Coefficient of Correlation r2


Used when:
Looking at a relationship between the dependent and the
independent variables x and y
Ranking is used
How to determine the Spearman Rank-Order Coefficient
1. Rank the data in x (independent variable) from highest to
lowest score
2. Rank the data in y (dependent variable) from highest to lowest
score
3. Find D, the difference between the Rx and Ry
4. Find D2, squaring the difference between the Rx and Ry
5. Get ∑D2
6. Determine the sample size n
7. Use the formula :
6∑D2

rs = 1- n(n2- 1)

Example: The following are the number of hours which 12


students spent in studying for a midterm examination and the
grades they obtained in English. Determine rs at .05 level of
significance

No. of Hours Midterm Grades


Studied
x y
5 50
6 60
11 79
20 90
19 85
20 92
10 80
12 82
8 65
15 85
18 94
10 70

You might also like