0% found this document useful (0 votes)
18 views43 pages

Week 9-12 GA Solutions Madras Univ

The document provides solutions to various statistical problems related to estimators, including unbiasedness, risk, maximum likelihood estimation, and method of moments. It covers examples involving random variables, their distributions, and calculations for sample data. Key concepts include bias, variance, and the derivation of estimators for specific distributions.

Uploaded by

Vijayrajtnu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views43 pages

Week 9-12 GA Solutions Madras Univ

The document provides solutions to various statistical problems related to estimators, including unbiasedness, risk, maximum likelihood estimation, and method of moments. It covers examples involving random variables, their distributions, and calculations for sample data. Key concepts include bias, variance, and the derivation of estimators for specific distributions.

Uploaded by

Vijayrajtnu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Statistics for Data Science - 2

Week 9 Graded Assignment Solution

1. Let X1 , X2 , . . . , Xn be i.i.d.
 samples from a distribution
 X with mean µ and standard
X1 + X2 + . . . + Xn
deviation σ. Let µ̂ = 6 be an estimator of µ.
n
i) Is the estimator unbiased?

a) Yes
b) No

Solution:
  
X1 + X2 + . . . + Xn
E[µ̂] = E 6
n
6
= (nµ)
n
= 6µ

And
Bias(µ̂, µ) = E[µ̂] − µ = 6µ − µ = 5µ
Since, Bias(µ̂, µ) ̸= 0, therefore the estimator is not unbiased.
ii) Find the risk of µ̂.
36σ 2
(a) + 25µ2
n
36σ 2
(b) + 5µ
n
6σ 2
(c) + 25µ2
n
6σ 2
(d) + 5µ
n
Solution:
  
X1 + X2 + . . . + Xn
Var(µ̂) = Var 6
n
36
= 2 (nσ 2 )
n
36σ 2
=
n

1
Risk(µ̂) = Bias(µ̂, µ)2 + Var(µ̂)
36σ 2
= (5µ)2 +
n
2
36σ
= 25µ2 +
n
2. Consider a sample of iid random variables X1 , X2 , . . . , Xn , where n > 20, E[Xi ] =
1 n
µ, Var(Xi ) = σ 2 and the estimator of µ, µ̂n =
P
Xi . Find the MSE of µ̂n .
n − 20 i=21
σ
a) n−20
σ2
b) n−20
σ2
c) n−21
σ
d) n

Solution:
" n
#
1 X
E[µ̂n ] = E Xi
n − 20 i=21
(n − 20)µ
=
n − 20

This implies that
Bias(µ̂n , µ) = E[µ̂n ] − µ = µ − µ = 0

" n
#
1 X
Var(µ̂n ) = Var Xi
n − 20 i=21
n
1 X
= Var(Xi )
(n − 20)2 i=21
1
= [(n − 20)σ 2 ]
(n − 20)2
σ2
=
(n − 20)

Risk(µ̂) = Bias(µ̂, µ)2 + Var(µ̂)


σ2
=0+
(n − 20)
σ2
=
(n − 20)

2
3. Let X1 , X2 , . . . , Xn ∼ iid X, where X is a random variable with density function
(
θ
θ+1 , x > 1,
fX (x) = x
0, otherwise.
θ
The mean of the random variable X is θ−1
. Find an estimator of θ using method of
moments.
X1 + X2 + . . . + Xn
(a)
X1 + X2 + . . . + Xn − 1
X1 + X2 + . . . + Xn
(b)
1 − X1 + X2 + . . . + Xn
X1 + X 2 + . . . + Xn
(c)
X1 + X2 + . . . + Xn − n
X1 + X 2 + . . . + Xn
(d)
n − X1 + X2 + . . . + Xn
θ
Solution: The mean of the random variable X is θ−1
.
So,
θ
M1 =
θ−1
⇒ M1 θ − M1 = θ
M1
⇒θ=
M1 − 1
X1 +X2 +...+Xn
n
⇒θ= X1 +X2 +...+Xn
n
1 −
X 1 + X2 + . . . + X n
⇒θ=
X1 + X2 + . . . + Xn − n
X1 + X 2 + . . . + Xn
Therefore the estimator of θ is .
X1 + X2 + . . . + Xn − n
4. Let X1 , X2 , X3 ∼ iid Binomial(4, θ). Given a random sample (1, 4, 2), find the maximum
likelihood estimate of θ.
2
a) 3
7
b) 12
1
c) 3
5
d) 12

Solution: Xi ∼ Binomial(4, θ)
⇒ fXi (x) = 4 Cx θx (1 − θ)4−x

3
Likelihood function is given by
3
Q
L(x1 , x2 , x3 ) = fXi (xi )
i=1
⇒ L(x1 , x2 , x3 ) = 4 Cx1 θx1 (1 − θ)4−x1 × 4 Cx2 θx2 (1 − θ)4−x2 × 4 Cx3 θx3 (1 − θ)4−x3

L(1, 4, 2) = 4 C1 4 C4 4 C2 θ(1+4+2) (1 − θ)12−(1+4+2)


= 24θ7 (1 − θ)5
⇒ log(L(1, 4, 2)) = log(24) + 7 log(θ) + 5 log(1 − θ)

Therefore, ML estimator for θ is given by


θ̂ = arg maxθ [log(24) + 7 log(θ) + 5 log(1 − θ)]

Let Y = log(24) + 7 log(θ) + 5 log(1 − θ)


dY 7 5
⇒ = −
dθ θ 1−θ
Now we will equate this value to zero and find the value of θ

7 5 7
− =0⇒θ=
θ 1−θ 12
7
⇒ θ̂M L =
12

5. Let X1 , X2 , . . . , Xn ∼ iid X, where X is a random variable with density function


(
e−(x−θ) , x > θ,
fX (x) =
0, otherwise.

i) The mean of the distribution is θ + 1. Find the estimator of θ using method of


moments. [1 mark]
X1 + X2 + . . . + Xn
(a)
n
X1 + X2 + . . . + Xn − n
(b)
n
n
(c)
X1 + X2 + . . . + Xn − n
1
(d)
n − X1 + X2 + . . . + Xn

4
Solution: The mean of the random variable X is θ + 1.
So,

M1 = θ + 1
⇒ θ = M1 − 1
X1 + X2 + . . . + Xn
⇒θ= −1
n
X1 + X2 + . . . + Xn − n
⇒θ=
n
X 1 + X2 + . . . + Xn − n
Therefore the estimator of θ is .
n
ii) Is the method of moments estimator unbiased?

a) Yes
b) No

Solution:
Estimator of θ is
X1 + X 2 + . . . + Xn − n
θ̂ =
n
X1 + X 2 + . . . + Xn − n
E[θ̂] = E[ ]
n
1
= (E[X1 ] + E[X2 ] + . . . + E[Xn ] − n)
n
1
= (nθ + n − n)
n

And
Bias(θ̂, θ) = E[θ̂] − θ = θ − θ = 0
Since, Bias(θ̂, θ) = 0, therefore the estimator is unbiased.

