PSAI Unit 5
PSAI Unit 5
Example:
1. The total number of shoe pairs options is 7.
2. Each day, shoe pairs choice is free to vary, but there is a
restriction imposed by the choices made on previous days.
3. The degrees of freedom can be thought of as the number of
choices one can make independently.
On Monday, she can choose any of the seven desserts.
(7 options)
On Tuesday, she can choose any of the six remaining dessert options.
(6 options)
On Wednesday, she can choose any of the five remaining options.
(5 options)
On Thursday, She can choose any of the four options.
(4 options)
On Friday, she can choose any of the three options.
(3 options)
On Saturday, She can choose any of the two options.
(2 options)
On Sunday, she doesn’t have any options to choose from.
(No option, she have to choose remaining option)
Example:
You have a data set of 10 values and if the mean of the 10 values is 3.5,
the constraint requires that the sum of the 10 values must equal
10*3.5= 35?
First value to ninth values are free to vary(having freedom to choose
any value from 1 to 9)
0.1+0.2+0.3+0.4+0.5+0.6+0.7+0.8+0.9+30.5 =35
(1) (2) (3) (4) (5) (6) (7) (8) (9)
Upto 9th Value we’re having a choice to any value. 10th value will be
specific value equal to sum, so, 10th value should be 30.5 to equal to
the sum, to get mean 3.5
another way
3+(-8.2)+(-37)+(-92)+(-1)+0+1+(-22)+99+61.3 =35
(1) (2) (3) (4) (5) (6) (7) (8) (9)
Upto 9th Value we’re having a choice to any value. 10th value will be
specific value equal to sum, so, 10th value should be 61.3 to equal to
the sum, to get mean 3.5
Df = 10-1 = 9
Select two samples from the populations and calculate the sample
variances and sizes.
Calculate the test statistic, which is the ratio of the larger sample
variance to the smaller sample variance.
2 2
Null hypothesis: σ1 = σ2
2 2
Alternative Hypothesis : σ1 ≠ σ2
Calculate the sample mean & sample variance
Σ𝑥
𝑥 = 𝑛
Σ𝑦
𝑦 = 𝑛
2
2 Σ(𝑥−𝑥)
𝑠1 = 𝑛1− 1
2
2 Σ(𝑦−𝑦)
𝑠2 = 𝑛2− 1
2
𝑠1
F statistic = 𝑓 = 2
𝑠2
Independence
Goodness-of-Fit
Goodness of fit
The Chi-square goodness of fit test checks whether your sample data is
likely to be from a specific theoretical distribution. We have a set of data
values, and an idea about how the data values are distributed. The test gives
us a way to decide if the data values have a “good enough” fit to our idea, or
if our idea is questionable.
For the goodness of fit test, we need one variable. We also need an idea, or
hypothesis, about how that variable is distributed.
We have bags of candy with five flavors in each bag. The bags should
contain an equal number of pieces of each flavor. The idea we'd like to test
is that the proportions of the five flavors in each bag are the same.
Decide whether to reject the null hypothesis. You should reject the
null hypothesis if the chi-square value is greater than the critical
value. If you reject the null hypothesis, you can conclude that your
data are significantly different from what you expected.
Independence
Goodness-of-Fit Test:
2. Independence Test:
○ An independence test examines whether two categorical
variables are independent of each other or if there's an
association between them.
○ It is used when you have two categorical variables and you want
to determine whether there's a relationship between them.
○ The most common test for independence is the chi-square test
of independence, which compares observed frequencies in a
contingency table to expected frequencies if the variables were
independent.
Chi Square Test for Independence
R1 R2 Row Total
C1 a b a+b
C2 c d c+d
(𝑎+𝑏)*(𝑎+𝑐)
Expected Value E(a) =
𝑛
(𝑎+𝑏)*(𝑏+𝑑)
Expected Value E(b) =
𝑛
(𝑐+𝑑)*(𝑎+𝑐)
Expected Value E(c) =
𝑛
(𝑐+𝑑)*(𝑏+𝑑)
Expected Value E(d) =
𝑛
812*240
E(20) = 3248
=60
792*3008
E(792) = 3248 =752
2436*240
E(220) = 3248 =180
2436*3008
E(22160) = 3248 = 2256
182(b1) 2256(b2)
Calculation of chi square
O E O-E (O-E)2
(𝑂−𝐸)2
𝐸
(𝑂−𝐸)2
Σ 𝐸
= 26.66+2.12+8.88+0.709 = 38.369
Calculate the degrees of freedom
DF =(c-1)(r-1)
=(2-1)(2-1)
=1
Level of significance
∝ = 0.05/5%