3 Bivariate Data
Previously, we explored some of the tools for working with data, but only one variable at a time. Now we explore the tools for analyzing the associations between variables. We start with the association between two variables, or bivariate association. We will explore visual tools and plots for two variables, then move on to more number-based tools.
Learning Objectives
- Learn how to plot bivariate data.
- Learn how to summarize a bivariate relationship numerically.
- Learn how to fit a linear model, or equivalently, perform linear regression.
Useful Functions
- Use the
~
operator to express the relationship between a dependent variable and independent variable(s). - Use
cov()
to calculate covariance. - Use
cor()
to calculate correlation. Use
lm()
to fit a linear model, or equivalently, perform linear regression.- Use
plot()
to make a scatter plot. - Use
abline()
to add a straight lone to a plot. Use
boxplot()
to make a box plot.