Due: Wednesday 2020-01-29 at 11:59pm
Go to the course organization on GitHub: https://github.com/sta-363-s20.
Find the repo starting with hw-01
and that has your team name at the end (this should be the only hw-01
repo available to you).
In the repo, click on the green Clone or download button, select Use HTTPS (this might already be selected by default, and if it is, you’ll see the text Clone with HTTPS as in the image below). Click on the clipboard icon to copy the repo URL.
Go to RStudio Cloud and into the course workspace. Create a New Project from Git Repo. You will need to click on the down arrow next to the New Project button to see this option.
Copy and paste the URL of your assignment repo into the dialog box:
Hit OK, and you’re good to go!
In this lab we will work with the tidyverse
package, the broom
package, and the ISLR
package. So we need to load them:
Note that this package is also loaded in your R Markdown document.
Your email address is the address tied to your GitHub account and your name should be first and last name.
To confirm that the changes have been implemented, run the following:
Currently your project is called Untitled Project. Update the name of your project to be “HW 01”.
Before we begin, let’s warm up with some simple exercises.
Open the R Markdown (Rmd) file in your project, change the author name to your name, and knit the document.
Auto
data from the ISLR
package, perform a simple linear regression with mpg
as the response and horsepower
as the predictor. Is there a relationship between the predictor and the response? How strong is the relationship between the predictor and the response? Is the relationship between the predictor and the response positive or negative? What is the 95% confidence interval? What is the predicted mpg
associated with a horsepower of 98?The code to fit the linear model is provided below.
The lm()
function fits the linear model. The tidy()
function from the broom
package takes the model output and puts it into a nice tidy data frame.
Carseats
data from the ISLR
package, fit a multiple regression model to predict Sales
using Price
, Urban
, and US
. Provide an interpretation of each coefficient in the model. Be careful—some of the variables in the model are qualitative. For which of the predictors can you reject the null hypothesis \(H_0 : \beta_j = 0\)?The code to fit the linear model is provided below.