Hypothesis Testing (WithSolutions)
Hypothesis Testing (WithSolutions)
Hypothesis Testing (WithSolutions)
Exercise 1
Provide the general definition of p-value.
The p-value (or observed significance level) is the probability of obtaining a value of the statistics test
equal to or more extreme than that observed, assuming the null hypothesis is true.
Exercise 2
The variable “time spent studying for the exam XYZ (in hours)” is assumed to be normally distributed with a
standard deviation equal to 12.7. The average time spent studying for the exam XYZ was believed to be 200
hours, but now there is a suspicion that this average has decreased. In a random sample of 20 students the
sample mean was equal to 192.5.
a) Correctly state the two hypotheses we need to verify, explaining briefly the reasons of your choice.
b) Calculate the p-value corresponding to the given sample result.
c) If we choose α = 0.05, would the null hypothesis be rejected? Justify your answer.
a) The hypothesis we want to verify, “average time less than 200” should be placed in H1, so that it will
only be accepted if the empirical evidence is sufficient. On the other hand, the equal sign must always
be in H0. Therefore, we have: H0 : µ ≥ 200 vs H1 : µ < 200
In this way, we reject H0 only if we have empirical evidence to support our suspicion.
c) Since p-value < α, the null hypothesis, H0, is rejected. In other words we have more than 99%
confidence that the “average time used in studying for the exam XYZ (hours)” has decreased (is now
less than 200).
Exercise 3
The transit police department wants to verify that the average speed of cars on a certain road has really
decreased after the speed limit was reduced. During the past year, the average speed on that road was 75 km/h.
The speed of 5 randomly chosen cars running on that road is measured with an “autovelox” (speed measuring
machine), with these results (in km/h):
64 44 72 81 50.
We can suppose that the car speed is normally distributed.
a) Correctly state the two hypotheses we need to verify, explaining briefly the reasons of your choice.
b) Test the two hypotheses using the results of the given sample and a level of significance of 5%. What can
you say about the issue of concern of the transit police?
a) The hypothesis we want to verify, “new average speed less than 75 km/h”, must be placed in H1, while
H0 is the starting hypothesis (containing the equal sign and true until sufficient evidence is found
against it). So, we have:
H0 : µ =75 or (µ ≥ 75) vs H1 : µ < 75
62.2 − 75
d) t* = = −1.87426 à t4, 0.05 = −2.132 à -1.87426>-2.1232 NOT REJECT H0
15.2709 5
e) Empirical evidence is NOT enough to support the transit police’s hypothesis of a reduction of the average
speed.
Exercise 4
You suspect that customers have reduced the purchase of glass-packaged foods, due to the introduction of a
new tax on the disposal of glass waste. Before the introduction of this new tax, the average number of glass-
packaged foods sold in a month was 3.25. After the new tax is imposed, you collect information on a random
sample of 400 customers, regarding the number of glass-packaged foods they buy in a month. The sample
average is 3.15 with a sample standard deviation equal to 2.25.
a) Define the first-type error.
b) Calculate the p-value to verify the hypotheses: H0: µ = 3.25 against H1: µ < 3.25.
c) Do you reject or not the hypothesis H0: µ = 3.25 if α is set to 0.01? Justify your answer.
a) It is the error that one commits if one rejects the null hypothesis when it is in fact true.
d) b)
H 0 : µ = 3.25
e) H 1 : µ < 3.25
n = 400
x = 3.15
f) s = 2.25
g) As the sample size is large one can use the normal approximation:
⎛ ⎞
⎜ ⎟
3.15 − 3.25 ⎟ ⎛ − 0.1 ⎞
( )⎜
p − value = P X < x | H 0 : µ = 3.25 = P Z <
⎜ 2.25 ⎟
= P⎜ Z < ⎟ = P(Z < −0.8889 ) =
0.1125 ⎠
⎝
⎜ ⎟
h) ⎝ 400 ⎠
i) = P(Z > 0.8889) = 1 − F (0.8889) = 1 − 0.8133 = 0.1867
Exercise 5
A car dealer asks a random sample of 5 potential customers to provide a score (from one to 100) for a certain
vehicle. The score is collected before and after a test-drive, providing the results found in the table, below.
You want to make sure that the test-driving experience has a positive effect on the scores reported by the
potential customers. Assume that the distributions of the scores before and after the test are both normally
distributed.
a) We have to perform a test on the difference between the population means, using two PAIRED samples.
We define the variable d =score before the test-drive minus score after the test-drive. We must, then,
test the following hypotheses:
H 0 : µd = µ x − µ y ≥ 0 = d 0
H1 : µd = µ x − µ y < 0 = d 0
d)
In this way, we will conclude that the mean score after the test-drive is higher (accept the alternative
hypothesis) only if the data provides sufficient evidence against the null hypothesis.
d − d0
b) We reject H0 if: < −t n −1,α
sd
n
d − d0 − 2.94
= = −1.89
sd 3.4761
n 5
e)
− t n −1,α = −t 4, 0.05 = −2.132
f)
g) − 1.89 > −2.132 , we do not have enough evidence to reject H0.
c) The result would be the same. If α decreases, − t n −1,α will be smaller − 1.89 > −t 4, 0.05 > −t 4, 0.01
Exercise 6
The quantity of a particular pollution element in Milan, registered with the right unit of measure, follows a
Normal distribution with expected value µ and variance σ 2 = 4. If the actual average quantity µ is more
than 6.5, some anti-pollution measure must be taken.
a) Write the hypotheses we should test, explaining them, and write the general rule we should use to make a
decision.
b) Let’s suppose that, in a sample of 10 measure stations in Milan, the registered SUM of the quantity of that
element is 72; what decision would you would make about anti-pollution actions, using a level of
significance α = 0.05?
c) What is the meaning of the Power of a test? What is its relation with the Type II error?
d) Calculate the probability of Type II error, assuming a true value of µ = 7.
x − µ0
Reject H0 if > zα , i.e. if x > µ0 + zα · σ/√n, since the population’s variance is known.
σ
n
b) x = 72 / 10 = 7.2.
3
As zα = 1.645 (for α = 0.05),
then x = 7.2 < µ0 + zα · σ/ n = 6.5 + 1.645 · 2/√10 = 7.54, so we do not reject H0 and the anti-pollution
measure will not be taken.
7.2 − 6.5
Similarly: = 1.1068 < 1.645
2
10
c) The power of the test indicates the probability of rejecting H0 when H1 is true. It’s calculated as 1-β,
where β is the probability of making a type-II error (not rejecting H0 when H0 is false).
Exercise 7
An online publisher has recently changed its website in order to improve the procedures needed for e-
commerce. The average time to finalize a purchase was 12 minutes but the publisher is not sure, however, that
the change has really reduced the average time µ. So a survey is carried out on a sample of 85 customers who
have visited the new website and completed a purchase; the results obtained are the following:
85 85
2
∑ xi = 944.54
i =1
∑x
i =1
i = 11684.78
a) State the two hypotheses H0 and H1 and make the decision, with a level of α = 0.1
b) What is the definition of the first and second type errors in a statistical test? Describe and comment the
two errors in the publisher’s specific case.
a) H 0 : µ = 12 H1 : µ < 12
(Because n = 85 > 25, the Central Limit Theorem may be applied and no assumption of normality is
needed)
x − µ0
Decision rule: we reject the null hypothesis if t = < −t n−1,α = −t84, 0.1 ≅ − z 0.1 = −1.28
s
n
85 85
2
∑ xi ∑x i − nx 2
944.54 11684.78 − 85 ⋅ 11.1122 2
x= i =1
= = 11.1122 ; s = i =1
= = 3.7621
n 85 n −1 84
11.1122 − 12
The observed test-statistic is equal to t = = −2.1757 . As –2.1757 < –1.28, we reject the
3.7621
85
null hypothesis. So the change in the website has significantly reduced the average time needed to
complete the purchase.
b) In general, a first type error is the rejection of the null hypothesis when the null hypothesis is true. The
second type error is the failure to reject the null-hypothesis when the null-hypothesis is false.
In the specified problem, a first type error is believing that the change has reduced the time for a purchase
when in reality it didn’t. While the second type error is believing that the change didn’t produce positive
effects when in reality it reduced the time spent for a purchase.
4
Exercise 8
Mr. Brown goes to work by bike every day, spending around 25 minutes. The municipality has just opened a
new bike route with the intention of improving the bike circulation. In order to evaluate whether the average
time µ spent to go to work has effectively decreased, Mr. Brown extracts a sample of 5 days with the following
times (in minutes):
a) Supposing that the time spent by Mr. Brown to go to work follows a Normal distribution with standard
deviation of 2.65, write down the hypotheses to be tested and compute the p-value of the test.
b) If you were to fix α = 0.05, would you reject the null hypothesis (H0 ) of the previous point? Motivate
your answer.
Exercise 9
Considering a sample of 10 observation with sample standard deviation equal to 1.8154 and sum of the
observations equal to 33 (in millions of Euro), we would like to verify whether the population mean of the
variable “Sales (Y)” can be considered above 3.6 millions of euro, under the assumption of normality of its
distribution.
a) Write down the hypotheses and explain the reason of your choice.
b) Compute the rejection region for the null hypothesis with α=5%.
c) Based on the sample results and on the region previously computed, what can you say about the average
value of Y?
d) Write down the definition of the First Type Error in a test of hypotheses.
5
e) H 0: µ Y = 3.6 (= µ0,Y) vs H 1: µ Y > 3.6
f) In this way, by rejecting the null hypothesis we may conclude, for a certain level of significance, that the
mean Y is above 3.6 million of euro.
d) The First Type Error in a test of hypotheses is defined as rejecting the null hypothesis when the null
hypothesis is true. The probability of commiting the error is denoted by α, the significance level of the
test.
Exercise 10
In a 2003 survey, workers of a small town were asked which means of transport they were using to reach the
work place. These were the results:
The survey was repeated in 2007 on a sample of 1000 workers of the same town, with these results:
Private Car Public Transport Others
Absolute Frequency 530 390 80
a) Estimate the percentage of workers that, in 2007, reached the work place with a private car.
b) Verify, with a level of significance of 1%, if the proportion of Public Transport users in 2007 is greater
than in 2003.
530
a) As estimator we can use the sample proportion, so the estimate will be: pˆ = = 0.53 .
1000
b) The hypotheses are: H 0 : p = 0.35 vs. H1 : p > 0.35 , where p is the population proportion of Public
Transport users in 2007. We reject the null hypothesis if:
p0 (1 − p0 )
rifiuto H 0 se pˆ > p0 + zα
n
where p0 = 0.35, α = 0.01 and z0.01 = 2.33 .
We have:
p0 (1 − p0 ) (0.35)(0.65)
p0 + zα = 0.35 + 2.33 = 0.3851
n 1000
390
pˆ = = 0.39 > 0.3851
1000
6
So we reject H0 and conclude, at a 1% significance level, that the proportion of Public Transport users
in 2007 is higher than in 2003.
Exercise 11
In a sample of 100 students who have done a stage at a company in 2007, 80 evaluate the experience as
positive. In the past years, the percentage of students who considered the experience as positive was 70%. We
want to check if the situation has significantly changed.
a) What are the two hypotheses that we should test?
b) Test the hypotheses with a level of significance of 1%, and give your final answer.
c) Give a theoretical definition of the probability of Type II error.
b) We reject H0 if:
p0 (1 − p0 ) or if p (1 − p0 )
rifiuto H 0 se pˆ < p0 − zα / 2 oppure pˆ > p0 + zα / 2 0 ;
n n
Exercise 12
The owner of a disco wants to build a new area for hip-hop because he thinks that more than 50% of young
people like this kind of music. However, he wants to implement the investment only if his opinion is confirmed
by a statistical test. With this aim, he asks a market research company to carry out a survey where a random
sample of potential customers answer the question “Do you like hip-hop music?” The number of “Yes” was
61 out of 100 interviewees.
a) Write the null and alternative hypotheses to verify. Justify your choice.
b) Calculate the p-value for the hypotheses you have chosen.
c) Setting α to 0.01, will the owner decide to do the investment and build the new area for hip-hop? Justify
your answer.
a)
⎧⎪ H 0 : p ≤ 0.5
⎨
⎪⎩ H1 : p > 0.5
b) H1 is the hypothesis that the owner wants to verify through evidence. By choosing this as the alternative
hypothesis, the first-type error is the most serious mistake, because if we reject H0 when this is true, the
owner will wrongly do the investment.
7
b) We have a right-tail test on a population proportion. The observed sample proportion is:
61
pˆ = = 0.61
100
Exercise 15
In a recent report, the Police have indicated that, out of a random sample of 80 license suspensions on a
Saturday night, 57 are related to excessive alcohol consumption. Let p be the proportion of alcohol-related
license suspensions on Saturdays. Based on the sample reported on by the Police:
a) Compute a 90% confidence interval for p.
b) Would you reject the null hypothesis that p = 0.5 , when tested against the bilateral alternative, using the
level of significance α = 0.1?
a) The general expression for the 90% confidence interval for the sample proportion is:
⎛ pˆ (1 − pˆ ) pˆ (1 − pˆ ) ⎞
c.i.0.90 ( p) = ⎜⎜ pˆ − z0.05 ; pˆ + z0.05 ⎟⎟ .
⎝ n n ⎠
From the sample data we get:
57
pˆ = = 0.7125,
80
The confidence interval for the proportion of alcohol-related license suspensions is:
⎛ 0.7125(1 − 0.7125) 0.7125(1 − 0.7125) ⎞
c.i.0.90 ( p) = ⎜⎜ 0.7125 − 1.645 ; 0.7125 + 1.645 ⎟⎟
⎝ 80 80 ⎠
= ( 0.6293; 0.7957 )
b) with z0.05 = 1.645.
b) Because 𝑝
=
0.5 does not belong to the confidence interval (0.6293; 0.7957) H0 is rejected.
Alternatively, one could have argued that, because the observed value of the test statistic, 𝑍
=
3.8013, is greater than the critical value corresponding to = 0.1, i.e. greater than 1.645, H0 is
rejected.
Exercise 16
A lottery takes place during a Carnival party. The banner at the lottery stand claims that “one out of 3 tickets
wins a prize”. The number of tickets sold is very large, and we know they are distributed to participants at
8
random. After purchasing 50 tickets, it turns out that 10 were winning tickets. Verify the veracity of the
assertion on the stand’s banner at a 5% level of significance. Use a lower tail test.
! 10
n= 50 and p = = 0,2 is the observed sample proportion. We need to test the hypotheses:
50
H0 : p ≥ 1/ 3
H1 : p < 1 / 3
Since the sample size is large enough, we can use the Central Limit Theorem to obtain:
⎛ p(1 − p) p(1 − p) ⎞
X ~ N ⎜⎜ µ X = p ; σ X = = ⎟
⎟
⎝ n 50 ⎠
At a 5% level of significance ( zα = 1,645 ) the rejection region for the null hypothesis is:
⎧⎪ pˆ − p0 ⎫⎪ ⎧ pˆ − 1 / 3 ⎫ ⎧ pˆ − 1 / 3 ⎫
R = ⎨ pˆ : < − zα ⎬ = ⎨ pˆ : < −1,645⎬ = ⎨ pˆ : < −1,645⎬
⎪⎩ p0 (1 − p0 ) / n ⎪⎭ ⎩ 1 / 3(1 − 1 / 3) / 50 ⎭ ⎩ 2/6 ⎭
Replacing the observed value pˆ = 0,2 we get {− 1,9995 < −1,645}, leading to the rejection of the null
hypothesis. There is enough empirical evidence to say that the banner is not truthful.
Exercise 17
A Japanese company is running a survey on the Italian market, to launch a new UMTS generation mobile
phone. The new mobile phone will be launched on the Italian market only if more than 35% of mobile phone
users are inclined towards a UMTS update. A random sample of 150 Italian mobile users is selected and
among them, 56 are declare to be inclined towards a UMTS technology update.
a) Write the hypotheses we should test, explaining them, and write the general rule we should use to make a
decision about the launch.
b) What decision would you make about the launch on the Italian market, using a level of significance
α = 0.01. ?
Since the sample is large enough, the decision rule is: Reject H0 if
pˆ − p0
> zα
p0 (1 − p0 )
n
.
56 0.3733 − 0.35 0.0233
b) Since pˆ = = 0.3733 , then = = 0.5983 < 2.33 = z0.01 so we don’t reject H0.
150 0.35 ⋅ 0.65 0.0389
150
We don’t launch the new technology
Exercise 18
The production manager of a large automobile factory believes that, due to the obsolescence of some parts of
the plant, the production process of a specific kind of engine may have recently experienced important
9
deviations from its normal functioning, with the associated inefficiencies in the production. Out of a sample
of 1000 valves to be mounted on the engines, a total of 38 valves were found to be defective.
a) Test, at the significance level of 0.01, the null hypothesis that at most 3% of the valves produced are
defective.
b) For the test used above, what is the probability that the null hypothesis is rejected if the true percentage of
defective valves in the production is equal to 3.5%?
a) H 0 : p ≤ 0.03
H1 : p > 0.03
We have:
n = 1000
38
pˆ = = 0.038
1000
pˆ − 0.03
We reject H0 if: > zα .
0.03 ⋅ (1 − 0.03)
1000
It follows that
b) We want to compute the power of the test, i.e. the probability of rejecting the null hypothesis when
it is false.
⎛ ⎞
⎜ ⎟
ˆ
P − 0.03 ⎛ 0.03 ⋅ 0.97 ⎞
Power (0.035) = P ⎜ > 2.33 | p = 0.035 ⎟ = P⎜⎜ Pˆ > 0.03 + 1.645 ⋅ | p = 0.035 ⎟⎟ =
⎜ 0.03 ⋅ 0.97 ⎟ 1000
⎜ ⎟ ⎝ ⎠
⎝ 1000 ⎠
⎛ ⎞
⎜ ⎟
Pˆ − 0. 035 0 . 038 − 0 .035
( )
= P Pˆ > 0.038 | p = 0.035 = P ⎜
⎜ 0.035 ⋅ 0.965
> ⎟ =
0.035 ⋅ 0.965 ⎟
⎜ ⎟
⎝ 1000 1000 ⎠
P(Z > 0.5162 ) = 1 − P(Z < 0.5162 ) ≅ 1 − 0.6985 = 0.3015
10
Exercise 19
A specific point of a highway has a speed limit of 60 Km/h. The Highway Patrol wants to perform a statistical
test concerning the speed of vehicles on that point of the highway. To that purpose, they collect information
on a random sample of 90 vehicles, which yields an average speed of 64.8 Km/h and a standard deviation of
23.2 Km/h.
a) Test the hypothesis that the average speed of vehicles that drive through that point of the highway is equal
to 60 Km/h, against the alternative that it is greater than 60 Km/h. Use the p-value approach.
b) Make a decision using the results from a), using the level α = 0.05.
c) If the null hypothesis were to be tested against a two-sided alternative hypothesis, would the p-value
change from the one computed in a)? Briefly justify your answer.
d) The Highway Patrol wants to determine if the variance of the speed of vehicles on that point of the highway
is within the established standard, with α = 0.05. This standard states that the variance cannot exceed
550(km/h)2.
a) Let µ be the mean of the speed of cars at that point in the highway. We wish to test the following
hypotheses:
H 0 : µ = 60
H 1 : µ > 60
x − µ0
Decision rule: we reject H 0 if t = > t n −1,α .
s
n
Another way to make a decision is by rejecting the null hypothesis if the p-value is smaller than the
level of significance of the test. In other words, if p-value = Pr(T > t ) < α .
The observed test statistic is:
64.8 − 60
t= = 1.9628
23.2
90
p-value = Pr(T > 1.9628) = 0.025 , which we calculate by using the normal approximation to the t-
Student distribution (since n is large).
c) Yes. For a two- sided alternative hypothesis, both tails of the distribution must be considered when
calculating the p-value:
Pr( T > 1.9628) = Pr(T > 1.9628) + Pr(T < −1.9628) = 2 Pr(T > 1.9628) = 2 ⋅ 0.025 = 0.05
𝑛 − 1 𝑠> >
> 𝜒)*+,,
𝜎$>
For this test, the Chi-square distribution has degrees of freedom df = 90 -1 = 89.
The test is one-lateral and
11
𝑛 − 1 𝑠> 89
23.2 >
> > >
> =
= 87.0970 < 𝜒)*+,, = 𝜒GH,$.$I ≈ 𝜒H$,$.$I = 113.1
𝜎$ 550
The observed statistic does not lie in the rejection region, so the decision is not to reject the null
hypothesis. We conclude that there is not enough evidence to state that the variability of the speed of
vehicles on that point of the highway exceeds the standard.
Exercise 20
A doctor wants to study the calcium content in the 100-gram yoghurt cups sold by a specific producer. Should
she find sufficient evidence that the declared average calcium content of 110 mg is exceeded, then she would
recommend the brand to her patients. She collects a random sample of 70 yoghurt cups of that brand, and finds
that their average calcium content is equal to 113.5 mg, with a standard deviation of 3.5 mg.
a) State the hypotheses to be tested, briefly justifying your choice.
b) Calculate the p-value of the test.
c) Based on the p-value in b), should the doctor recommend the yoghurt brand to her patients?
d) Suppose that in this problem the doctor were to commit a type II error. What would the consequences be
for her patients?
e) The yoghurt producer states that the production process leads to a variance of the calcium content smaller
than 9 mg2. Is there empirical evidence that the producer can be trusted? Conduct a hypothesis test, with
significance level equal to 0.05.
f) Compute (or approximate) the p-value for the test at point e).
b) The p-value represents the probability that the test statistic could have a more extreme value than the
M*NO
one observed in this sample. For the upper-tail test the test statistics, 𝑇 = P , has a t-Student
)
distribution with 𝑛 − 1 degrees of freedom, if the null hypothesis is true. In our case n-1.= 69, and the
statistics’ distribution can be approximated by a Normal distribution; the statistics corresponding to our
sample data is
++Q.I*++$
𝑇= = 8.3666, thus
Q.I/ S$
p − value = 𝑃
𝑍
>
8.3666 ≈
0.
c) Because the p-value is approximately equal to 0 we reject H0 for any value of α. Thus, the doctor found
empirical evidence that yoghurt contains over 110mg of calcium, and can recommend it to her patients.
d) Type-2 error: i.e. not rejecting H0 when it is actually false. Assuming H0 is false, i.e. assuming the
yoghurt contains over 110mg of calcium, but the doctor did not reject it, she would not recommend the
yoghurt to patients, although it contains a sufficient amount of calcium.
12
> aH
∙Q.Ic
For the data at hand, we have 𝜒\]^ = = 93.9167 > 51.74. We cannot reject the null hypothesis:
H
there is not a sufficiently strong empirical evidence in favor of the statement of the producer.
f) We need to compute
> > >
p − value = 𝑃
𝜒aH < 93.9167 ≈ 𝑃
𝜒S$ < 93.9167 = 1 − 𝑃
𝜒S$ > 93.9167
The value 93.9167 cannot be found on the tables, but we have:
> > >
𝜒S$,$.$I = 90.53 < 93.9167 = 𝜒\]^ <
95.02 = 𝜒S$,$.$>I
Exercise 21
A pharmaceutical company produces two painkillers (drug A and drug B). The head of the pharmaceutical
company claims that the drug B, while having fewer side effects than the drug A, needs a longer time before
having effect. The two drugs have been administered to two matched samples of 6 individuals each, matched
for age, sex, and pathology observed. The waiting times (in seconds) necessary for the drug to have effect are
reported in the following table:
In order to verify whether the claim of the head of the pharmaceutical company is supported by enough
empirical evidence we decide to apply an appropriate hypothesis test.
a) State the assumptions that are necessary in order to run an appropriate hypothesis test.
b) After having stated the hypotheses to be verified (null and alternative hypothesis), evaluate, at a 5%
significance level, whether the claim of the head of the pharmaceutical company is correct.
c) The head of the company also has the suspicion that the performance of drug B is more variable than that
of drug A, that is, the waiting times for drug B have larger variance than those of drug A, and thus that
drug B is less reliable than drug A. Since drug A has been on the market for a longer period, its standard
deviation can be assumed to be known and equal to 7 seconds. Is there evidence in favor of the hypothesis
of the head manager? Perform a test with a 10% significance level.
d) Compute (or approximate) the p-value for the test in point c).
a) We need to run a test on the difference between the means of two populations from which two dependent
samples have been extracted (matching samples). It is necessary to assume that the two populations are
normally distributed.
b) The null hypothesis is that the mean difference between the times necessary for the drug to have effect
is equal to 0 (or ≥ 0), while the alternative hypothesis is that the mean time necessary for the drug A to
have effect is shorter than the mean time necessary for the drug B to have effect. Therefore:
H 0 = µ A − µB = 0 (reference situation) (or: H 0 = µ A − µ B ≥ 0 )
H1 = µ A − µ B < 0(situation to be verified).
s
Denote with d and d , respectively, the sample mean and sample standard deviation of the n = 6
d
differences i between the values of each pair i of observations of the time of effect.
13
It results:
n n
2
∑ di ∑d i − nd 2
− 15 i =1 107 − 6 ⋅ 6.25
d = i =1
= = −2.5 s d = = = 3.7283
n 6 ; n −1 5
d − d0
< −t n −1,α
sd
The decision rule is the following: reject H0 if n .
− 2.5
= −1.6425
3.7283
6 − t 5, 0.05 = −2.015
Since is greater than I do not reject H0.
The claim of the head of the pharmaceutical company is not correct.
>
(𝑛 − 1)𝑠h> > >
𝜒\^^ = > >
𝜒)*+,$.+$ = 𝜒I,$.+$ = 9.236
𝜎$
> I
∙(+$.Q$Ga)c
For the data at hand, we have 𝜒\^^ = = 10.8436 > 9.236.
iH
a a >
Indeed, for drug B, kl+ 𝑥k = 1402 and kl+ 𝑥k = 328132, thus
a > >
1 a
kl+ 𝑥k 1 1402
𝒔𝟐𝑩 = 𝑥k> − 6 = 328132 − 6 = 𝟏𝟎𝟔. 𝟐𝟔𝟔𝟕
→ 𝒔𝑩 = 𝟏𝟎. 𝟑𝟎𝟖𝟔
5 kl+ 6 5 6
We reject the null hypothesis: there is sufficiently strong empirical evidence in favor of the statement
of the head manager.
>
d) Since 𝜒\^^ = 10.8436 is not available on the statistical tables, but
𝝌𝟐𝟓,𝟎.𝟏𝟎 = 9.236 < 𝟏𝟎. 𝟖𝟒𝟑𝟔 = 𝜒\^^ >
<
11.070 = 𝝌𝟐𝟓,𝟎.𝟎𝟓
we have
𝟎. 𝟏𝟎 = 𝑃
𝜒I> > 𝜒I,$.+$
>
> 𝐩 − 𝐯𝐚𝐥𝐮𝐞 = 𝑷
𝝌𝟐𝟓 > 𝟏𝟎. 𝟖𝟒𝟑𝟔 > 𝑃
𝜒I> > 𝜒I,$.$I
>
= 𝟎. 𝟎𝟓
Exercise 22
You suspect that people living in urban areas produce, on average, more garbage than those living in rural
areas. To verify this opinion, you draw two samples and collect information on the amount of garbage
14
produced in a month (measured in kilograms). The first sample, made by 8 Italians living in an urban area,
gives an average equal to 40.5 with standard deviation equal to 5.6; in the second sample, made by 10 Italians
living in rural areas, the average is 35.6 and the standard deviation is 7.5. It is assumed that the two populations
are normal with the same variance.
a) Let X and Y be two random variables that indicate the monthly quantity of garbage (in kilograms)
produced by residents who live within the city and outside the city, respectively. The alternative
hypothesis to be tested is that residents of urban centers produce on average more garbage than
residents outside the city, in other words, µ X > µY . This is a test for the difference between the means
of two populations with equal but unknown variances, with independent samples:
H0 : µX − µY = 0
H1 : µ X − µ Y > 0
c)
d) b)
n X = 8 x = 40.5 s X = 5.6
n Y = 10 y = 35.6 s Y = 7.5
e)
f) σ X2 = σ Y2 but unknown
x−y
> t n X + n Y −2,α
s 2p s 2p
+
nX nY
k)
m) 1.5338 < 2.583, and therefore we do not reject the null hypothesis. (0.1 > p-value = 0.0723 > 0.05)
Exercise 23
A company wants to verify if a recent advertisement campaign positively influenced customers’ opinion
toward the brand. To this aim, a random sample of 5 customers was asked to evaluate the brand (with a score
on a scale from 1 to 100) before and after the implementation of the advertisement campaign. The collected
information is organized in the following table:
15
Customer Score before the campaing Score after the campaing
1 85 88
2 99 99
3 52 60
4 21 35
5 72 73
a) Explain, in general terms, the difference between paired and independent samples.
b) Assuming that the variable “Score” is normally distributed, verify the effectiveness of the advertisement
campaign by using an appropriate statistical test. Use a significance level equal to 5%.
a) We have two DEPENDENT or PAIRED samples if each value of one sample corresponds to one of
the other sample. In other words, the observations are chosen in couples. If this is not the case, and the
observations in the two samples are drawn independently, then the two samples are INDEPENDENT.
16
d
Reject H 0 if: < −tn −1,α
sd
n
where :
n
∑ di −3 + 0 − 8 − 14 − 1 −26
i =1
d = = = = −5.2
n 5 5
⎛ n 2 ⎞
n ⎜ ∑ di ⎟ 5 ⎛ (−3) 2 + 02 + (−8) 2 + (−14) 2 + (−1) 2 2 ⎞ 5 ⎛ 270 ⎞ 5 5
sd2 = ⋅ ⎜ i =1 − d 2 ⎟ = ⋅ ⎜⎜ − ( −5.2 ) ⎟⎟ = ⋅ ⎜ − 27.04 ⎟ = ⋅ ( 54 − 27.04 ) = ⋅ 26.96 = 33.7
n − 1 ⎜ n ⎟ 4 ⎝ 5 ⎠ 4 ⎝ 5 ⎠ 4 4
⎜ ⎟
⎝ ⎠
sd = sd2 = 33.7 = 5.8052
therefore :
d −5.2
= = −2.003
sd 5.8052
n 5
tn −1,α = t4,0.05 = 2.132
d
Since = −2.003 > −tn −1,α = −2.132 → I do not reject H0
sd
n
Exercise 24
You want to establish whether there exists a significant difference between the average natural gas per-capita
consumption in cities of northern and central Italy. A random sample of cities is extracted within each region,
and the natural gas per-capita consumption (in m3 per inhabitant) is obtained for each city in each region. The
data are then summarized in this table:
a) Which assumptions do you need to make in order to answer the question above?
b) After clearly stating the hypotheses that you are testing, answer the question by performing the test with a
level of significance α = 0.01.
c) If a statistical test of hypotheses leads to the rejection of the null hypothesis, can we say that the null
hypothesis is not true? Justify your answer.
17
a) The assumptions are:
− The 2 samples are independent and come from normally distributed populations;
− The 2 populations’ variances are unknown, but assumed as equal.
b) The hypotheses to be tested are: H0 : µ X − µY = 0 vs. H1 : µ X − µY ≠ 0, where µ X is the average per-
capita gas consumption of cities in the North, and µY of cities in the Center.
We reject H0 if:
⎛ ⎞
⎜ ⎟
⎜ (x − y) (x − y ) ⎟
⎜ T = < −t n + n − 2,α /2 o T = > + t n + n − 2,α /2 ⎟
s 2p s 2p s 2p s 2p
X Y X Y
⎜ + + ⎟
⎜ nX nY nX nY ⎟
⎝ ⎠
where: n X = 8; x = 462; s X2 = 24321; nY = 5; y = 472; sY2 = 18811
c) No, even if we reject H0, we might be incurring in type-I error, that is, rejecting H0 when it is actually
true.
Exercise 25
There are two donuts stands in a square. We randomly pick 30 people who bought donuts from stand 1 and
40 who bought from stand 2. The 30 donuts from stand 1 have an average weight of 140.3 gr, with a standard
deviation of 16.4 gr. The 40 donuts from stand 2 have an average weight of 149.2 gr, with a standard deviation
of 21.2 gr.
a) After stating the necessary assumptions, build a 95% confidence interval for the difference between the
average weights of the donuts from the two stands.
b) Is it correct to state that the donuts sold at the two stands show a statistically significant difference in
weights? Justify your answer with α = 0.05.
a) in order to calculate the confidence interval for the difference between the two average weights we
need to assume:
-‐ independence between the populations
-‐ the two unknown variances are equal
The size of the samples is sufficiently large to apply the Central Limit Theorem, thus granting normality
of the distribution of the sample means.
Given the large number of degrees of freedom, we can approximate the student t-distribution with a
normal distribution.
Eventually, we get:
⎡ 1 1 ⎤
ic95% ( µ X − µY ) = ⎢(140,3 − 149,2) ± 1,96 ⋅ 19,2995 + ⎥ = [- 18,0361 ; 0,2361].
⎣ 30 40 ⎦
b) Because the value zero is included in the 95% confidence interval calculated above, it is NOT correct
to state that, at a 5% level of significance, the average weight of donuts sold by the two stands is
statistically different.
If we carry out an appropriate (two-sided) statistical test on the difference between the two average
weights, we will not reject the null hypothesis of equality of the parameters of the two populations.
Exercise 26
A simple random sample of 1000 mobile users is selected and data are collected about the brand of their
mobiles and their monthly mobile expenses in €. The following table shows the results:
Nr. Monthly
Brand
observations expenses (€)
Nokia 367 25.53
Samsung 215 28.78
Sony Ericsson 99 23.44
Apple 159 37.45
Others 160 24.01
You want to verify if people using Nokia mobiles spend more than Sony Ericsson users. For this purpose,
standard deviations of monthly expenses for the two groups are calculated, as 11.12 euro for Nokia users and
9.16 euro for Sony Ericsson users, respectively.
a) Formulate the statistical hypotheses we have to test. What assumptions do we need in order to run this
test?
b) Calculate the p-value of the test. With a significance value of α = 0.01, to what conclusion do we arrive?
a) Define:
X=”Average monthly expenses Nokia users”
Y=”Average monthly expenses Sony Ericsson users”
19
We want to verify:
H 0 : µ X = µY à H 0 : µ X − µY = 0
H1 : µ X > µY à H1 : µ X − µY > 0
We need to assume that the populations are normally distributed and the variances unknown but equal.
b)
n X = 367
nY = 99
x = 25,53
y = 23,44
s x = 11,12
s y = 9,16
X −Y
Test statistic: ~ t(nx +n y −2 ), under the null hypothesis.
S p2 S p2
+
nX nY
Since the number of degrees of freedom is very big (464), we can use an asymptotic approximation,
that is, the normal distribution, instead of the student-t.
⎛ ⎞
⎜ ⎟
⎜ X − Y ⎟
P-value = P⎜ > 1.7190 | H 0 ⎟ = P (Z > 1.7190 | H 0 ) = [1 − F (1.7190)] = (1 − 0.9572 ) = 0.0428
2 2
⎜ S p S p ⎟
⎜ n + n ⎟
⎝ X Y ⎠
Using a significance level of 0.01, since p − value > α , we cannot reject the null hypothesis: the
average monthly expenses of Nokia users is not statistically higher than that of Sony Eriksson users.
Exercise 27
A researcher wants to demonstrate that a particular blood parameter is different for smokers and no-smokers.
Two random samples are selected, the first one of 10 smokers, the second one of 10 no-smokers. The particular
blood parameter is measured, with these results:
Sample standard
Sample mean
deviation
No-
90.7 5.4
smokers
Smokers 87.2 4.8
20
Let µS – µNS be the difference between the average values of the blood parameter in the two populations of
smokers and no-smokers.
a) Calculate a 95% confidence interval for the difference between the two means.
b) Supposing a level of significance α = 5%, does evidence suggest that the blood parameter level is different
in the two groups?
⎛ s 2p s 2p s 2p s 2p ⎞
a) i.c.(1−α ) ( µ F − µ NF ) = xF − xNF − tnF + nNF −2,α /2
⎜ + ; xF − xNF + tnF + nNF −2,α /2 + ⎟ =
⎜ nF nNF nF nNF ⎟
⎝ ⎠
s 2p s 2p
ME = tnF + nNF − 2,α /2 +
= x F − x NF ± ME ; nF nNF
x F − x NF = 87.2 – 90.7 = -3.5
s 2p =
( nF − 1) sF2 + ( nNF − 1) sNF
2
=
9 ⋅ 4.82 + 9 ⋅ 5.42
= 26.1
nF + nNF − 2 10 + 10 − 2
26.1 26.1
α / 2 = 0.025 ; t18, 0.025 = 2.101 ; ME = 2.101
+ = 4.8002
10 10
i.c.0.95 ( µF − µNF ) = (−3.5 − 4.8002; −3.5 + 4.8002) = (−8.3002;1.3002)
a. Hence, .
b) Because the value 0 belongs to the confidence interval i.c.0.95 ( µF − µ NF ) , as resulting in point (c), we
do not reject the null hypothesis that the two means are equal, when tested again a two-sided
alternative, at a significance level α = 0.05 . We would get to the same conclusion considering that
(x − y) −3.5
T= = = −1.5319 > −t18,0.025 = −2.101.
2
sp sp 2
26.1 26.1
+ +
n n 10 10
F NF
Exercise 28
With the purpose of verifying if a fish based diet can reduce cholesterol, the following experiment has been
run: two independent samples of 100 men each have been selected, with the same average level of cholesterol.
The first one followed, for 6 months, a diet with a “reduced-fish diet”, the second one, for the same period,
followed a “fish-based diet”. Cholesterol levels, after the diet, for the two samples are:
Sample
Sample
mean
Variance
“Reduced-‐fish
diet”
210.1
37.4
“Fish-‐based
diet”
196.8
33.5
Test the starting hypothesis of the researchers using a one-tail test with a level of significance of 5%.
a) The necessary assumptions to specify are: the normal distribution of the weekly gain from the sale of
Jazz music discs and the equality between the variances of the two populations.
In order to verify whether there exists a significant difference in the level of satisfaction between the two
groups of workers, they decide to apply an appropriate hypothesis test.
a) Give the necessary assumptions in order to run an appropriate hypothesis test.
b) After having written the hypotheses, evaluate, at a 0.01 significance level, whether there exists a significant
difference in the level of satisfaction of the two groups of workers.
a) The two samples are independent and drawn from two populations, which we assume to be normally
distributed with equal (but unknown) variances.
b) The null hypothesis is that the average level of satisfaction of the workers in factory A is equal to the
average level of satisfaction of the workers in factory B (reference situation). The alternative hypothesis
is that the average levels of satisfaction µ A and µ B in the two factories are different (situation to be
verified). Therefore:
22
H 0 : µ A = µB ⇒ µ A − µB = 0
H1 : µ A ≠ µ B ⇒ µ A − µ B ≠ 0
In order to can implement the test, we need to estimate the common variance of the two populations:
(n − 1)s A2 + (nB − 1)s B2
s 2p = A
n A + nB − 2
The values of sample mean and variance for the two samples are:
5 5
∑ x Ai
i =1 370 ∑x
i =1
Bi
290
xA = = = 74 xB = = = 58
5 5 5 5
nA
2
∑x Ai − n A x A2
27796 − 5 ⋅ 74 2
s A2 = i =1
= = 104
nA −1 4
nB
2
∑x Bi − n B x B2
17184 − 5 ⋅ 58 2
s B2 = i =1
= = 91
nB − 1 4
4 ⋅104 + 4 ⋅ 91
s 2p = = 97.5
Hence, 5+5−2 .
The decision rule is: We reject H0 if either one of the following inequalities hold:
x A − xB − d 0 x A − xB − d 0
< −t α >t α
2 2
sp sp n A + nB − 2,
2 s 2p s 2p n A + nB − 2 ,
2
+ +
n A nB n A nB
74 − 58 − 0 16
= = 2.562 < t 8, 0.005 = 3.355
97.5 6.245
2⋅
5
So we do not reject H0.
There is no significant difference in the level of satisfaction of the two groups of workers .
Exercise 31
The following table contains the amount of fat contained in the finished product for a sample of 12 doughnuts,
obtained after having assigned them at random to one of two kinds (6 for A and 6 for B) of cooking fat.
Kind of cooking fat Fat content in final product (in mg.)
A 75.00 80.00 78.00 71.00 63.00 76.00
B 55.00 52.00 49.00 64.00 70.00 68.00
a) State the necessary assumptions for a hypothesis test on the difference between the two population means.
b) Test the null hypothesis that the means of the two populations are equal (against a two-sided alternative
hypothesis) at 0.02 level of significance.
b) x A = 73.8333, xB = 59.6667
x A − xB = 73.8333 − 59.6667 = 14.1667
23
(75 − 73.8333) 2 + .... + (76 − 73.8333) 2
s A2 = = 37.3667
5
(55 − 59.6667) 2 + .... + (68 − 59.6667) 2
s B2 = = 77.8667
5
(n − 1) ⋅ s A2 + (nB − 1) ⋅ s B2
s 2p = A
n A + nB − 2
s 2p =
(6 − 1) ⋅ 37.3667 + (6 − 1) ⋅ 77.8667 = 57.6167
6+6−2
t10, 0.01 = 2.764.
Since
(x A − x B ) − (µ A − µ B ) 14.1667
t* = = = 3.2326 > 2.764
⎛ 1 1 ⎞ ⎛ 1 1 ⎞
s 2p ⎜⎜ + ⎟⎟ 57.6167 ⋅ ⎜ + ⎟
⎝ n A n B ⎠ ⎝ 6 6 ⎠
we reject H0: µ1 = µ2 at 2% level of significance. The two groups of donuts are different in terms of fat
content.
Exercise 32
Table1 shows data about four different variables in a sample of 10 Countries.
AREA geographic area of the Country (Europe, South America, Other)
GDP GDP per capita (‘000$) year 2011
EXP life expectancy at birth (in years) year 2011
EDU literacy rate year 2011
We want to build a 99% confidence interval for the difference between the means of variable EXP in countries
belonging to Europe and Other areas.
a) State the necessary hypotheses we need to assume.
b) Calculate the confidence interval.
c) Without any further calculation, can we say, with a level of significance 1%, that there is a difference
between the mean of EXP in countries belonging to AREA Europe and those belonging to AREA Other?
Justify your answer.
24
a) Assumptions:
-the two populations have distributions with mean µ x (AREA Europe) and µ y (AREA Other)
-the two populations are normally distributed
-the two samples are independent
-the two population variances are unknown but assumed to be equal
b)
b) Considering X : Life expectancy (EXP) for AREA Europe Countries and Y: Life expectancy (EXP)
for AREA Other Countries
nx = 4
ny = 4
n
∑ xi
x = i =1 =
322.9
= 80.7250
nx 4
n
y=
∑i =1 yi =
250.9
= 62.7250
ny 4
⎛ n 2 ⎞
n x ⎜ ∑i =1 xi 2 ⎟ 4 ⎛ 26068.47 ⎞
s x2 = − x ⎟⎟ = 3 ⎜ − 80.7250 2 ⎟ = 0.7892
n x − 1 ⎜⎜ n x ⎝ 4 ⎠
⎝ ⎠
n
n y ⎛⎜ ∑i =1 yi2 ⎞
2 ⎟ 4 ⎛ 16154.25 ⎞
s 2y = − y ⎟⎟ = 3 ⎜⎝ − 62.7250 2 ⎟ = 138.8492
n y − 1 ⎜⎜ n y 4 ⎠
⎝ ⎠
(n x − 1)s x2 + (n y − 1)s 2y (4 − 1)0.7892 + (4 − 1)138.8492 = 2.3675 + 416.5475 = 69.8192
s 2p = =
nx + n y − 2 4+4−2 6
t n x + n y − 2;α / 2 = t6;0.005 = 3.707
.
c) Since the value 0 is not within the confidence interval, we reject the null hypothesis H 0 : µ x − µ y = 0 VS
the alternative hypothesis H 1 : µ x − µ y ≠ 0 at a significance level of 1%.
The same conclusion considering:
( x − y ) − (µ x − µ y ) (80.7250 − 62.7250) − 0 18
t= = = = 3.0465 < t nx + n y −2;α / 2 = 3.707
s 2p s 2p 69.8192 69.8192 5.9084
+
+ 4 4
nx ny
Exercise 33
A bookshop needs to explore the buying behavior of its customers and has collected the following data:
EXPENDITURE Average expenditure for books (in Euros)
NR number of purchased books
AGE customer’s age
The following tables (table 1 and table 2) collect information of two different customer samples (Fiction and
Essays books’ customers).
a) Assumptions:
-the two populations have distributions with mean µ x (expenditure for fiction books) and µ y
(expenditure for essays books)
-the two populations are normally distributed
-the two samples are independent
-the two population variances are unknown but assumed to be equal.
b)
nX = 7
nY = 5
x = 34, 4286
y = 49,8
n 1 n 7 1
s x2 = ⋅ ( ∑ xi 2 − x 2 ) = ⋅ ( 11709 − 34, 42862 ) = 568,6168
n − 1 n i =1 6 7
n 1 n 5 1
s 2y = ⋅ ( ∑ yi 2 − y 2 ) = ⋅ ( 13065 − 49,82 ) = 166, 2
n − 1 n i =1 4 5
2 2
( n − 1) sX + ( nY − 1) sY = (7 − 1)568,6168 + (5 − 1)166,2 = 407,6501
s 2p = X
n X + nY − 2 7+5−2
x−y
The test statistics is: ≥ tnX + nY −2;α and we reject the null hypothesis when it has high values.
s 2p s 2p
+
n X nY
x−y 34, 4286 − 49,8 −15,3714
= = = 1,3002
s2
p s 2
p
407,6501 407,6501 11,8222
+ +
n X nY 7 5
Exercise 34
The management of a chain of real estate agents has organized a training course for some of the agents, with
the purpose of increasing the weekly sales (in thousands of €). Taking a random sample of six agencies, it has
been measured the level of sales in the week before and in the week after the course, with the following results:
After the
Real estate agent Before the course
course
1 2.7 2.6
2 2.5 3.0
3 2.2 2.4
4 2.9 2.9
5 1.9 2.2
6 2.6 2.7
Is the average increase in sales significant? To answer, make an appropriate statistical test, state the null and
alternative hypotheses and compute the p-value of the test. Setting α = 0.10, what is the final decision?
Denote d i = xi − y i
# agent xi yi di= xi - yi
1 2.7 2.6 0.1
2 2.5 3.0 -0.5
3 2.2 2.4 -0.2
4 2.9 2.9 0
5 1.9 2.2 -0.3
6 2.6 2.7 -0.1
In order to establish whether the increase in sales is significant, we have to run a 1-tailed test, by assuming
the normality of the populations X and Y. The hypotheses that we have to test are:
H0 : µd = 0
H1 : µd < 0
d d
We reject the null hypothesis if t = < −t n −1;α , or > t n −1;α
sd sd
n n
d = −0.1667
6 ⎡ 1 6 2 6
sd = ⎢ ∑
⎤
xi − d 2 ⎥ = [0.0667 − 0.0278] = 6 ⋅ 0.0389 = 0.0467 = 0.2161
5 ⎣ 6 i =1 ⎦ 5 5
− 0.1667
The value of the test statistics is = −1.8898 : this value, which is in the row corresponding to 5
0.0882
degrees of freedom on the tables, lies between the columns 0.05 and 0.10, therefore 0.05 < p-value < 0.10.
By choosing a significance level α equal to 0.10, we reject the null hypothesis: the increase in sales is
significant.
27
Exercise 35
A publisher has to decide whether he should offer books with a transparent cover in order to prevent potential
damages. The transparent cover has an additional cost but it could possibly increase sales. You select two
samples: the first sample with 62 books with the transparent cover, the other sample is composed by 52
volumes without the additional cover. The sales data (in thousands of euro) are in the following table:
a) State the two hypotheses to be tested and specify the assumptions for the test.
b) Compute the p-value and take the decision on the previous hypotheses.
a) Denote by X the sales of volumes with cover and by Y the sales of volumes without cover.
It’s necessary to assume that the two populations have normal distributions with unknown but equal
variances.
The hypotheses to be tested are the following: H 0 : µ X − µY = 0; H 1 : µ X − µY > 0
b) As E (X − Y H 0 ) = µ X − µY = 0 ,
⎛ ⎞ ⎛ ⎞
⎜ ⎟ ⎜ ⎟
⎜ (X − Y ) − 0 ( x − y ) − 0 ⎟ ⎜ (x − y ) ⎟
p − value = Pr ⎜ > ⎟ = Pr ⎜ TnX +nY −2 > ⎟ =
⎜ S p 1 + 1 s p
1
+
1 ⎟ ⎜ s p
1
+
1 ⎟
⎜ n X nY nX nY ⎟⎠ ⎜ nX nY ⎟
⎝ ⎝ ⎠
⎛ ⎞
⎜ ⎟
⎜ 65.92 − 62.58 ⎟
= Pr T112 > ≅ Pr (Z > 1.58 ) = 1 − 0.9429 = 0.0571
⎜ 1 1 ⎟
⎜ 11.2545 + ⎟
⎝ 62 52 ⎠
where S p =
(nX − 1)s X2 + (nY − 1)sY2 =
61 ⋅121.7047 + 51 ⋅132.5973
= 11.2545
n X + nY − 2 62 + 52 − 2
In order to make a decision we have to compare the p-value obtained with the chosen significance level and
reject the null hypothesis if the p-value is smaller, concluding that there is enough evidence to show that it
is more beneficial to offer books with cover. For example, we would reject the null hypothesis at a
significance level of 0.1, but not at a significance level of 0.05.
28
Exercise 36
Film production companies are convinced that one of the important factors impacting on the profitability of a
film is its genre: comedies, in fact, are believed to generate more interest from the general public than other
genres such as horror movies. To test this hypothesis, information has been collected regarding the total box
office sales (in millions of dollars) for 15 films, 7 of which are comedies, while the remaining ones belong to
the horror genre. The data are reported in the following table:
Total
Comedy (c) 113 110 44 42 40 29 14 – 392
Horror (h) 20 15 13 23 12 10 11 8 112
We want to understand if the comedies generate a higher return on average compared to the horror films.
a) State the appropriate hypotheses in order to test the above statement and specify the assumptions needed
to develop the test.
b) Given that the sample variances are equal to s2c = 1542.3333 for the sample of the comedies and s2h =
26.2857 for the sample of horror films, perform the test specified above at a significance level of 1%,
using the p-value to reach the final decision.
c) Would the previous decision change if you increased the significance level to 5%? Why?
- xc = 392/7 = 56
- xh = 112/8 = 14
( nc − 1 ) ⋅ sc2 + ( nh − 1 ) ⋅ sh2
- s p2 = = [(7 – 1)⋅1542.3333 + (8 – 1)⋅26.2857]/(7 + 8 – 2) = 726
nc + nh − 2
- sp = 26.9444
( xc − xh ) − ( µc − µh )0 ( 56 − 14 ) − 0
-t= = = 42/13.9450 = 3.0118
1 1 1 1
sp + 26.9444 +
nc nh 7 8
29
- As the p-value is less than the value of the significance level α (1%), we reject the null hypothesis.
In other words, the data provides evidence in favour of the alternative hypothesis (average
profitability of comedies is greater than that of horror movies).
c) If the significance level was increased to 5% the preceding conclusion would not change: if you reject
at 1% you also reject when α is larger.
Exercise 37
Considering a sample of 8 business agents working for the same company, the 95% confidence interval for
the difference between agents’ average income in 2011 and their average income in 2008 is [0.0086, 3.7414].
Can you confirm that the average incomes of agents are significantly different in 2011 compared to 2008?
Briefly explain.
Since zero falls outside the 95% confidence interval CI 0.95 = [0.0086;3.7414] it is reasonable to say that,
with a significance level of 5%, the income of business agents is significantly different (greater) in 2011
than in 2008. By performing a proper two-sided test on the difference between the two averages incomes,
we reject the null hypothesis of equality between the means of the two populations.
Exercise 38
To assess whether there has been a significant increase between 2012 and 2010 average returns on European
government bonds (with a five-year maturity period), the returns for a sample of 6 European countries are
collected in the following table:
c)
Country Returns 2010 Returns 2012 Difference
Austria 3.2% 3% -0.2%
Germany 2.8% 1.2% -1.6%
Italy 3.4% 5.8% 2.4%
Spain 3.6% 6.2% 2.6%
Portugal 4% 8.2% 4.2%
Switzerland 2.6% 2% -0.6%
Sum of the differences 6.8%
Mean of the differences 1.13%
30
a
kl+(𝑑k − 𝑑)> −0.2 − 1.13 > + −1.6 − 1.13 > + 2.4 − 1.13 >+ 2.6 − 1.13 > + 4.2 − 1.13 > + −0.6 − 1.13 >
𝑠• = =
5 5
= 2.25
𝑑−0 1.13
𝑡= 𝑠• = 2.25 = 1.231 < 𝑡I,,l$.+ = 1.476 → 𝐷𝑜
𝑛𝑜𝑡
𝑅𝑒𝑗𝑒𝑐𝑡
𝐻$
𝑛 6
Exercise 39
Does watching too much TV negatively influence the quality of kids’ sleep? In order to answer to this
question, two independent samples have been selected, each one of 5 kids each, and the time needed to fall
asleep in (minutes) has been collected. The kids from the first sample have watched TV before going to
sleep; the ones from the second one have not watched it. The results have been reported in the below output:
It is also assumed that the needed time to fall asleep follows the Normal distribution with a standard
deviation of 1.8 for the kids who have watched TV and 2.1 for the ones who have not watched it.
a) Calculate the p-value of the test in order to verify the equality hypothesis of the average times needed to
fall asleep, against the right unilateral alternative.
b) If the variances of the two populations were not known, but we could assume them as equal, which
estimator would you propose for their value? Which one would be the correspondent estimate? (you
need to report the full expression of the estimator)
c) If you could choose whether to compute an analysis on the basis of two matched samples or two
independent samples, which option would you pick? Explain your answer.
The hypotheses to be verified are: 𝐻$ : 𝜇M − 𝜇& = 0 vs. 𝐻+ : 𝜇M − 𝜇& > 0
c) We would choose to conduct the analysis on two paired samples. When we have paired observations
and the pairs are positively correlated, the variance of the difference between the sample means is
reduced compared to the case with independent samples: this is because some of the characteristics of
the pairs are similar and therefore the relative proportion of variability is cancelled from the total
variability of the difference between the means. With a lower variance there will be a larger
probability of refusing the null hypothesis when it is false.
32