Question
Background The data in train.csv consist of the sales data for 1460 homes in Ames Iowa in 2009. The Ames Housing dataset was originally compiled
Background
The data in train.csv consist of the sales data for 1460 homes in Ames Iowa in 2009. The Ames Housing dataset was originally compiled by Dean De Cock for use in data science education and you will be using this data for all three projects this semester. For projects 2 and 3 you will use your linear regression and regularization skills to make predictions of the sales prices for other homes in Ames, Iowa and will be competing against other teams for finding the model that makes the best predictions. You will need to explore the data in order to model your variables correctly. As a first step, you will use Project 1 to explore using a log transformation.
Task
Download the Ames housing data file and the starter script Download the starter script. Create the 4 plots described in the starter script and use them to answer the questions in the word doc.
the starter script
# Call in the data. train <- read.csv("train.csv", strings=T)
# Q1 and Q2 # Use the folloing lines of code to produce 2 histograms on the same graphics window. # Use the resulting graphs to answer Q1 and 2 on the submission document.
par(mfrow=c(1,2)) # one row with 2 graphics on a single graphics window # the above line will open a blank graphics window - leave open while running the next 2 lines. hist(train$GrLivArea, breaks=20, main = "Square Feet", cex.main = 2, xlab = "") hist(log(train$GrLivArea), main = "Log Square Feet", cex.main = 2, xlab = "")
# Q3 and Q6 # Write code similar to the 3 lines above to create 2 scatterplots on one graphics window. # The left scatterplot should have sales price on the vertical axis and square footage on the horizontal. # The right plot should have log sales price as the y and log square footage as the x. # Label the x and y axis. # Do not include titles. # Paste the resulting graphics into the submission document for Q3. # Paste the 3 lines of code under the Q6 prompt in the submission document.
need the code and the images
basic r
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