Chapter 18. Statistical Tests

Many data problems boil down to statistical tests. For example, you might want to answer a question like:

  • Does this new drug work better than a placebo?

  • Does the new web site design lead to significantly more sales than the old design?

  • Can this new investment strategy yield higher returns than an index fund?

To answer questions like these, you would formulate a hypothesis, design an experiment, collect data, and use a tool like R to analyze the data. This chapter focuses on the tools available in R for answering these questions.

Warning

To be helpful, I’ve tried to include enough description of different statistical methods to help remind you when to use each method (in addition to how to find them in R). However, because this is a Nutshell book, I can’t describe where these formulas come from, or when they’re safe to use. R is a good substitute for expensive, proprietary statistics software packages. However, R in a Nutshell isn’t a good substitute for a good statistics course or a good statistics book.

I’ve broken this chapter into two sections: tools for continuous random variables and tools for categorical random variables (or counts).

Get R in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.