Load the necessary packages: \(~\)
library(readr)
library(pander)
library(ggplot2)
library(BSDA)
\(~\)
Problem 1: DDonuts claims that the waiting time of customers for service is normally distributed with a mean of three minutes and a standard deviation of one minute. The quality assurance department found in a sample of \(50\) customers that the mean waiting time is 2.85 minutes. At a \(0.05\) level of significance, can we conclude that the mean waiting time is less than three minutes?
\(~\)
Problem: Is the mean waiting time of customers for service at DDonuts less than \(3\) minutes?
Ho: The mean waiting time of customers for service at DDonuts is greater than or equal to \(3\) minutes.
Ha: The mean waiting time of customers for service at DDonuts is less than \(3\) minutes.
Significance level: \(0.05\).
Test-statistic: \(Z\)-statistic since popn standard deviation is known.
Rejection Region:
## [1] -1.644854
\(~\)
Decision Rule: Reject Ho if z-computed is less than or equal to \(-1.645\). Otherwise, fail to reject Ho.
pander(zsum.test(mean.x = 2.85, sigma.x = 1, n.x = 50, alternative = "less", mu = 3))
Test statistic | P value | Alternative hypothesis | mean of x |
---|---|---|---|
-1.061 | 0.1444 | less | 2.85 |
\(~\)
\(~\)
Problem 2: A business travel magazine wants to classify transatlantic gateway airports according to the mean rating for the population of business travelers. A rating scale with a low score of \(0\) and a high score of \(10\) will be used, and airports with a population mean rating greater than \(7\) will be designated as superior service airports. The magazine staff surveyed a sample of \(60\) business travelers at each airport to obtain the ratings data. The sample for London’s Heathrow Airport provided a sample mean rating of \(7.25\) and a sample standard deviation of \(1.052\). Do the data indicate that Heathrow should be deisgnated as a superior service airport?
\(~\)
Problem: Is the mean rating of Heathrow Airport greater than \(7\)?
Ho: The mean rating of Heathrow Airport is less than or equal to \(7\).
Ha: The mean rating of Heathrow Airport is greater than \(7\).
Significance level: \(0.05\).
Test-statistic: \(t\)-statistic since the popn variance or standard deviation is unknown.
Critical Region:
## [1] 1.671093
\(~\) Decision Rule: reject Ho if t-computed is greater than or equal to \(1.671\). Otherwise, fail to reject Ho.
pander(tsum.test(mean.x = 7.25, s.x = 1.052, n.x = 60, alternative = "greater", mu = 7))
Test statistic | df | P value | Alternative hypothesis | mean of x |
---|---|---|---|---|
1.841 | 59 | 0.03534 * | greater | 7.25 |
\(~\)
Problem 3: A consumer group complains that the gas tax (in Php per gallon) levied by the local government is too high. The data on gas tax obtained in \(30\) urban areas in the country is contained in the “tax.csv” file. Assuming normality, test at the \(5\%\) level of significance that the mean gas tax is no greater than \(50\) (Php per gallon).
\(~\)
Problem: Is the mean gas tax no greater (lesser than or equal to) \(Php50\) per gallon?
Ho: The mean gas tax is less than or equal to \(Php50\) per gallon.
Ha: The mean gas tax is greater than \(Php50\) per gallon.
Significance level: \(0.05\).
Test statistic: \(t\)-statistic (since popn variance or standard deviation is unknown)
Computation using R:
\(~\)
# Import "tax.csv" file:
taxdata <- read.csv("tax.csv")
head(taxdata)
## Urban.Area tax
## 1 1 53
## 2 2 48
## 3 3 42
## 4 4 57
## 5 5 51
## 6 6 50
#Perform the t-test:
pander(t.test(taxdata$tax, mu=50, alternative="greater"))
Test statistic | df | P value | Alternative hypothesis | mean of x |
---|---|---|---|---|
-1.695 | 29 | 0.9496 | greater | 48.4 |
\(~\)
\(~\)
Problem 4: The managing officer of FlantAsia, an ornamental plant distributor in East Asia claim that their company’s sales decreased by \(20\%\) during the month of December. The officer summons the company’s analyst to investigate the claim. The analyst gathers a record of the product sales during the month of December for the past \(40\) years. The distribution of the percentage decrease in sales is in the file “decrease.csv”. At the \(5\%\) significance level, what would you say about the officer’s claim?
\(~\)
Problem: Is the mean amount of decrease of FlanAsia sales \(20\%\)?
Ho: The mean amount of decrease of FlantAsia sales is \(20\%\).
Ha: The mean amount of decrease of FlantAsia sales is not \(20\%\).
Significance Level: \(0.05\).
Test-Statistic: \(t\)-statistic since the popn variance or standard deviation is unknown.
Computation using R:
\(~\)
# Import "decrease.csv" file:
decreasedata <- read.csv("decrease.csv")
head(decreasedata)
## Year decrease
## 1 1981 15.72
## 2 1982 21.24
## 3 1983 23.25
## 4 1984 19.80
## 5 1985 20.90
## 6 1986 17.34
# Perform the t-test:
pander(t.test(decreasedata$decrease, mu=20, alternative="two.sided"))
Test statistic | df | P value | Alternative hypothesis | mean of x |
---|---|---|---|---|
-0.7429 | 39 | 0.462 | two.sided | 19.32 |