A nutritionist claims that students who drink coffee before studying focus for an average of 45 minutes before losing concentration. A sample of 18 students who drank coffee lasted an average of 52.3 minutes, with a standard deviation of 12.1 minutes. Is there evidence that the average focus time is greater than 45 minutes?
Our Null Hypothesis is that the population average is 45 minutes. Our Alternative Hypothesis is that the population average is greater than 45 minutes. This is a one-sided alternative hypothesis.
# H0 is that mu = 45 minutes
# HA is that mu is greater than 45 minutes (mu > 45)
# HA is a one-sided alternative hypothesis
#record the hypothesized mean
mu <- 45
Our sample data, as described in the problem, comes from a sample of 18 students. The sample average was 52.3 minutes, and the sample standard deviation was 12.1 minutes.
#record the sample data
n <- 18
ybar <- 52.3
s <- 12.1
Our standard error is our sample standard deviation, divided by the square root of our sample size.
#calculate SE
SE <- s/sqrt(n)
SE
## [1] 2.851997
Therefore, we see that our standard error in this problem is approximately 2.85.
Our model is the t-model, with degrees of freedom equal to 17 (that is, the sample size minus 1). Our t-model is centere at mu=45, and with spread given by SE=2.85.
Given this t-model, our sample mean has the following t-statistic:
#calculate the t-statistic for our sample
t <- (ybar - mu)/SE
t
## [1] 2.55961
Therefore, our sample’s t-statistic is approximately 2.56. Our given sample sits above the center of the t-model, specifically 2.56 measurements of the SE above the center.
We wish to calculate the P-value, which tells us the chance of getting a sample with a t-statistic as large (or larger) than ours if the null hypothesis is true.
Our alternative hypothesis was one-sided, focusing on the “greater than” side (i.e., the right side) of the t-model.
P_value <- 1-pt(t, df=n-1)
P_value
## [1] 0.01015207
We see that our P-value is approximately 0.01.
Based on our P-value of 0.01, our conclusion is that, if the null hypothesis were true, the chances of getting a sample with a t-statistic as large as ours would occur only 1% of the time. This is very small, and well below a threshold of 0.05. This leads us to reject the null hypothesis and accept the alternative hypothesis. It is likely that the average focus time is greater than 45 minutes.
A tech reviewer claims that a certain laptop model averages 7.5 hours of battery life when streaming video. A group of 14 students test the same model under identical conditions and find a mean battery life of 6.9 hours with a standard deviation of 1.3 hours. Is there evidence that the average streaming battery life is less than 7.5 hours?
Our Null Hypothesis is that the average video streaming battery life is 7.5 hours. Our Alternative Hypothesis is that the average video streaming battery life is less than 7.5 hours. This is a one-sided alternative hypothesis.
# H0 is that mu = 7.5 hours
# HA is that mu is less than 7.5 hours (mu < 7.5)
# HA is a one-sided alternative hypothesis
#record the hypothesized mean
mu <- 7.5
Our sample data, as described in the problem, comes from a sample of 14 students. The sample average was 6.9 hours, and the sample standard deviation was of 1.3 hours.
#record the sample data
n <- 14
ybar <- 6.9
s <- 1.3
Our standard error is our sample standard deviation, divided by the square root of our sample size.
#calculate SE
SE <- s/sqrt(n)
SE
## [1] 0.3474396
Therefore, we see that our standard error in this problem is approximately 0.3474396.
Our model is the t-model, with degrees of freedom equal to 13 (that is, the sample size minus 1). Our t-model is centere at mu=7.5, and with spread given by SE=0.3474396.
Given this t-model, our sample mean has the following t-statistic:
#calculate the t-statistic for our sample
t <- (ybar - mu)/SE
t
## [1] -1.726919
Therefore, our sample’s t-statistic is approximately -1.726919. Our given sample sits above the center of the t-model, specifically -1.726919 measurements of the SE below the center.
We wish to calculate the P-value, which tells us the chance of getting a sample with a t-statistic as large (or larger) than ours if the null hypothesis is true.
Our alternative hypothesis was one-sided, focusing on the “less than” side (i.e., the left side) of the t-model.
P_value <- pt(t, df = n - 1)
P_value
## [1] 0.05392508
We see that our P-value is approximately 0.05392508.
Based on our P-value of 0.0539, our conclusion is that since there is a chance of getting a sample size of 0.05392 This is very small but still above a threshold of 0.05. Therefore we fail to reject the null hypothesis. It is still possible that the average streaming time is 7.5 hours.
A health science student measures the resting pulse rate of 20 classmates 20 minutes after drinking a cup of coffee. The sample mean is 78.6 beats per minute, with a standard deviation of 7.9. The standard resting rate for college-aged adults is 75 bpm. Do the data suggest that caffeine increases mean pulse rate above 75 bpm?
Our Null Hypothesis is that the mean pulse rate after caffeine average is of 75 bpm. Our Alternative Hypothesis is that caffeine mean pulse rate is above 75 bpm. This is a one-sided alternative hypothesis.
# H0 is that mu = 75 bpm
# HA is that mu is grater than 75 bpm (mu > 75)
# HA is a one-sided alternative hypothesis
#record the hypothesized mean
mu <- 75
Our sample data, as described in the problem, comes from a sample of 20 classmates. The sample mean was 78.6 bpm, and the sample standard deviation was 7.9.
#record the sample data
n <- 20
ybar <- 78.6
s <- 7.9
Our standard error is our sample standard deviation, divided by the square root of our sample size.
#calculate SE
SE <- s/sqrt(n)
SE
## [1] 1.766494
Therefore, we see that our standard error in this problem is approximately 1.766494.
Our model is the t-model, with degrees of freedom equal to 19 (that is, the sample size minus 1). Our t-model is centere at mu=75, and with spread given by SE=1.766494.
Given this t-model, our sample mean has the following t-statistic:
#calculate the t-statistic for our sample
t <- (ybar - mu)/SE
t
## [1] 2.037935
Therefore, our sample’s t-statistic is approximately 2.037935. Our given sample sits above the center of the t-model, specifically 2.037935 measurements of the SE above the center.
We wish to calculate the P-value, which tells us the chance of getting a sample with a t-statistic as large (or larger) than ours if the null hypothesis is true.
Our alternative hypothesis was one-sided, focusing on the “greater than” side (i.e., the right side) of the t-model.
P_value <- 1 - pt(t, df=n-1)
P_value
## [1] 0.0278621
We see that our P-value is approximately 0.0278621.
Based on our P-value of 0.0278621, we reject the null hypothesis and we say that caffeine increases the mean pulse above 75bpm.
A sample of 11 students reports their one-way commute distance to campus. The mean is 4.7 miles with a standard deviation of 1.5 miles. Confidence Interval – Construct a 95% confidence interval for the true mean one-way commute distance for students at the university.
Our sample data, as described in the problem, comes from a sample of 11 students. The sample mean is 4.7 miles, and the sample standard deviation was 1.5 miles.
#record the sample data
n <- 11
ybar <- 4.7
s <- 1.5
Our standard error is our sample standard deviation, divided by the square root of our sample size.
#calculate SE
SE <- s/sqrt(n)
SE
## [1] 0.452267
Therefore, we see that our standard error in this problem is approximately 0.452267.
To get a 95% confidence interval, we need the t-staatistic cutting off the upper 2.5% of the t-model.
This is found using qt(0.975, df = n - 1):
t_stat <- qt(0.975, df = n - 1)
t_stat
## [1] 2.228139
Therefore, we see that our t statistic in this problem is approximately 2.228139.
Now compute the margin of error:
ME <- t_stat * SE
ME
## [1] 1.007714
Our margin of error is approximately 1.007714.
Finally, we apply the formula to compute the 95% confidence interval:
lower_int <- ybar - ME
upper_int<- ybar + ME
c(lower_int, upper_int)
## [1] 3.692286 5.707714
The 95% confidence interval (3.69, 5.71) miles suggests that the true average morning commute distance for students is likely between about 3.7 and 5.7 miles.
A sample of 16 students records how long (in minutes) they spend on their phone before sleeping each night. The average screen time is 42.5 minutes, with a standard deviation of 12.8 minutes. Confidence Interval – Construct a 90% confidence interval for the true mean nightly pre-sleep screen time among students.
Our sample data, as described in the problem, comes from a sample of 16 students. The sample average was 42.5 minutes, and the sample standard deviation was 12.8 minutes.
#record the sample data
n <- 16
ybar <- 42.5
s <- 12.8
Our standard error is our sample standard deviation, divided by the square root of our sample size.
#calculate SE
SE <- s/sqrt(n)
SE
## [1] 3.2
Therefore, we see that our standard error in this problem is approximately 3.2.
To get a 95% confidence interval, we need the t-staatistic cutting off the upper 2.5% of the t-model.
This is found using qt(0.95, df = n - 1):
t_stat <- qt(0.95, df = n - 1)
t_stat
## [1] 1.75305
Therefore, we see that our t statistic in this problem is approximately 1.75305.
Now compute the margin of error:
ME <- t_stat * SE
ME
## [1] 5.609761
Our margin of error is approximately 5.609761.
Finally, we apply the formula to compute the 95% confidence interval:
lower_int <- ybar - ME
upper_int<- ybar + ME
c(lower_int, upper_int)
## [1] 36.89024 48.10976
The 90% confidence interval (36.89,48.11) minutes indicates that the true average pre-sleep screen time is likely between about 37 and 48 minutes.