W07 Statistical Analysis For Categorical Data-4
W07 Statistical Analysis For Categorical Data-4
Kategonna / ordinal
g-nominal
Categorical outcomes
• Parameters such as the mean and the standard
deviation are the most common way to describe a
population, but there are situations in we have
questions about the proportions or relative frequencies
for a distribution
• Examples:
• How does the number of female students compare with
the number of male students in IE?
• Among several local brands of fried chicken, which is the
most preferred by most students?
10 20
30
Ha :
Pco f- Pce
Hypotheses of the one-way chi-square
• Generally, H0 falls into one of the following categories:
2. No Difference from a Known Population
H0: the proportions for one population are not different from the proportions that are
known to exist for another population
Ha: the population proportions are not equal to the values specified by the null hypothesis
Histgricaldata
µ young : Poldi
Ho :
proporsi =
prop Orsi data historical
Ha :
f young ≠ an %
Assumptions of the one-way chi-square
1. Participants are categorized along one variable having two or more
categories, and we count the frequency in each category.
2. Each participant can be in only one category we )
mis al cowo dance
gori (
-
hate
ada di antara
tdhmunghm
2
expected
=
fei : 71 ✗ n
fez = Be ✗ n
fell = Ph ✗ n
n=60
feg =
20 Feb =
20
f-eh = 20
Observed and expected frequency
• Select a sample of n individuals and count how many are in each
category.
• The resulting values are called observed frequencies (!"#$ ).
21
%
6 K B
%
= =
=
,
60
observed
10 20
30
Ho = Ph = Pb =
Pg
K B G
to 20 10
30
f- e 20 20 20
'
E% 1302%2-+12%-012 l"
✗ =
= +
> × tab el -
i
reject Ho
% (!"#$ − !! )%
""#$ =$
!!
&
• We reject "% when #!"# > #&
• In a one-way chi square, df = k – 1.
I
n = 000
Ho : P worry = Pho worry = ◦ ' J
✗ 2=200
Ha :P worry P worry
÷
> no
Example
=
=
-900 72=20
-
200 fenw =
400
fonw =
n = on
=
200
+
vrganthkbgt
worry
ssssmangct !
Chi-square test for independence
• The chi-square statistic may also be used to test whether there is a relationship between two
independent variables (IVs).
• For example, a group of students could be classified in terms of personality (introvert, extrovert) and in
terms of color preference (red, yellow, green, or blue).
1. V 2
Color preference
Red Yellow Green Blue
Independent var 1 K1
• Is there any significant relationship between personality and color preference in the population of
students?
• the test is called the chi-square test for independence or the two-way chi-square test
The Hypotheses
• The null hypothesis for the chi-square test for independence states that the two
measured variables are independent.
• Two variables are independent when there is no consistent, predictable relationship between
them.
• H0 falls into one of the following categories:
1. The data are viewed as a single sample, with each individual measured on two variables.
• The goal of this chi-square test is to evaluate the relationship between two variables:
• For the example we are considering, the goal is to determine whether there is a consistent, predictable
relationship between the type of music and whether a woman gives her phone number
DV
IV
The Hypotheses
BO
• The null hypothesis for the chi-square test for independence states that the two
measured variables are independent.
• Two variables are independent when there is no consistent, predictable relationship between
them.
• H0 falls into one of the following categories:
2. the data are viewed as two (or more) separate samples representing two (or more)
populations or treatment conditions
• The goal of this chi-square test is to determine whether there are significant differences between the
populations
• For the example we are considering whether the proportion of women giving phone numbers with romantic
music is significantly different from the proportion with neutral music.
Observed and Expected Frequencies
• The frequencies in the sample distribution are observed frequencies
(!$%& ).
• The expected frequencies (!' ) define an ideal hypothetical
distribution that is in perfect agreement with the null hypothesis.
to jumlah sample
h bars
☐
2
"
✗ (27-21)
¥7" ¥7
=
135¥
+ "
hCn
+ f- e-
jumlah yes / no
4zo
-
+
I
=
=
51g
2
✗ tabet =
3,84
The Chi-Square Statistic
• In the chi-square test for goodness of fit, the sample is
expressed as a set of observed frequencies (!!"# values),
and the null hypothesis is used to generate a set of
expected frequencies (!$ values).
• The chi-square statistic simply measures how well the
data (!!"# values) fit the hypothesis (!$ values)
% (!"#$ − !! )%
""#$ =$
!!
&
• We reject "% when #!"# > #&
• In a one-way chi square, df = (row -1)(column-1).
Ho hategori 1 Tldah ada pcngaruh antara dan penniman Mobil
Example
: usia
2
✗ =
4192 2
✗
2
failed to reject
✗ < tabet _
,
2
✗ tabet 5199 Mobil
=
Tldahada hub .
antara usia
dgn pemllihan
A researcher would like to know which factors are most Ho hategorr 2: Tidahada perbedaan antara muda dan tua dlm
mitch Mobil
important to people buying a new car. Each individual in tua dlm mitch Mobil
antara muda dan
heslmp Tidahada
:
perbedaan
f-e 16 40 24
24 60 36
Perform a two-way chi-square test to compare the
factors influencing decision-making process between
younger and older adults in buying a new car.