Question 1

Alice took a test with 100 Yes/No questions (a very long one!). Alice received the tests results and she got 55 questions correctly.

The Professor wants to understand if Alice was randomly guessing the answers on the test or if Alice actually studied for the exam.

  1. State the Null and Alternative hypotheses. Is alternative one-sided or two sided?

If \(p\) is the probability for Alice to answer the question correctly then

\(H_0: p = 0.5\) and \(H_a: p>0.5.\)

It is a one-sided alternative.

  1. What is the test statistic?

\(z_{obs} = \frac{55/100 - 0.5}{\sqrt{0.5(1-0.5)/100}}=1\)

  1. Find the corresponding p-value.

p-value\(=P(Z>z_{obs}) = 0.1587\)

  1. Can we reject the null hypothesis at significance level 0.05?

No, p-value>0.05.

  1. What is the conclusion that the professor can make from the hypothesis testing?

As we fail to reject \(H_0\), there is not enough evidence to say that Alice was not randomly guessing.

  1. Will the answer change if Alice got 60 correct answers on the test?

\(z_{obs} = \frac{60/100 - 0.5}{\sqrt{0.5(1-0.5)/100}}=2\)

p-value\(=P(Z>z_{obs}) = 0.0228 < 0.05\)

We can reject \(H_0\) in favor of \(H_a\), so we are 95% confident that Alice has studied.

Question 2

Average salary in Google is 250K.

Elon Musk wants to check if the average salary in Twitter is the same as in Google.

  1. State the Null and Alternative hypotheses. Is alternative one-sided or two sided?

If \(\mu\) is the average salary in Twitter then

\(H_0: \mu = 100\) and \(H_a: \mu\neq100.\)

It is a two-sided alternative.

  1. Elon Musk knows the salaries of 30 employees in Twitter.
salary
##  [1] 189.8 205.8 235.9 286.2 180.3 284.8 291.7 249.1 244.4 159.3 180.9 176.5
## [13] 253.1 207.6 265.5 224.7 257.6 298.8 207.0 266.6 290.2 181.8 247.8 168.8
## [25] 190.1 207.9 152.0 207.4 280.5 201.1

He computed the mean of this sample:

mean(salary)
## [1] 226.44

In addition, an insider shared that the population variance of the salary in Twitter is \(6000\).

What is the value of the test statistic?

If the variance is known we can use Normal approximation (like in confidence intervals).

\(z_{obs}=\frac{226.44 - 250}{\sqrt{6000/30}}=-1.666\)

  1. Find the corresponding p-value.

p-value\(=P(|Z|>|z_{obs}|) = 2 \cdot 0.0475 = 0.095\)

  1. Can we reject the null hypothesis at significance level 0.05?

No, p-value>0.05.

  1. What is the conclusion that Elon Musk can make from the hypothesis testing?

As we fail to reject \(H_0\), there is not enough evidence to say that there is a difference between Google and Twitter in average salaries.

  1. Will the answer change if we use 0.1 significance level?

Yes, as p-value<0.1 we could reject the \(H_0\) with 90% confidence and conclude that the average salaries in Google and Twitter are different.

  1. Elon Musk doesnโ€™t trust insiders. He decided to estimate the sample variance and check the information he was provided with. He was surprised to get much smaller value of
var(salary)
## [1] 1961.936

What is the value of the test statistic in this case?

If the variance is unknown we use t approximation.

\(t_{obs}=\frac{226.44 - 250}{\sqrt{1961.936/30}}=-2.913\)

  1. Can we reject the null hypothesis at significance level 0.05?

From the t-distribution table we infer that p-value\(=P(|T|>|t_{obs}|)\) is smaller than 0.01.

So we can reject the null hypothesis at significance level 0.05.