6. Suppose it is known that a sample consisting of the values 10, 12, 15, 16.5, 18, 19, 20
and 21.5 comes from a population with the density function
( −x
1 θ
e , x > 0,
f (x) = θ
0, otherwise.

Find the maximum likelihood estimate of θ. Enter your answer correct to one decimal.

5
Solution:
n
Y
L(x1 , x2 , . . . , xn ) = fX (xi )
i=1
n
1 −xi
Y
= e θ
i=1
θ
1  −x1 −x2 −xn

= n e θ e θ ...e θ
θ
1  −(x1 +x2 +...+xn ) 
= n e θ
θ
(x1 + x2 + . . . + xn )
⇒ log(L(x1 , x2 , . . . , xn )) = −n log(θ) −
θ
Therefore, ML estimator for θ is given by
(x1 + x2 + . . . + xn )
θ̂ = arg maxθ [−n log(θ) − ]
θ
(x1 + x2 + . . . + xn )
Let Y = −n log(θ) −
θ
dY n (x1 + x2 + . . . + xn )
⇒ =− +
dθ θ θ2
Now we will equate this value to zero and find the value of θ.
n (x1 + x2 + . . . + xn )
⇒− + =0
θ θ2
x1 + x2 + . . . + xn
⇒θ=
n
x1 + x2 + . . . + xn
⇒ θ̂ =
n
Therefore, maximum likelihood estimate of θ for the given sample will be

10 + 12 + 15 + 16.5 + 18 + 19 + 20 + 21.5
θ̂ =
8
132
=
8
= 16.5

7. Let X be a discrete random variable with the following probability mass function

x 1 2 3 4
1−p p 1−p p
fX (x)
2 2 2 2
Table 8.1.G: PMF of X

6
Suppose a sample consisting of the values 2, 2, 4, 3, 1, 3, 1 and 2 is taken from the random
variable X. Find the estimate of p using method of moments. Enter your answer correct
to two decimals accuracy.
Solution:
1−p p 1−p p
E[X] = 1 × +2× +3× +4×
2 2 2 2
(1 − p) + 2p + 3(1 − p) + 4p
=
2
=p+2
Now
M1 = E[X] = p + 2
⇒ p = M1 − 2
Therefore, estimate of p will be
X1 + X2 + . . . + Xn
− 2.
n
So, the estimate of p for the given sample will be

2+2+4+3+1+3+1+2
p̂ = −2
8
18
= −2
8
= 0.25

Use the following values of CDF of standard normal distribution to answer the questions:

FZ (1.64) = 0.90, FZ (1.96) = 0.95

8. The heights (in cm) of people in a certain area are normally distributed with mean µ
and standard deviation 40. The heights from a random sample of people are as follows:
160,164,150,160,155,165,170,162,174,150.
Suppose µ̂ is the maximum likelihood estimate for µ. Let X ∼ Normal(µ̂, 1), then find
the value of fX (160).

Solution:
Let the random variable Y represent the heights of people in a certain area.
It is given that Y ∼ Normal(µ, 402 ).

For the given sample 160, 164, 150, 160, 155, 165, 170, 162, 174, 150 of Y , the maximum
likelihood estimate of µ is given by
160 + 164 + 150 + 160 + 155 + 165 + 170 + 162 + 174 + 150
µ̂ = = 161
10
7
Now X ∼ Normal(µ̂, 1) and µ̂ = 161.
1 160 − 161 2
 

− 
1

Therefore, fX (x) = √ e 2 1 = 0.24

8
Statistics for Data Science - II
Week - 9 GA Solution

1. Let Y be a discrete random variable such that Y ∈ {0, 1} and

4 − 2θ
P (Y = 0) =
5+θ

where θ is an unknown constant. Consider a random sample (0, 1, 1, 1, 0).

(a) Find the method of moments estimate of θ for the given sample. Enter the answer
correct to two decimal places.
Answer : 0.83 ; Range : 0.80 to 0.86
Solution:
4 − 2θ
Let Y be a discrete random variable with P (Y = 0) = and P (Y = 1) =
5+θ
1 + 3θ
1 − P (Y = 0) = .
5+θ
Therefore, the distribution moment is,
X 1 + 3θ
M1 = yP (Y = y) = 0P (Y = 0) + 1P (Y = 1) =
Y ∈y
5+θ

For the given sample (0, 1, 1, 1, 0), the first sample moment is:
0+1+1+1+0 3
m1 = sample mean = = .
5 5

The method of moments equates the sample moment to the distribution(population)


moment:
1 + 3θ 3
= .
5+θ 5
Solve for θ:
5
5(1 + 3θ) = 3(5 + θ) =⇒ 5 + 15θ = 15 + 3θ =⇒ 12θ = 10 =⇒ θ = ≈ 0.83.
6

(b) Find the maximum likelihood estimate of θ for the given sample. Enter the answer
correct to two decimal places.
Answer : 0.83 ; Range : 0.80 to 0.86
Solution: The likelihood function for the sample is:
5  2  3
Y 4 − 2θ 1
L(θ) = P (Yi ) = .
i=1
5+θ 5+θ

1
The log-likelihood function is:
   
4 − 2θ 1
lnL(θ) = ℓ(θ) = 2 ln + 3 ln .
5+θ 5+θ
dℓ(θ)
Now, differentiate ℓ(θ) with respect to θ and solve dθ
= 0 to find the maximum
likelihood estimate as below:
5
θ = ≈ 0.83.
6
Answer: θ ≈ 0.83.

2. Let X1 , X2 , . . . , Xn be i.i.d. samples from a normal distribution N (µ, σ 2 ) with unknown


parameters µ and σ 2 . Consider the following two estimators of µ.
n
1X
µ̂1 = Xi + c, where c is a constant.
n i=1
n
n−1X
µ̂2 = Xi + d, where d is a constant
n2 i=1
Based on the given information, answer the following sub-questions.

(i). Find the value of c and d such that Bias(µ̂1 , µ) and Bias(µ̂2 , µ) are zero.
µ
(a) c = µ, d =
n
1+µ
(b) c = µ, d =
n
1+µ
(c) c = 0, d =
n
µ
(d) c = 0, d =
n
Answer : d
To ensure the estimators µ̂1 and µ̂2 are unbiased, we need to set the bias of both
estimators to zero. Recall that the bias of an estimator is given by:

Bias(µ̂, µ) = E[µ̂] − µ.

For µ̂1 , we have:


n
1X
µ̂1 = Xi + c.
n i=1
The expected value of µ̂1 is:
" n # n
1X 1X
E[µ̂1 ] = E Xi + c = E[Xi ] + c = µ + c.
n i=1 n i=1

2
To make the bias zero:
E[µ̂1 ] − µ = c = 0.
For µ̂2 , we have:
n
n−1X
µ̂2 = Xi + d.
n2 i=1
The expected value of µ̂2 is:
n
n−1X n−1 n−1
E[µ̂2 ] = 2
E[Xi ] + d = 2
· nµ + d = µ + d.
n i=1 n n
To make the bias zero:
n−1 µ
E[µ̂2 ] − µ = µ + d − µ = 0 =⇒ d = .
n n
Thus, the values of c and d are:
µ
c = 0, d= .
n
Answer: (d) c = 0, d = nµ .
(ii). If σ = 2 and n = 10, then which of the following option(s) is(are) true?
(a) Var(µ̂1 ) = Risk(µ̂1 , µ) = 0.2
(b) Var(µ̂1 ) = Risk(µ̂1 , µ) = 0.4
(c) Var(µ̂1 ) = 0.2, Var(µ̂2 ) = 0.162
(d) Var(µ̂1 ) = 0.4, Var(µ̂2 ) = 0.324
Answer : b, d
Solution: Given σ = 2 and n = 10, the variance of an estimator is:
n
!
1X σ2 22
Var(µ̂1 ) = Var Xi + c = = = 0.4.
n i=1 n 10
For µ̂2 , the variance is:
n
!  2
n−1X n−1 2 (n − 1)2 σ 2
Var(µ̂2 ) = Var X i + d = nσ = .
n2 i=1 n2 n3
Substituting n = 10 and σ = 2:
(10 − 1)2 · 4 81 · 4
Var(µ̂2 ) = 3
= = 0.324.
10 1000
The risk of an estimator is equal to its variance if it is unbiased. Thus:
Risk(µ̂1 , µ) = Var(µ̂1 ) = 0.4, Var(µ̂2 ) = 0.324.
Answer: (b) Var(µ̂1 ) = Risk(µ̂1 , µ) = 0.4, (d) Var(µ̂1 ) = 0.4, Var(µ̂2 ) = 0.324.

3
Statistics for Data Science - 2
Week 10 graded Assignment
Bayesian estimation

1. Suppose that the number of buses reaching a particular stop in an one-hour time period
follows the Poisson distribution with an unknown parameter λ. Previous records suggest
that the prior probabilities of λ are P (λ = 0.25) = 0.3 and P (λ = 0.20) = 0.7. If in a
particular one-hour time period seven buses reach the bus stop, find the posterior mode
of λ. Write your answer correct to two decimal places.
Solution:
Prior probabilities of λ are P (λ = 0.25) = 0.3 and P (λ = 0.20) = 0.7.

The posterior probabilities of λ will be

P (X = 7|λ = 0.25).P (λ = 0.25)


P (λ = 0.25|X = 7) =
P (X = 7)
−0.25
e (0.25)7 (0.3)
= ...(1)
7!P (X = 7)

P (X = 7|λ = 0.20).P (λ = 0.20)


P (λ = 0.20|X = 7) =
P (X = 7)
−0.20
e (0.20)7 (0.7)
= ...(2)
7!P (X = 7)

Dividing equation (2) by (1), we get

P (λ = 0.20|X = 7) e−0.20 (0.20)7 (0.7)


= −0.25
P (λ = 0.25|X = 7) e (0.25)7 (0.3)
7e0.05 47
= <1
3(57 )

It implies that P (λ = 0.20|X = 7) < P (λ = 0.25|X = 7)

Therefore, λ = 0.25 is the posterior mode.


2. Outcomes on rolling a die ten times are:
1, 3, 4, 3, 2, 5, 4, 6, 4, 1
Use the Uniform[0, 1] prior to find the posterior mean of p, which denotes the probability
of getting an even number.

Solution:
Let p denote the probability of getting an even number.
Prior distribution of p is fp ∼ Uniform[0, 1].
It implies that fp (p) = 1

Now, posterior density ∝ P (X1 = x1 , . . . , Xn = xn |p = p)fp (p)


⇒ posterior density ∝ p5 (1 − p)5 (1)
⇒ posterior density ∝ p5 (1 − p)5
⇒ posterior density = Beta(6, 6)
6 6
⇒ posterior mean = = = 0.5
6+6 12

3. Let X1 , X2 , . . . , Xn ∼ i.i.d. Exp(λ), where λ is an unknown parameter. Find the poste-


rior mean of λ assuming the prior distribution of λ to be Exp(µ).
n
(a)
X1 + X2 + . . . + Xn
n
(b)
µ + X1 + X2 + . . . + Xn
n+1
(c)
X1 + X2 + . . . + Xn
n+1
(d)
µ + X1 + X2 + . . . + Xn
Solution:
Let Λ be the prior distribution of λ.
From the given information, fΛ (λ) ∼ Exp(µ).

It implies that fΛ (λ) = µe−µλ .

Now, posterior density ∝ P (X1 = x1 , . . . , Xn = xn |Λ = λ)fΛ (λ)


⇒ posterior density ∝ λn e−λ(X1 +X2 +...+Xn ) (µe−µλ )
⇒ posterior density ∝ λn e−λ(X1 +X2 +...+Xn +µ)
⇒ posterior density = Gamma(n + 1, X1 + X2 + . . . + Xn + µ)
n+1
⇒ posterior mean =
X1 + X2 + . . . + Xn + µ

Page 2
4. Call duration of daily stand up meetings of employees of a certain company follows the
exponential distribution with an unknown parameter λ. Duration (in minutes) of last
ten meetings are 20, 30, 35, 30, 25, 25, 20, 28, 34, 30. Find the Bayesian estimate
1
(posterior mean) of λ using the prior distribution of Exp( ) for λ. Write your answer
15
correct to two decimal places.

Solution:
Let Λ be the prior distribution of λ.
1
From the given information, fΛ (λ) ∼ Exp( ).
15
1 −λ/15
It implies that fΛ (λ) = e .
15

Now, posterior density ∝ P (X1 = x1 , . . . , Xn = xn |Λ = λ)fΛ (λ)


1
⇒ posterior density ∝ λn e−λ(X1 +X2 +...+Xn ) ( e−λ/15 )
15
1
−λ(X1 +X2 +...+Xn + )
⇒ posterior density λn e 15
1
⇒ posterior density = Gamma(n + 1, X1 + X2 + . . . + Xn + )
15
n+1 11
⇒ posterior mean = =
1 1
X1 + X2 + . . . + Xn + 277 +
15 15
11 × 15
⇒ posterior mean = = 0.03
15 × 277 + 1

5. Marks of tenth class students of a school follow the normal distribution with an un-
known mean µ and variance 25. Marks of 10 students of the tenth class are 50, 45, 70,
60, 75, 90, 45, 60, 80, 75. Find the Bayesian estimate (posterior mean) of µ assuming
the Normal(50, 25) prior distribution. Write your answer correct to two decimal places.

Solution:
We know that normal distribution is conjugate to the normal distribution. That is if
prior distribution of µ is normal(µ0 , σ02 ) and sample is taken from Normal(µ, σ), then
nσ 2 µ0 σ 2
posterior distribution of the µ will be Normal with mean X 2 0 2 + 2
nσ0 + σ nσ0 + σ 2

Here, X = 65, n = 10, µ0 = 50, σ02 = 25, σ 2 = 25

Page 3
Therefore,
65 × 10 × 25 50 × 25
Posterior mean = +
10(25) + 25 10(25) + 25
16250 1250
= +
275 275
= 59.09 + 4.545 = 63.63

6. The outcomes on tossing a coin ten times are: H T T H T H H H T H. Let p be the


probability of heads. Previous records show that heads appear on an average 40% of
the time. Find the posterior mean of p using the Beta(2, β) prior. Write your answer
correct to two decimal places.

Solution:
Let p denote the probability of heads.
Given that prior of p is Beta(2, β) with an average of 0.4.
It implies that E[Beta(2, β)] = 0.4
2
⇒ = 0.4
2+β
⇒β=3

Therefore, prior distribution of p is Beta(2, 3)


It implies that fp (p) ∝ p1 (1 − p)2

Now, posterior density ∝ P (X1 = x1 , . . . , Xn = xn |p = p)fp (p)


⇒ posterior density ∝ p6 (1 − p)4 (p1 (1 − p)2 )
⇒ posterior density ∝ p7 (1 − p)6
⇒ posterior density = Beta(8, 7)
8 8
⇒ posterior mean = = = 0.53
8+7 15

7. One out of the last ten candidates wins a treasure hunt game. Previous record shows
fraction of winners follows the Beta(20, b) distribution with an average of 20%. Estimate
the long-term fraction of winners of the treasure hunt game. Write your answer correct
to two decimal places.

Solution:
Let the long-term fraction of winners (probability of winning) be denoted by p.
Previous data shows that fraction of winners follows the Beta(20, b) distribution with an
average of 20%.
It implies that E[Beta(20, b)] = 0.2

Page 4
20
⇒ = 0.2
20 + b
⇒ b = 80

Therefore, prior distribution of p is Beta(20, 80)


It implies that fp (p) ∝ p19 (1 − p)79

Now, posterior density ∝ P (X1 = x1 , . . . , Xn = xn |p = p)fp (p)


⇒ posterior density ∝ p1 (1 − p)9 (p19 (1 − p)79 )
⇒ posterior density ∝ p20 (1 − p)88
⇒ posterior density = Beta(21, 89)
21 21
⇒ posterior mean = = = 0.19
21 + 89 110

8. Rainfall in the monsoon season in Delhi follows normal distribution with mean µ and
variance 200 mm. Rainfall (in mm) registered in the 2021 monsoon are 600, 300, 450,
700, 850, 150, 200, 750. Prior information about the average rainfall is that it has mean
600 mm and variance 225 mm. Use the normal prior that matches your prior information
and find the posterior mean.

Solution:
Prior distribution of µ is given Normal with mean 600 and variance 225.
We know that normal distribution is conjugate to the normal distribution. That is if
prior distribution of µ is normal(µ0 , σ02 ) and sample is taken from Normal(µ, σ 2 ), then
nσ02 µ0 σ 2
posterior distribution of the µ will be Normal with mean X 2 +
nσ0 + σ 2 nσ02 + σ 2

Here, X = 500, n = 8, µ0 = 600, σ02 = 225, σ 2 = 200

Therefore,
500 × 8 × 225 600 × 200
Posterior mean = +
8(225) + 200 8(225) + 200
900000 120000
= +
2000 2000
= 450 + 60 = 510

9. Suppose length of a phone call (in minutes) made by Kapil is exponentially distributed
with an unknown parameter λ. Consider a sample (in minutes) 20, 23, 50, 2, 7, 10, 15,
70, 30, 29 from his previous call records.

(i) Find the method of moments estimate of λ for the given sample. Enter the answer
correct to three decimal places.

Page 5
Solution:
Let the random variable X represent the length of phone call made by Kapil.
It is given that X ∼ Exp(λ).

1
E[X] =
λ
20 + 23 + 50 + 2 + 7 + 10 + 15 + 70 + 30 + 29
Sample moment, m1 = = 25.6
10
Now,
1
= 25.6 =⇒ λ = 0.039
λ
Therefore, the method of moments estimate of λ is 0.039.
(ii) Find the maximum likelihood estimate of λ for the given sample. Enter the answer
correct to three decimal places.

Solution:
10
λe−λxi
Q
Likelihood function, L for the given sample is given by
i=1

10
Y
L= λe−λxi
i=1
10 −λ(x1 +x2 +...+x10 )
=λ e
=λ10 e−256λ

Log likelihood of L is
log L = 10 log λ − 256λ
Differentiate log L with respect to λ and equate it to 0.
10 1
− 256 = 0 =⇒ = 25.6 =⇒ λ = 0.039
λ λ
Therefore, the maximum likelihood estimate of λ is 0.039.
(iii) Using a Uniform[0, 1] prior, find the posterior mean of λ. Enter the answer correct
to three decimal places.

Solution:
We know posterior density ∝ Likelihood × Prior
Now, posterior density ∝ λ10 e−256λ × 1
⇒ posterior density = Gamma(11, 256)
11
⇒ posterior mean = = 0.042
256

Page 6
Statistics for Data Science - II
Week - 10 GA Solution

1. We are given that the number of emergency patients arriving at a hospital each night
follows a Poisson distribution with an unknown parameter λ. Historical data gives prior
beliefs that P (λ = 7) = 0.25 and P (λ = 5) = 0.75. If 9 emergency patients arrived on a
particular night, then find the posterior mode of λ.
Answer : 5
Solution: The prior probabilities are P (λ = 7) = 0.25 and P (λ = 5) = 0.75. Using
Bayes’ theorem, the posterior probabilities are proportional to:
P (λ|X = 9) ∝ P (X = 9|λ)P (λ),
where P (X = 9|λ) follows the Poisson distribution:
λ9 e−λ
P (X = 9|λ) = .
9!
Calculate the posterior probabilities for each λ:
79 e−7 59 e−5
P (X = 9|λ = 7) ∝ , P (X = 9|λ = 5) ∝ .
9! 9!
Including the priors:
79 e−7 59 e−5
P (λ = 7|X = 9) ∝ 0.25 · , P (λ = 5|X = 9) ∝ 0.75 · .
9! 9!
After simplification, P (λ = 5|X = 9) is higher than P (λ = 7|X = 9), so the posterior
mode is:
λ = 5.

Answer: λ = 5.
2. A botanist is studying a rare plant species and trying to estimate the probability p that
a given seed will germinate under controlled conditions. Historical data indicates that
prior distribution of p follows a Beta(4, 5) distribution. After planting 15 seeds, where
each seed’s germination is independent of the others, the botanist observes that 6 out of
the 15 seeds germinated. Find the posterior mean of p. Enter the answer correct to two
decimal places.
Answer : 0.42 ; Range : 0.39 to 0.45
Solution: Given, p is the probability that a seed will germinate. Since, 6 seeds out of
15 seeds germinated. Therefore, the likelihood function will be p6 (1 − p)9 . The prior
distribution of p is Beta(4,5). Thus,
Posterior ∝ Prior × Likelihood.

1
Posterior ∝ p3 (1 − p)4 p6 (1 − p)9
Posterior ∝ p9 (1 − p)13
Posterior ∝ p10−1 (1 − p)14−1
Therefore, the posterior distribution will be Beta(10, 14).
The posterior mean is:
α 10 10
E[p] = = = ≈ 0.42.
α+β 10 + 14 24

Answer: 0.42.

2
Statistics for Data Science - 2

Graded assignment week 10

Use the following values of standard normal distribution if needed.

FZ (0.15) = 0.55962, FZ (−0.04) = 0.48405, FZ (−1.28) = 0.10027, FZ (1.96) = 0.975, FZ (−1.64) =


0.05, FZ (1.64) = 0.95, FZ (−1.28) = 0.01, FZ (2.74) = .99693, FZ (−1.36) = .08691, FZ (2.54) =
.99446, FZ (−2.8) = .00256, FZ (−2.58) = 0.005, FZ (2.58) = 0.995, FZ (−1.96) = 0.025, FZ (1.28) =
0.90

1. The average marks scored by students of a school in their board exams is reported to
be 400 with a standard deviation of 5. You suspect that the average may be lower,
possibly 390, and decide to sample students to find their marks.
(a) What sample size do you need for a test at the significance level 0.05 and power
0.95?
Answer: 3

Solution:
Let the random variable X represent the marks obtained by students in their
board exams with expected value µ and standard deviation σ.
Given µ = 400 and σ = 5.
Consider the Null and alternative hypothesis:
H0 : µ = 400
HA : µ < 400
Test Statistics: X
Test: Reject H0 , if X < c at α = 0.05
α = P (reject H0 |H0 is true)
 
X − 400 c − 400
=P √ < √
5/ n 5/ n
 
c − 400
=⇒ 0.05 = FZ √
5/ n
c − 400
=⇒ FZ−1 (0.05) = √
5/ n
c − 400
=⇒ −1.64 = √
5/ n
5
=⇒ c = −1.64 × √ + 400 · · · (1)
n

1
Again, when alternative hypothesis is true, we have

X − 390
√ ∼ Normal(0, 1)
5/ n

β = P (Accept H0 |HA is true)


P (X ≥ c | µ = 390)
 
X − 390 c − 390
P √ ≥ √
5/ n 5/ n
 
c − 390
=⇒ 0.05 = 1 − FZ √
5/ n
c − 390
=⇒ FZ−1 (0.95) = √
5/ n
c − 390
=⇒ 1.64 = √
5/ n
5
=⇒ c = 1.64 × √ + 390 · · · (2)
n

From equation (1) and (2), we have


5 5
− 1.64 × √ + 400 = 1.64 × √ + 390
n n
5
=⇒ 2 × 1.64 × √ = 10
n
2
=⇒ n = 1.64 = 2.6896 ≈ 3

(b) Find the critical value c. Enter the answer correct to two decimal places.
394.73, [394.00, 396.00]
Solution: Substituting the value of c in (2), we get c = 394.73.

2. Suppose X ∼ Normal(µ, 9). For n = 100 iid samples of X, the observed sample mean
is 11.8. What conclusion would a z-test reach if the null hypothesis assumes µ = 10.5
(against an alternative hypothesis µ 6= 10.5)?

(a) Accept H0 at a significance level of 0.10.


(b) Reject H0 at a significance level of 0.10.
(c) Accept H0 at a significance level of 0.05.
(d) Reject H0 at a significance level of 0.05.

Solution:
Given, X ∼ Normal(µ, 9).

2
X1 , . . . , X100 ∼ iid X. For 100 iid samples of X, X̄ ∼ Normal(µ, 9/100)
Sample mean, X̄ = 11.8.
Consider the null and alternative hypotheses: Null hypothesis,

H0 : µ = 10.5

HA : µ 6= 10.5
Test for α = 0.05
Test: Reject H0 if |X̄ − µ| > c

α = P (| X̄ − 10.5 |> c|µ = 10.5)


!
X̄ − 10.5 c
⇒α=P | p |> p
9/100 9/100
!
c
⇒ α = P | z |> p
9/100
!
−c
⇒ 0.05 = 2Fz p
9/100
3 −1
=⇒ c = − F (0.025) = 0.5879 (1)
10 z
Since | 11.8 − 10.5 |> c, z-test at significance level (α) = 0.05, will reject H0 .

Test for α = 0.1


Test: Reject H0 if |X̄ − µ| > c

α = P (| X̄ − 10.5 |> c|µ = 10.5)


!
X̄ − 10.5 c
α=P | p |> p
25/100 9/100
!
c
α = P | z |> p
9/100
!
−c
0.1 = 2Fz p
9/100
3 −1
c=− F (0.05) = 0.4934 (2)
10 z
Since | 11.8 − 10.5 |> c, z-test at significance level (α) = 0.10, will reject H0 .
Hence, options (b) and (d) are correct.

3
3. Let X1 , . . . , X100 be a sample from a normal distribution having a variance of 25. We
wish to test the hypothesis H0 : µ = 0 versus HA : µ = 1.5. Consider a test that rejects
H0 for X̄ > c.
(a) Find the value of c at a significance level α = 0.05. Enter the answer correct to
two decimal places.
0.82
Solution:
Given, X ∼ Normal(µ, 25).
X1 , . . . , X100 ∼ iid X. For 100 iid samples of X, X̄ ∼ Normal(µ, 25/100)
The null and alternative hypothesis are
H0 : µ = 0
HA : µ > 0
Test for α = 0.05
Test: Reject H0 if X̄ > c
α = P (X̄ > c|µ = 0)
!
X̄ c
⇒α=P p >p
25/100 25/100
⇒ α = P (z > 2c)
⇒ 0.05 = 1 − Fz (2c)
1
⇒ c = Fz−1 (0.95) = 0.8224
2
(b) Find the power of the test. Enter the answer correct to two decimal places.
0.91309, [0.90, 0.93]
Solution:
Power = 1 − β = P (X̄ > c|µ = 1.5)
!
X − 1.5 c − 1.5
⇒1−β =P p >p
25/100 25/100
!
c − 1.5
⇒1−β =P z > p
25/100
⇒ 1 − β = 1 − Fz (2(c − 1.5))
Substituting the value of c from above problem,
1 − β = 1 − Fz (2(0.8224 − 1.5))
Therefore,
Power = 1 − β = 0.9123

4
4. A manufacturer supplies fuses, approximately 90% of which function properly. A new
process is initiated whose purpose is to increase the proportion of properly functioning
fuses. We obtain a random sample of 100 such fuses manufactured by the new process
and found out that 8 of them are not functioning properly. Let p denotes the proportion
of properly functioning fuses. (Use normal approximation to binomial)

(a) Define null hypothesis and alternative hypothesis.


i. H0 : p = 0.90, HA : p 6= 0.90
ii. H0 : p = 0.90, HA : p < 0.90
iii. H0 : p = 0.90, HA : p > 0.90
iv. H0 : X = 0.90, HA : X > 0.90
(b) Choose the correct options from the following:
i. Accept H0 at a significance level of 0.05.
ii. Reject H0 at a significance level of 0.10.
iii. Accept H0 at a significance level of 0.10.
iv. Reject H0 at a significance level of 0.05.

Solution:
X1 , . . . , X100 ∼ iid Bernoulli(p).
The null and alternative hypothesis are:

H0 : p = 0.9

HA : p > 0.9
92
Sample mean (X̄) = = 0.92
100
Test for α = 0.05
Test statistic, T = X1 + . . . + X100 ∼ Binomial(n, p) which can be normally approxi-
mated as
T ≈ Normal(100p, 100p(1 − p))
 
p(1 − p)
X ≈ Normal p,
100
Test: Reject H0 if X̄ > c
α = P (X̄ > c | p = 0.9)
 
 X̄ − p c−p 
α=P r
 p(1 − p) > r 
p(1 − p) 
n n

5
 
 c − 0.9 
α=P z > r 
 0.9 × 0.1 
100
 
c − 0.9
⇒ 0.05 = 1 − Fz
0.03
⇒ c = 0.9 + 0.03 × Fz−1 (0.95)
c = 0.9493
Since X̄ < c, z-test at significance level (α) = 0.05, will accept H0 .
Test for α = 0.10
Test statistic, T = X1 + . . . + X100 ∼ Binomial(n, p) which can be normally approxi-
mated as
T ≈ Normal(100p, 100p(1 − p))
 
p(1 − p)
X̄ ≈ Normal p,
100
Test: Reject H0 if X̄ > c
α = P (X̄ > c | p = 0.9)
 
 X̄ − p c−p 
α=P r
 p(1 − p) > r 
p(1 − p) 
n n
 
 c − 0.9 
α=P z > r 
 0.9 × 0.1 
100
 
c − 0.9
⇒ 0.10 = 1 − Fz
0.03
⇒ c = 0.9 + 0.03 × Fz−1 (0.90)
⇒ c = 0.9384
Since X̄ < c, z-test at significance level (α) = 0.10, we will accept H0 .
Hence, options (i) and (iii) are correct.

5. A commonly prescribed drug for relieving nervous tension is believed to be only 25%
effective. To determine if a new drug is superior in providing relief, suppose that 100
people who were suffering with nervous tension are chosen at random and inoculated.
If more than 36 of them are found to be relieved, we reject the null hypothesis that
p = 1/4 and the new drug will be considered superior to the one presently in use. (Use

6
normal approximation to binomial)

(a) Find the critical value c.


Answer: 36

Solution: Since, we will reject the null hypothesis if more than 36 out of 100
patients is found to be relieved, 36 is the critical value.
(b) Find P (Type I error). Enter the answer correct to four decimal places.
[0.0050, 0.0060]
Solution:

The null and alternative hypothesis are:

H0 : p = 0.25

HA : p > 0.25
Given, critical value (c) = 36
Test statistic, T = X1 + . . . + X100 ∼ Binomial(100, p) which can be normally
approximated as
T ≈ Normal(100p, 100p(1 − p))
Test: Reject H0 if T > c that is T > 36

α = P (T > c | p = 0.25)

α = P (T > 36 | p = 0.25)
!
36 − 100p
α=P z> p
100p(1 − p)
!
36 − 100(0.25)
α=P z>p
100 × 0.25(0.75)
 
11
α=P z> √
18.75
 
11
α = 1 − Fz √
18.75
α = 1 − Fz (2.54)
P (Type I error) = α = 0.0055

7
(c) Find P (Type II error) for p = 1/2. Enter the answer correct to four decimal
places.
[0.0020, 0.0030]

Solution:
P (Type II error) = β = P (T ≤ c | p = 0.5)
β = P (T ≤ 36 | p = 0.5)
!
36 − 100p
β=P z≤p
100p(1 − p)
!
36 − 100(0.5)
β=P z≤ p
100 × 0.5(0.5)
 
−14
β=P z≤ √
25
 
−14
β = Fz
5
β = Fz (−2.8)
P (Type II error) = β = 0.0025

6. The proportion of adults living in a small town who are college graduates is estimated
to be p = 0.6. To test this hypothesis against the alternative p < 0.6, you decide to
take a sample of adults from the town.

(a) What sample size do you need for a test (against the alternative hypothesis that
p = 0.4) at a significance level of 0.10 and power of 0.90?
40
Solution:
Null hypothesis, H0 : p = 0.6
Alternate hypothesis, HA : p < 0.6
Given, α = 0.10 and power 1 − β = 0.90
Test statistic, T = Binomial(n, p) which can be normally approximated as
T ≈ Normal(np, np(1 − p))
 
p(1 − p)
X ≈ Normal p,
n
Test: Reject H0 if T < c

8
α = P (X̄ < c|p = 0.4)
 
 X̄ − p c−p 
α=P r
 p(1 − p) < r 
p(1 − p) 
n n
 
 c−p 
α=P z < r 
 p(1 − p) 
n
 
 c − 0.6 
α=P z < r 
 0.6 × 0.4 
n
 
c − 0.6 
⇒ 0.10 = Fz  q
0.24
n
r
0.24 −1
⇒ c = 0.6 + F (0.10)
n z
0.6278
c = 0.6 − √ (3)
n
Now, power
1 − β = P (X̄ < c | p = 0.6)
 
 X̄ − p c−p 
1−β =P 
 r p(1 − p) < r p(1 − p) 

n n
 
 c−p 
1−β =P  z < r 
 p(1 − p) 
n
 
 c − 0.4 
1−β =P  z < r 
 0.4 × 0.6 
n
 
c − 0.4 
⇒ 0.90 = Fz  q
0.24
n

9
r
0.24 −1
⇒ c = 0.4 + F (0.90)
n z
0.6278
c = 0.4 + √ (4)
n
Solving equations (3) and (4),

n ≈ 39.41
n = 40
(b) Find the critical value at a significance level of 0.10. Enter the answer correct to
two decimal places.
[0.48, 0.52]
Solution:
Substitute n = 40 in equation (3),

c = 0.5
7. A random sample of 36 packets of marshmallow weighs, on average, 145 grams with
a standard deviation of 5 grams. Test the hypothesis that µ = 150 grams against the
alternative hypothesis, µ < 150 grams, at the 0.05 level of significance.
(a) On average, it weighs less than 150 grams.
(b) On average, it weighs 150 grams.
Solution:
The null and the alternative hypothesis are:
H0 : µ = 150
HA : µ < 150
Test: Reject H0 , if X < c.
Given α = 0.05, we have
α = P (X < c | µ = 150)
 
X − 150 c − 150
=⇒ 0.05 = P √ < √
5/ 36 5/ 36
 
c − 150
=⇒ 0.05 = FZ √
5/ 36
c − 150
=⇒ −1.64 = √ =⇒ c = 148.63
5/ 36

Since X = 145 < c, reject H0 .

10
8. A survey of 225 randomly selected students from a city revealed that 89.4% of them
have participated in extra curricular activities in their schools. Can we conclude at
1% level of significance that 90% of the students have participated in extra curricular
activities?

(a) Yes
(b) No

Solution:
Null hypothesis, H0 : p = 0.9
Alternate hypothesis, HA : p 6= 0.9
Given, α = 0.01 and n = 225

α = P (| X̄ − p |> c | µ = 0.9)
 
 X̄ − 0.9 c 
α=P| r |> r 
 0.9 × 0.1 0.9 × 0.1 
225 225
 
 c 
α=P | z |> r 
 0.9 × 0.1 
225
 
−15c
0.01 = 2Fz √
0.9 × 0.1

0.9 × 0.1
c=− × Fz−1 (0.005) = 0.0516
15
Since | X̄ − p |=| 0.894 − 0.9 |< c, z-test at significance level (α) = 0.01, will accept H0 .

9. A box of a certain brand of washing powder advertises that it weighs 2.5 kg, but the
actual weight is 2.4 kg with a standard deviation of 0.1 kg. The company wants to
test if the mean has changed. They take a random sample of 100 boxes and finds that
the average weight is 2.35 kg.

(a) Define null hypothesis and alternative hypothesis.


i. H0 : µ = 2.4, HA : µ 6= 2.4
ii. H0 : µ = 2.4, HA : µ > 2.4
iii. H0 : µ = 2.4, HA : µ < 2.4

11
iv. H0 : µ = 2.5, HA : µ 6= 2.5
(b) What conclusion should be made using a significance level of α = 0.05?
i. Accept H0 .
ii. Reject H0 and accept HA .
Solution:
The company wants to check if the mean has changed. So, null and alternative
hypothesis are given by
6 2.4
H0 : µ = 2.4, µ =
Define a test statistic T as T = X.

Test: reject the null hypothesis if |X − 2.4| > c.

X − 2.4 X − 2.4
By CLT, we can say that √ = ∼ Normal(0, 1).
0.1/ 100 1/100
Now,

α = P (|X − 2.4| > c)


 
X − 2.4 c
=⇒ 0.05 = P >
1/100 1/100
=⇒ 0.05 = P (|Z| > 100c)
=⇒ 0.05/2 = P (Z < −100c)
=⇒ −1.96 = −100c =⇒ c = 0.0196

Since |X − 2.4| = |2.35 − 2.4| = 0.05 > c, reject H0 .

10. It is claimed that the lifetimes of light bulbs are normally distributed with a mean of
800 hours and a standard deviation of 40 hours. We wish to test the hypothesis that
µ = 800 hours against the alternative that µ 6= 800 hours with a sample size of 30.

(a) If the acceptance region is defined as 780 ≤ X̄ ≤ 820, find the significance level.
Enter the answer correct to three decimal places.
0.006, [0.005, 0.007]
Solution:
Let the random variable X denote the lifetime of electric bulbs.
Given, X ∼ Normal(µ, 402 ).
X1 , . . . , X30 ∼ iid X.
For 30 iid samples of X, X̄ ∼ Normal(µ, 402 /30)
Null hypothesis, H0 : µ = 800
Alternate hypothesis, HA : µ 6= 800

12
α = P (Reject H0 | H0 is true)
α = P (X̄ > 820 or X̄ < 780 | µ = 800)
α = P (| X̄ − 800 |> 20)
!
X̄ − 800 20
α=P | p |> p
1600/30 1600/30
!
20
α = P | z |> p
1600/30
!
−20
α = 2Fz p
1600/30
α = 0.006
(b) Find the power of the test against the alternative that if the true mean life is 788
hours. Enter the answer correct to two decimal places.
[0.91, 0.94]
Solution:

Power = 1 − β = P (Reject H0 | HA is true)


1 − β = P (X̄ > 820 or X̄ < 780 | µ = 788)
1 − β = P (X̄ > 820 | µ = 788) + P (X̄ < 780 | µ = 788)
! !
X̄ − 788 820 − 788 X̄ − 788 780 − 788
1−β =P p >p +P p <p
1600/30 1600/30 1600/30 1600/30
! !
32 −8
1−β =P z > p +P z < p
1600/30 1600/30
! !
32 −8
1 − β = 1 − Fz p + Fz p
1600/30 1600/30
1 − β = 0.1366

13
Statistics for Data Science - 2

Week 12 Graded Assignment Solution

1. The IQs (intelligence quotients) of 25 students from one batch of IITM students showed
a mean of 110 with a standard deviation of 8, while the IQs of 25 students from another
batch of IITM students showed a mean of 115 with a standard deviation of 7. Is there
a significant difference between the IQs of the two groups at a 0.05 level of significance?

a) Yes
b) No

