Lesson 3: Quantitative DataLesson 3: Quantitative Data
In this lesson we'll cover some basic tools for describing quantitative (or continuous) data, using Chapter 3 of Essential R.
- 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
- 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 I – Center and Spread3.1 - Quantitative Variables I – 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 data3.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 calculalte 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 Data3.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 i3.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 ii3.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 & Stripcharts3.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 Variable3.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