---
title: 'Lab 11 - Math 58 / 58b: two quantitative variables'
author: "done during lab April 15 or 17, 2020"
date: "not due"
output:
pdf_document: default
---
```{r global_options, include=FALSE}
knitr::opts_chunk$set(message=FALSE, warning=FALSE, fig.height=3,
fig.width=5, fig.align = "center")
library(tidyverse)
```
## Lab Goals
* visualizing two quantitative variables
* calculating correlation and least squares linear models
## Getting Started
### Load packages & data
Data set contains information from the Ames Assessor's Office used in computing assessed values for individual residential properties sold in Ames, IA from 2006 to 2010. See http://jse.amstat.org/v19n3/decock/DataDocumentation.txt for detailed variable descriptions.
```{r load-packages, message=FALSE}
library(tidyverse)
ames <- read_table2("http://jse.amstat.org/v19n3/decock/AmesHousing.txt")
amesurl <- "https://github.com/beanumber/oilabs/blob/master/data/ames.rda?raw=True"
load(url(amesurl))
```
## Structure of the lab
#### Graphing two quantitative variables
The first part of the lab will be focused on exploring the data and learning about any nuances that might be relevant for our analysis.
> Recall, there is a data wrangling cheat sheet at: https://github.com/rstudio/cheatsheets/raw/master/data-transformation.pdf
> Recall, there is a `ggplot2` cheat sheet at: https://github.com/rstudio/cheatsheets/raw/master/data-visualization-2.1.pdf
#### Calculating correlation and linear model equation
## Analysis
### Graphing variables
1. Create a scatterplot with the explanatory variable (you choose!) on the x-axis, and the response variable on the y-axis. Be sure to have your axes labeled.
2.Superimpose the regression line onto your scatterplot. What happens when you make se=TRUE? What happens if you add color to the aesthetics (add color using a categorical variable)? Describe the plot.
#### Calculating correlation and linear model equation
3. Calculate and interpret correlation coefficient (sign, strength, linearity).
4. Determine and **interpret** the slope of the least squares line in context. The interpretation should be of the form: for every additional ____ we ESTIMATE that the AVERAGE ____ changes by ____.
5. Determine and **interpret** the intercept of the least squares regression line. Explain what this value might signify in this context. Is the interpretation meaningful within the context? Explain.