Hint: Use FZ−1 (0.025) = −1.96


Solution:
Let Xi and Yi represent the IQ’s of both batch of students.
X1 , X2 , . . . , X25 ∼ N(µ1 , 82 ) and Y1 , Y2 , . . . , Y25 ∼ N(µ2 , 72 )
X = 110 and Y = 115
Consider, H0 : µ1 = µ2 , HA : µ1 6= µ2
T = X − Y ∼ N(µ1 − µ2 , 64 25
+ 49
25
) i.e. N(µ1 − µ2 , 113 25
)
Test: Reject H0 if |T | > c.
!
T c
α = P (|T | > c | H0 ) = P |p |> p
113/25 113/25
! !
c −c
=P |Z| > p = 2FZ p
113/25 113/25
q
⇒ c = − 113 FZ−1 (α/2)
q 25
⇒ c = − 113 FZ−1 (0.025)
q 25
⇒ c = − 113
25
× (−1.96) = 4.167
Since, |X − Y | = |110 − 115| = 5 > 4.167
Therefore, we will reject H0 .
This implies that there a significant difference between the IQs of the two groups at a
0.05 level of significance.

2. A sociologist focusing on popular culture and media believes that the average number
of hours per week (hrs/week) spent on social media is different for men and women.
The researcher knows that the standard deviations of amount of time spent on social
media are 5 hrs/week and 6 hrs/week for men and women, respectively. Examining two
independent random samples of 64 individuals each, if the average number of hrs/week

