Skip to main content

One sample t-Test in R

See Video ⮞ ☝

What a one-sample t-test evaluates

A one-sample t-test compares the mean of a quantitative outcome in one population with a prespecified reference value. It is useful when the population standard deviation is unknown and inference is based on a sample standard deviation.

The test assumes independent observations from the target population. For a small sample, examine the data for strong skewness and influential outliers; the sampling distribution of the mean should be reasonably compatible with the t-based inference. A large sample does not correct biased sampling or dependence among observations.

Set up the hypotheses

Let μ₀ be the reference mean. A two-sided test evaluates H₀: μ = μ₀ against H₁: μ ≠ μ₀. Use a one-sided alternative only when a direction was specified before viewing the data and is justified by the research question.

Run and interpret the analysis in R

The video demonstrates how to prepare a sample and carry out a one-sample t-test with R’s t.test() function. Specify the sample vector, reference value, alternative hypothesis, and confidence level. Check the data units and confirm that the reference value is scientifically meaningful.

Interpret the estimated sample mean and its difference from the reference alongside the confidence interval and p-value. The p-value is the probability, under the null hypothesis and test assumptions, of a result at least as extreme as the one observed; it is not the probability that the null hypothesis is true. Report the estimate and interval so readers can judge both magnitude and uncertainty.

Comments