I would like to test the null hypothesis that the mean value of y at a specified x is equal to a specific value vs. the alternative that it is not equal to that specific value.
How can I calculate the corresponding T value for the test statistic and p-value in R? Also, how can I calculate the corresponding 95% confidence interval for the mean value of y at that specific value in R?
Here is what I have tried:
TVEXP <- c(28.5, 48.3, 40.2, 34.8, 50.1, 44.0, 27.2, 37.8, 27.2, 46.1, 31.3, 50.1, 31.3, 24.8,42.2, 23.0, 30.1, 36.5, 40.2, 46.1)
VOTE <- c(35.4, 58.2, 46.1, 45.5, 64.8, 52.0, 37.9, 48.2, 41.8, 54.0, 40.8, 61.9, 36.5, 32.7, 53.8, 24.6, 31.2, 42.6, 49.6, 56.6)
voting_data <- data.frame(TVEXP, VOTE)
t.test(voting_data$VOTE, voting_data$TVEXP, mu = 45, alternative = "two.sided", conf.level = 0.95)
I want to test null hypothesis that the mean value of y is 45 when x is 36.99 vs the alternative that it does not equal 45. I expect t.test() to produce T = 0.954 and a p-value of 0.3, but that is not what I got as output.