Tech Tutorial — Compute. This unit uses formulas and theoretical distributions (the t and the normal) instead of resampling. Pick one tool and follow its tab — all three handle this unit well.
A two-sample t-test — do On- and Off-campus students differ in mean sleep_hours?
A confidence interval for one proportion — what fraction of students live on campus?
1. Two-sample t-test for a difference in means
This is the formula-based counterpart to the randomization test from the Simulate unit. It assumes roughly normal data (or a large enough sample) and reports a t statistic, degrees of freedom, and a p-value.
Tick Welch’s (unequal variances), Mean difference, and Confidence interval.
(Jamovi screenshots to be added.)
library(readr)library(dplyr)library(infer)survey <-read_csv("../datasets/class_survey.csv")# Two-sample t-test (Welch); order sets the sign of the differencesurvey |>t_test(sleep_hours ~ housing,order =c("On-campus", "Off-campus"))
Here the variable is categorical: each student lives on campus or not. We estimate the population proportion living on campus with a normal-based (Wald/score) confidence interval.
Set the test value and read the proportion and its confidence interval (Jamovi reports the CI for the level you select).
(Jamovi screenshots to be added.)
# Count on-campus students and form a one-proportion z intervalon <-sum(survey$housing =="On-campus")n <-nrow(survey)prop.test(on, n)$conf.int # 95% CI for the proportion on campus