hr <- c(75,77,86,108,61,46,82,78,81,
79,55,67,63,94,76,56,69,79,
66,78,77,91,82,80,73,62,76,80,83)
n <- length(hr)
xbar <- mean(hr)
alpha <- .05HW1 [Name redacted]
- Check whether it appears the measurements come from a normal distribution by making a normal quantile-quantile plot.
qqnorm(hr)
qqline(hr)- Report the sample mean
, sample variance , and sample standard deviation of the measurements. Give also the sample size.
n <- length(hr)
s2 <- var(hr)
sn <- sd(hr)The sample mean is
The sample variance is
The sample standard deviation is
The sample size is
3)Assume that the resting heart rate measurements are drawn from a normal distribution with unknown mean, but with a known standard deviation of beats per minute (bpm). Give a 99% confidence interval for the mean resting heart rate based on the measurements from the students.
alpha <- .01
za2 <- qnorm(1-alpha/2)
sigma <- 16
lo <- xbar - za2 * sigma / sqrt(n)
up <- xbar + za2 * sigma / sqrt(n)The sample mean is
The confidence interval is
- Now give a 99% confidence interval for the mean resting heart rate based on the measurements of the students, using the estimated standard deviation
in place of . That is, assume now that is unknown and must be estimated with .
sn <- sd(hr)
ta2 <- qt(1-alpha/2,n-1)
lot <- xbar - ta2 * sn/sqrt(n)
upt <- xbar + ta2 * sn/sqrt(n)The confidence interval is
- Suppose a researcher wished to estimate the mean resting heart rate of this population of students with a margin of error no greater 2 than beats per minute with 95% confidence. Using
as a guess for , suggest a sample size which should be just large enough for the researcher.
E <- 2
sigma <- sn
alpha <-.05
za2 <- qnorm(1-alpha/2)
n <- (za2 * sigma / E)^2Sample size should be
- A researcher wishes to know whether the mean resting heart rate for this population of students exceeds 73 bpm. Give
n <- length(hr)
t.test(hr,mu=73,alternative="greater")
One Sample t-test
data: hr
t = 0.93006, df = 28, p-value = 0.1801
alternative hypothesis: true mean is greater than 73
95 percent confidence interval:
71.19896 Inf
sample estimates:
mean of x
75.17241
- The null and alternate hypotheses of interest.
- The value of the test statistic.
- The critical value for testing the hypothesis at significance level
alpha <- .05
tc <- qt(1-alpha,n-1)
tc[1] 1.701131
- The p-value for testing these hypotheses based on the data.
- The decision whether or not to reject
.
Since p = 0.1801 > 0.05 we don’t reject
- A researcher wishes to know whether the mean resting heart rate for this population of students is equal to 70 bpm. Give
n <- length(hr)
t.test(hr,mu=70)
One Sample t-test
data: hr
t = 2.2144, df = 28, p-value = 0.03511
alternative hypothesis: true mean is not equal to 70
95 percent confidence interval:
70.38780 79.95703
sample estimates:
mean of x
75.17241
- The null and alternate hypotheses of interest.
- The value of the test statistic.
- The critical value for testing the hypothesis at significance level
alpha <- .10
tc <- qt(1-alpha/2,n-1)
tc[1] 1.701131
The critical values are -1.701131 and 1.701131.
- The p-value for testing these hypotheses based on the data.
- The decision whether or not to reject
.
Since p = 0.0351 < 0.10 we reject
- Suppose a researcher wants to test whether the mean resting heart rate in this population of students is greater than 75 bpm. If the true mean is 77 bpm or greater, the researcher would like to detect this with probability at least 90% while using a significance level of
. Using the sample standard deviation as an estimate of the unknown population standard deviation , give a recommended sample size for the researcher.
sn <- sd(hr)
alpha <- .05
power <- .90
za <- qnorm(1-alpha)
zb <- qnorm(power)
n <- ((za + zb)*sn/2)^2Recommended sample size is
- Suppose a researcher wants to test whether the mean resting heart rate in this population of students is equal to 78 bpm. If the true mean lies 2 bpm or more away from this value, the researcher would like to detect this with probability at least 80% while using a significance level of
. Using the sample standard deviation as an estimate of the unknown population standard deviation , give a recommended sample size for the researcher.
sn <- sd(hr)
alpha <- .01
power <- .80
za2 <- qnorm(1-alpha/2)
zb <- qnorm(power)
n <- ((za2 + zb)*sn/2)^2Recommended sample size is