cps <- read.table("http://s3.amazonaws.com/assets.datacamp.com/production/course_1276/datasets/cps_ch3.csv", header = T, sep = ";") tstat <- (mean(cps$ahe12)-23.5)/(sd(cps$ahe12)/sqrt(length(cps$ahe12))) pval <- 1-pnorm(tstat) # conduct the hypothesis test from the previous exercises with t.test() # extract t statistic and p-value from the list created by t.test() # verify that using the normal approximation is valid here as well # conduct the hypothesis test from the previous exercises with t.test() t.test(cps$ahe12, alternative = "greater", mu = 23.5) # extract t statistic and p-value from the list created by t.test() tstat <- t.test(cps$ahe12, alternative = "greater", mu = 23.5)$statistic pvalue <- t.test(cps$ahe12, alternative = "greater", mu = 23.5)$p.value # verify that using the normal approximation is valid here as well pvalue - pval test_function_result("t.test") test_object("tstat") test_object("pvalue") test_or({ test_student_typed("pvalue - pval") },{ test_student_typed("pval - pvalue") },{ test_student_typed("pval == pvalue") },{ test_student_typed("pvalue == pval") }) success_msg("Correct! The difference between both p-values is very small so using the normal approximation leads to the same conclusion here.")