###################################################################### # Car warranty example # # # ###################################################################### ##################################################################### # Hypothesis test example ybar <- 39900 s <- 1866 alpha <- 0.01 n <-32 qt(p = 1 - alpha, df = n-1) #Notice there is no alpha/2 #Interval upper <- ybar - qt(p = 1 - alpha, df = n-1) * s / sqrt(n) upper #Test statistic mu0 <- 36000 t <- (ybar - mu0) / (s / sqrt(n)) t #P-value 1 - pt(q = t, df = n - 1)