hr <- c(80, 118, 92, 84, 78, 84,
76, 82, 76, 88, 108, 90,
90, 90, 86, 70, 68, 46,
98, 56, 84, 80, 78, 66, 60)STAT 516 Homework 1
1)
qqnorm(hr)
qqline(hr)2)
xbar <- mean(hr)
sn2 <- var(hr)
sn <- sd(hr)The mean of the sample is
3)
For a sample with a known standard deviation, the confidence interval of the mean is found by the formula
alpha <- 1 - 0.99;
n <- length(hr);
sigma <- 16
MoE <- qnorm(1-alpha/2) * sigma / sqrt(n)The
4)
For a sample with an unknown standard deviation (i.e., using
alpha <- 1 - 0.99
sn <- sd(hr)
MoE <- qt(1-alpha/2, n-1)*(sn/sqrt(n))The
5)
The minimum number of samples needed to obtain a desired margin of error,
MoEs <- 2
alpha <- 1 - 0.95
sigma <- sd(hr)
n1 <- ceiling( (qnorm(1-alpha/2) * (sn/MoEs)) ^2 )Using
6)
i)
ii)
mu0 <- 80
sn <- sd(hr)
ts <- (xbar - mu0) / (sn/sqrt(n) )iii)
For a one-sided test,
alpha <- 0.05
tc <- qt(1-alpha, n-1)iv)
We reject
ts > tc[1] FALSE
v)
For a right-tailed test,
pval <- pt(-ts, n-1)7)
i)
ii)
mu0 <- 82
ts <- (xbar - mu0) / (sn/sqrt(n) )iii)
For a two-sided test,
alpha <- 0.10
tc <- qt(1-alpha/2, n-1)iv)
We reject
abs(ts) > tc[1] FALSE
v)
For a two-tailed test,
pval <- 2*pt(-abs(ts), n-1)8)
For a one-tailed test,
sigma <- sd(hr)
alpha <- 0.05
beta <- 1 - 0.90
za <- qnorm(1-alpha)
zb <- qnorm(1-beta)
mus <- 77
mu0 <- 75
n_8 <- ceiling(sigma^2 * (za + zb)^2 / (mus - mu0)^2)Given that the true mean of the sample is at least
9)
For a two-tailed test,
sigma <- sd(hr)
alpha <- 0.01
beta <- 1 - 0.80
za <- qnorm(1-alpha/2)
zb <- qnorm(1-beta)
mus <- 78+2
mu0 <- 78
n_9 <- ceiling(sigma^2 * (za + zb)^2 / (mus - mu0)^2)Given that the true mean of the sample is at least