3 Quantitative Data
Overview
In this lesson, we’ll cover some basic tools for describing quantitative (or continuous) data, using Chapter 3 of Essential R Course Notes.
Objectives
Upon completion of this lesson, you should be able to:
- describe quantitative (continuous) variables based on center and spread,
- test hypotheses about the mean of a quantitative variable,
- use resistant descriptors of center and spread,
- visualize quantitative variables in several ways, and
- create a quantitative variable from a qualitative variable.
Data and R Code Files
The R code file and data files for this lesson can be found on the Essential R - Notes on learning R page.
3.1 Quantitative Variables – Center and Spread
Here we’ll demonstrate basic measures of center and spread (mean, median, sd, quantiles) for quantitative variables.
3.2 Hypothesis Tests with Quantitative Data
In this screencast, we’ll demonstrate testing hypotheses about the mean by calculating a t-statistic - both by hand, and via the built-in function t-test()
. Note that when we use pt()
to calculate p-values, the wrong tail gives us 1-p rather than p - the choice of upper or lower tail is important, and easy to get wrong. (Note the use of the tab key for hints on function arguments).
3.3 Resistant Descriptors of Quantitative Data
Here we’ll consider some tools that are resistant to the presence of outliers in the data.
3.4 Visualizing Quantitative Data: Histograms - Part I
Here we introduce histograms and kernel density estimates (kde) as tools for visualising distributions. Note that the kde is somewhat sensitive to the bandwidth used to generate it - a wider bandwidth yields a smoother distribution.
3.5 Visualizing Quantitative Data: Histograms - Part II
Here we explore how we can alter histograms by changing the bin width.
3.6 Visualizing Quantitative Data: Boxplots & Stripcharts
In this screencast we’ll demonstrate the boxplot and the stripchart, both of which can be useful tools for visualizing qualitative variables.
3.7 Making Qualitative Variables from a Numeric Variable
This screencast will demonstrate the stem-and-leaf plot and will also show how to group values from a quantitative variable using the function cut()
to create a qualitative variable.