Problem 1: T-test for single population
Calculate mean, stdev, Sx-bar.
Check the Hypothesis (below) for Alpha = 2.5%. Find the upper and lower cut-off points.
H0: µ = 150.
H1: µ ≠ 150.
Also, find the P-Value.
Note: The T-test class slides will help you here.
R-Output: Mean, Std dev, Sx-Bar, Upper / Lower cut-off points, P-value, and the decision
t-test = Weight 163 163 190 153 115 139 127 174 169 170 116 166 178 141 143 157 166 186 161 135 118 153 146 175 161 155 172 177 170 143 148 168 117 165 153 157
CodePudding user response:
This is a textbook one sample t-test computation and I will let the user decide whether the null hypothesis is rejected or not.
After computing the t
statistic, use R's functions for the Student's t distribution to compute the p-value and the confidence interval.
n <- length(Weight)
xbar <- mean(Weight)
se <- sd(Weight)/sqrt(n)
tstat <- (xbar - mu)/se
df <- n - 1L
p.value <- 2*pt(-abs(tstat), df)
q975 <- qt(1 - alpha, df)
ci95 <- tstat q975*c(-1, 1)
ci95 <- setNames(ci95*se mu, c("2.5%", "97.5%"))
The results are, with a p.value
equal to 0.1173
,
xbar
#[1] 155.2778
se
#[1] 3.286724
p.value
#[1] 0.117307
ci95
# 2.5% 97.5%
#148.6054 161.9502
These results are equal to the results output by
t.test(Weight, mu = mu)
Data
Weight <- scan(text = "163 163 190 153 115 139 127 174 169 170 116
166 178 141 143 157 166 186 161 135 118 153 146 175
161 155 172 177 170 143 148 168 117 165 153 157")
mu <- 150
alpha <- 0.025
CodePudding user response:
wt <- c(163,163, 190, 153,115, 139, 127, 174,169, 170, 116, 166, 178, 141, 143, 157, 166, 186, 161, 135, 118, 153, 146, 175, 161, 155, 172, 177, 170, 143, 148, 168, 117, 165, 153, 157); wt
t.test(wt, mu=150, alternative="two.sided", conf.level=0.975)
This much better.