---
title: 'Laboratory Exercise Week 14'
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. Researchers found that the speed of a prey (twips/s) and the length of prey (twips x 100) are good predictors of the time (s) required to catch a prey. (A twip is a measure of distance used by programmers). Data were collected in an experiment in which subjects were asked to "catch" an animal prey moving across his or her computer screen by clicking on it with the mouse. The investigators varied the length of the prey and the speed with which prey moved across the screen.

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

  i) Fit a multiple regression model for predicting catch time using prey length and speed as predictors.  
  ii) Construct 95\% confidence interval for the regression slopes of each predictor. Interpret your result. Will the interpretation change if you change the confidence level to 90\% and 99\%?  
  iii) Predict the catch time for two animals whose lengths are 4 and 6; and whose speeds are 30 and 60, respectively. State your result in paragraph form including the associated prediction intervals.  
  iv) Is the multiple regression model useful for predicting catch time? Use `R2`, `adj-R2`, and test the relevant hypothesis using `alpha = 0.05`. State your conclusion.  
  v) The primary researchers suggest that a simple regression model with the single predictor `x = length/speed` might be a better model for predicting catch time. Calculate and add the `x` values to the data using the function `mutate` in the package `dplyr`. Fit a simple linear regression model using the new variable/column `x`.   
  vi) Which of the two models considered (the multiple regression model in part (i) or the simple regression model in part (v)) would you recommend for predicting catch time? Justify your choice.   
  
  
### Code chunk
```{r} 
# start your code


# last R code line
```