1
spent on social media for the sample of men is 1.5 hours greater than that for the sample
of women, what conclusion can be made from a hypothesis test where, H0 : µM = µW
and HA : µM 6= µW ? Take α = 0.05.

a) Reject H0
b) Accept H0

Solution:
Let Xi and Yi represent the average number of hrs/week spent on social media by men
and women respectively.
X1 , X2 , . . . , X64 ∼ N(µ1 , 52 ) and Y1 , Y2 , . . . , Y64 ∼ N(µ2 , 62 )
|X − Y | = 1.5
Consider, H0 : µ1 = µ2 , HA : µ1 6= µ2
T = X − Y ∼ N(µ1 − µ2 , 25 64
+ 36
64
) i.e. N(µ1 − µ2 , 61 64
)
Test: Reject H0 if |T | > c.
!
T c
α = P (|T | > c | H0 ) = P |p |> p
61/64 61/64
! !
c −c
=P |Z| > p = 2FZ p
61/64 61/64
q
⇒ c = − 61 F −1 (α/2)
64 Z
q
⇒ c = − 61 FZ−1 (0.025)
q 64
⇒ c = − 61
64
× (−1.96) = 1.913
Since, |X − Y | = 1.5 < 1.913
Therefore, we will accept H0 .

3. An IITM instructor conducts two live sessions for two different classes, call it A and
B, in Statistics. Session A had 25 students attending while session B had 36 students.
The instructor conducted a test for the two sessions. Although there was no significant
difference in mean grades, session A had a standard deviation of 10 while session B had
a standard deviation of 14. Can we conclude at the 0.01 level of significance that the
variability in marks of class B is greater than that of A?

