How do you call statistical tests like t.test() in R and interpret the returned result object?

Quick Overview

Asks how to run statistical tests such as t.test() in R, which arguments choose the exact test, and how to read the object it returns. It tests practical R skills along with the interpretation of test statistics, p-values, confidence intervals and the direction of an effect.

How do you call statistical tests like t.test() in R and interpret the returned result object?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: medium

Interview Round: Other

How do you call statistical tests like `t.test()` in R and interpret the returned result object? Use a comparison of two groups' means as your example. ```hint Look inside the object Think about what `class()`, `names()` and `str()` would show for the value a test returns, and which of those pieces you would put in a report. ``` ```hint Check the defaults Look up which variance assumption and which alternative hypothesis `t.test()` uses when you pass it only two vectors. ``` ### What a Strong Answer Covers - The main ways to call `t.test()`: one sample, two independent samples, paired samples, and the formula interface - Arguments that change the test, such as the variance assumption, the alternative and the confidence level - The structure of the returned object and how to extract its fields in code - How to read the statistic, degrees of freedom, p-value, confidence interval and estimates, including the direction of the difference - Other base R tests that return the same kind of object, and how to turn results into a data frame ### Follow-up Questions - When would you set `var.equal = TRUE`, and what changes in the output? - How would you run the same comparison for many metrics and collect the results in one table? - What would you use instead of `t.test()` for a heavily skewed metric with small samples? - Why does the 95% confidence interval exclude 0 exactly when the two-sided p-value is below 0.05?

Overview: Asks how to run statistical tests such as t.test() in R, which arguments choose the exact test, and how to read the object it returns. It tests practical R skills along with the interpretation of test statistics, p-values, confidence intervals and the direction of an effect.

Nov 25, 2026
mediumData ScientistOtherData Manipulation (SQL/Python)
0
0

How do you call statistical tests like t.test() in R and interpret the returned result object? Use a comparison of two groups' means as your example.

What a Strong Answer Covers Guidance

  • The main ways to call t.test() : one sample, two independent samples, paired samples, and the formula interface
  • Arguments that change the test, such as the variance assumption, the alternative and the confidence level
  • The structure of the returned object and how to extract its fields in code
  • How to read the statistic, degrees of freedom, p-value, confidence interval and estimates, including the direction of the difference
  • Other base R tests that return the same kind of object, and how to turn results into a data frame

Follow-up Questions Guidance

  • When would you set var.equal = TRUE , and what changes in the output?
  • How would you run the same comparison for many metrics and collect the results in one table?
  • What would you use instead of t.test() for a heavily skewed metric with small samples?
  • Why does the 95% confidence interval exclude 0 exactly when the two-sided p-value is below 0.05?