Previous research suggests that the average adult drinks 4 cups of coffee per day. To test this, 10 adults were randomly sampled from a normal distribution. Data is below.
5.0 7.0 2.0 8.0 4.0 3.0 6.5 5.0 4.5 8.0
Using a t-test, test whether the average number of cups of coffee is equal to 4 at the 5% significance level.
i need ans in R programming
#create the vector
x <- c(5.0, 7.0, 2.0, 8.0, 4.0, 3.0, 6.5, 5.0, 4.5, 8.0)
#call the function for test, with the x value and since it is
single sample text, the other vectir y will be NULL
#the given average mu is 4
t.test(x, y = NULL, mu = 4)
"""One Sample t-test
data: x
t = 2.0113, df = 9, p-value = 0.07517
alternative hypothesis: true mean is not equal to 4
95 percent confidence interval:
3.837838 6.762162
sample estimates:
mean of x
5.3 """
#According to the output, it will not satisfy the hypothesis at 5%
signifincance level
#so it returned the alternate hypothesis as true
If you have any doubts please comment and please don't dislike.
Get Answers For Free
Most questions answered within 1 hours.