a) Yes
b) No

Hint: Use FF−1(35,24)


(0.99) = 2.529
Solution:
H0 : σ1 = σ2 , HA : σ1 < σ2

2
SB2
Test: Reject H0 if > 1 + cR
SA2
SB2
We know that, ∼ F (n2 − 1, n1 − 1)
SA2
n1 = 25, n2 = 36
S2
⇒ B2 ∼ F (35, 24)
SA
Therefore,

α = 1 − FF (35,24) (1 + cR )
⇒ 1 + cR = FF−1(35,24) (1 − α) = FF−1(35,24) (0.99)
⇒ 1 + cR = 2.529

SB2 2
Since, 2
= 14
102
= 1.96 < 2.529
SA
Therefore, we will accept H0 .
This implies that at the 0.01 level of significance the variability in marks of class B is
not greater than that of A.

4. The manufacturer of a new car claims that a typical car gets a mileage of 40 kilometres
per litre. We think that the mileage is less. To test our suspicion, we perform the
hypothesis test with H0 : µ = 40 and HA : µ < 40. Suppose we take a random sample of
900 new cars and find that their average mileage is 39.8 kilometres per litre and sample
standard deviation is 2, what does a t-test say about a null hypothesis with a significance
level of 0.05?

a) Reject H0
b) Accept H0

