Question
Simple Linear Regression: 1. Download the file 'insurance.csv' from our class Blackboard site. 2. Read this file into your R environment. Show the step that
Simple Linear Regression:
1. Download the file 'insurance.csv' from our class Blackboard site.
2. Read this file into your R environment. Show the step that you used to accomplish this.
3. Filter the dataframe to create a new dataframe that only contains the records of people who are not smokers. Show the code that you used to do this. -- You will use this new dataframe for the rest of the assignment --
4. Using ggplot, create a scatterplot to depict the relationship between the input variable age and the output variable charges. Show your scatterplot, along with the code that you used to build it. What does this scatterplot suggest about the relationship between the two variables? Why (or why not) does this make intuitive sense to you?
5. Find the correlation between age and charges. Show the code that you used, and the results from your console, in a screenshot.
6. Using your assigned seed value, create a data partition. Assign approximately 60% of the records to your training set, and the other 40% to your validation set. Show the code that you used to do this.
7. Using your training set, create a simple linear regression model. Show the step(s) that you used to do this. Include a screenshot of the summary of your model, along with the code you used to generate that summary.
8. What is the regression equation generated by your model? Make up a hypothetical input value and explain what it would predict as an outcome. To show the predicted outcome value, you can either use a function in R, or just explain what the predicted outcome would be, based on the regression equation and some simple math.
9. Using the accuracy() function from the forecast package, assess the accuracy of your model against both the training set and the validation set. What do you notice about these results? Describe your findings in a couple of sentences.
I dont know why i Cant attach the csv file here. I can set it bu email
And also please set the seed value as 190 set.seed(190)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started