---
title: 'Laboratory Exercise Week 13'
author: "Your Name and Section, 10 pts"
date: "Todays Date"
output: word_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

*Directions*: 

* Write your R code inside the code chunks after each question.
* Write your answer comments after the `#` sign.
* To generate the word document output, click the button `Knit` and wait for the word document to appear.
* RStudio will prompt you (only once) to install the `knitr` package.
* Submit your completed laboratory exercise using Blackboard's Turnitin feature. Your Turnitin upload link is found on your Blackboard Course shell under the Laboratory folder.

***

For this exercise, you will need to use the packages `mosaic` and `dplyr` to find numerical and graphical summaries.


```{r warning=FALSE, message=FALSE}
# install packages if necessary
if (!require(mosaic)) install.packages(`mosaic`)
if (!require(dplyr)) install.packages(`dplyr`)
# load the package in R
library(mosaic) # load the package mosaic to use its functions
library(dplyr) # load the package dplyr to use data management functions
```


1. Data from the US Federal Reserve Board (2002) on the percentage of disposable personal income required to meet consumer load payments and mortgage payments for selected years are found in the data below

```{r}
debt <- read.csv("https://www.siue.edu/~jpailde/debt.csv")
debt
```

  i) Construct a scatterplot with a simple regression for this data set.      
  ii) Check the error model assumption visually by constructing a residual plot and QQplot of the residuals. Interpret what you see.  
  iii) Estimate the population regression slope by constructing 95\% confidence interval. Give a brief interpretation of the esimated slope in the context of the problem.  
  iv) Perform a hypothesis test on the regression slope, use a 5\% level of significance. Given an appropriate conclusion.



### Code chunk
```{r} 
# start your code


# last R code line
```


2. The data below contains sale price, size, and land-to-building ratio for 10 large industrial properties

```{r}
saleprice <- read.csv("https://www.siue.edu/~jpailde/saleprice.csv")
saleprice
```

  i) Construct a scatterpot for `sale price versus size` and `sale price versus land-to-building ratio`. Be sure to fit regression lines on the scatterplots.    
  ii) Use the `lm` function to estimated the equations of each regression model for `sale price versus size` and `sale price versus land-to-building ratio`.  
  iii) Check the error model assumption visually by constructing a residual plot and QQplot of the residuals for the two models.  
  iv) Estimate the population regression slope of each model (line) by constructing 95\% confidence interval. Give a brief interpretation of the esimated slope in the context of the problem.    
  v) Perform a hypothesis test on the regression slope of each model (line), use a 5\% level of significance. Given an appropriate conclusion.

### Code chunk
```{r} 
# start your code


# last R code line
```