Hint: Use Ft−1


899
(0.05) = −1.646
Solution:
Null hypothesis, H0 : µ = 40
Alternate hypothesis, HA : µ < 40
Test: Reject H0 if X < c
Given, α = 0.05 and X = 39.8
In this problem, we do not know the population variance, σ 2 .
The sample variance S 2 = 22

α = P (X < c|µ = 40)


!
X − 40 c − 40
α=P p <p
S 2 /n S 2 /n

3
!
X − 40 c − 40
α=P p <p
4/900 4/900
!
c − 40
α = Ft899 p
4/900
!
c − 40
0.05 = Ft899 p
4/900
r
4 −1
c = 40 + F (0.05)
900 t899
c = 39.89
Since, X < c, reject H0 .

5. The standard deviation of weights of 70 gram bags of white cheddar popcorn is expected
to be 2.5 grams. A random sample of 20 packages showed a standard deviation of 3
grams. Is the apparent increase in variability significant at the 0.05 level.?

a) Yes
b) No

Hint: Use Fχ−1


2 (0.95) = 30.14
19
Solution:
As per given information, the null and alternative hypothesis are given by

H0 : σ = 2.5, HA : σ > 2.5

Define a test statistic T as T = S 2 .


(n − 1)S 2 19S 2
We know that 2
= 2
∼ χ219 .
σ 2.5
Test: reject the null hypothesis if S 2 > c2 .
If the significance level of the test is 0.05, then

4
P (S 2 > c2 ) = 0.05
19S 2 19c2
 
⇒P > = 0.05
2.52 2.52
19c2
 
2
⇒P χ19 > = 0.05
2.52
19c2
 
2
⇒1 − P χ19 < = 0.05
2.52
19c2
⇒ 2 = 30.14
2.5
6.25 × 30.14
⇒c2 = = 9.91
19
Since S 2 = 9 < 9.91, we will not reject the null hypothesis.
Therefore, the apparent increase in variability is not significant at the 0.05 level.

6. Independent random samples of ceramic produced by two different processes were tested
for hardness. The results are:

Process 1 Process 2
8.5 9.0
9.5 9.5
8.0 10.5
9.0 9.5
10.0 10.0
9.5 9.0
10.5 9.0
10.0 9.5

Table 11.1.G

Can we conclude at 5% level of significance that the variances in hardness are equal?

a) Yes
b) No

Hint: Use FF−1(7,7)


(0.025) = 0.2
Solution:
Let Process 1 and Process 2 values denoted by Xi and Yi respectively.
H0 : σ1 = σ2 , HA : σ1 6= σ2
S2 S2
Test: Reject H0 if X2 > 1 + cR or X2 < 1 − cL
SY SY

5
2
SX
We know that, ∼ F (n1 − 1, n2 − 1)
SY2
n1 = 8, n2 = 8
S2
⇒ X2 ∼ F (7, 7)
SY
Therefore,

α/2 = FF (7,7) (1 − cL )
⇒ 1 − cL = FF−1(7,7) (α/2) = FF−1(7,7) (0.025)

⇒ 1 − cL = 0.2
S2
Since, X2 = 0.2857
0.6964
= 2.437 > 0.2
SY
Similarly we can check for other condition.

α/2 = 1 − FF (7,7) (1 + cR )
⇒ 1 + cR = FF−1(7,7) (1 − α/2) = FF−1(7,7) (0.975)

⇒ 1 + cR = 4.99
2
SX 0.6964
Since, 2 = 0.2857 = 2.437 < 4.99
SY
Therefore, we will accept H0 .

7. The standard deviation of a component in a drug is expected to be 0.00002 kg. A


pharmacist suspecting the variability to be higher obtains a sample of 8 drugs and found
the sample standard deviation to be 0.00005 kg.

1. Identify the null and alternative hypothesis:


(a) H0 :σ = 0.00002, HA :σ > 0.00002
(b) H0 :σ = 0.00005, HA :σ 6= 0.00005
(c) H0 :σ = 0.00002, HA :σ < 0.00002
(d) H0 :σ = 0.00002, HA :σ 6= 0.00002
2. What conclusion would a χ2 test reach at a significance level of 0.01?
(a) Accept the null hypothesis.
(b) Accept the alternative hypothesis.

Solution:
As per given information, the null and alternative hypothesis are given by

H0 : σ = 0.00002, HA : σ > 0.00002

Define a test statistic T as T = S 2 .

6
(n − 1)S 2 7 × 0.000052
We know that = ∼ χ27 .
σ2 0.000022
Test: reject the null hypothesis if S 2 > c2 .
If the significance level of the test is 0.01, then

P (S 2 > c2 ) = 0.01
7 × 0.000052 7 × c2
 
⇒P > = 0.01
0.000022 0.000022
7 × c2
 
2
⇒P χ7 > = 0.01
0.000022
7 × c2
 
2
⇒1 − P χ7 ≤ = 0.01
0.000022
7c2
 
⇒Fχ27 = 0.99
0.000022
7c2
⇒ = 18.475
0.000022
18.475 × 0.000022
⇒c2 = = 10.56 × 10−8
7
Since S 2 = 25 × 10−8 > 10.56 × 10−8 , we will reject the null hypothesis.

7
Statistics for Data Science - II
Week - 12 Graded Sept 2024

Week - 12 :
1. A group of scientists is investigating the durability of two types of eco-friendly batteries,
SolarCell and GreenPower, under constant usage. A random sample of 9 SolarCell
batteries shows a standard deviation in battery life of 3.8 hours, while a random sample
of 12 GreenPower batteries has a standard deviation in battery life of 2.9 hours. Can
the scientists conclude that the variability in battery life for SolarCell is greater than
that of GreenPower?
Hint: FF−1(9,12) (0.95) = 2.80, FF−1(9,12) (0.99) = 4.39, FF−1(8,11) (0.95) = 2.95, FF−1(8,11) (0.99) =
4.74
(a) There is not enough evidence at 5% level of significance to conclude that the vari-
ability in battery life is greater for SolarCell than for GreenPower batteries.
(b) There is enough evidence at 5% level of significance to conclude that the variability
in battery life is greater for SolarCell than for GreenPower batteries.
(c) There is not enough evidence at 1% level of significance to conclude that the vari-
ability in battery life is greater for SolarCell than for GreenPower batteries.
(d) There is enough evidence at 1% level of significance to conclude that the variability
in battery life is greater for SolarCell than for GreenPower batteries.
Answer : a, c
Solution :
Given :

Number of samples of Solar Panel, n1 = 9


Standard deviation, S1 = 3.8
Number of samples of Solar Panel, n2 = 12
Standard deviation, S2 = 2.9

Now,

Null hypothesis, H0 : σ1 = σ2
Alternative hypotheses, HA : σ1 > σ2

S12
Test : Reject H0 if > 1 + cR
S22
S12
We know that, ∼ F (n1 − 1, n2 − 1)
S22
S12
Therefore, ∼ F (8, 11)
S22

1
α = P (RejectH0 |H0 )
α = P (T > 1 + cR |σ1 = σ2 )
α = 1 − P (T > 1 + cR )
α = 1 − FF (8,11) (1 + cR )

Now for α = 0.05,

0.05 = 1 − FF (8,11) (1 + cR )
1 − 0.05 = FF (8,11) (1 + cR )
0.95 = FF (8,11) (1 + cR )
FF−1(8,11) (0.95) = 1 + cR
1 + cR = 2.95

Now for α = 0.01,

0.01 = 1 − FF (8,11) (1 + cR )
1 − 0.01 = FF (8,11) (1 + cR )
0.99 = FF (8,11) (1 + cR )
FF−1(8,11) (0.99) = 1 + cR
1 + cR = 4.74

Also,

S12 3.8
2
=
S2 2.9
S12
= 1.31
S22

S12 S12
Since, < 2.95 for α = 0.05, and < 4.74 for α = 0.01
S22 S22
Therefore, we will accept H0 .
Hence option a and c are correct options.

2. Suppose X ∼ Normal(µ1 , 3) and Y ∼ Normal(µ2 , 4). For n1 = n i.i.d. samples of


X and n2 = 8 samples of Y , the observed sample means of X and Y are 10.2 and
8.2, respectively. Let the null hypothesis be µ1 = µ2 against an alternative hypothesis
µ1 ̸= µ2 . Consider a two sample Z− test that rejects H0 if |X −Y | > c for some constant
c at 5% level of significance. If the value of c is 1.625, then find the value of n. Round
off your answer to the next greatest integer.
Hint: FZ−1 (0.025) = −1.96

2
Answer : 16 ; Range : (15 - 18)
Solution :
Given,
X ∼ N (µ1 , 3) and Y ∼ N (µ2 , 4)
n1 = n and n2 = 8
X = 10.2 and Y = 8.2
Significance level, α = 0.05
Critical value, c = 1.625
Now,
Null hypothesis, H0 : µ1 = µ2
Alternative hypothesis, HA : µ1 ̸= µ2
Test: Reject H0 if |X − Y | >
c 
3 4
We know that, X − Y ∼ N µ1 − µ2 , +
n 8

α = P (RejectH0 |H0 )
0.05 = P (|X − Y | > c|µ1 = µ2 )
 
 |X − Y | 1.625 
0.05 = P  r
 3 4 > r 
3 4
+ +
n 8 n 8
 
 1.625 
|Z| > r 3 4 
0.05 = P  
+
n 8
 
 −1.625 
0.05 = 2P  Z < r 
 3 4
+
n 8
 
0.05  −1.625 
=P Z<r 
2  3 4
+
n 8
 
 −1.625 
0.025 = P  Z < r 
 3 4
+
n 8

3
 
 −1.625 
0.025 = FZ  r 3 4 

+
n 8
−1.625
FZ−1 (0.025) = r
3 4
+
n 8
−1.625
−1.96 = r
3 4
+
n 8
r
3 4 −1.625
+ =
n 8 −1.96

Squaring both sides,

3 1
+ = 0.687
n 2
3
= 0.69 − 0.5
n
3
n=
0.19
n = 16

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy