Question: Goal is to build a Multiple Linear Regression Model in R. Please take the screenshots of the outputs from each step and include in the
Goal is to build a Multiple Linear Regression Model in R.
Please take the screenshots of the outputs from each step and include in the word document. Explain the Outputs in each step as per your understanding.
- data(iris) # load iris data
- head(iris) # peek at the data
- unique(iris$Species) # look at unique species
- plot(iris[1:4]) # Scatterplot matrix
- x <- iris$Petal.Length
- y <- iris$Petal.width
- model <- lm(y ~ x) # simple linear regression model
- lines (
x = iris$Petal.Length,
y = model$fitted,
col = red
lwd = 3)
- cor (
x = iris$Petal.Length,
y = iris$Petal.Width) # Get Correlation Coefficient
- summary (model) # Summarize the Model
- predict (
object = model,
newdata = data.frame(x = c(2,5,7)))
- Now add one more variable to your Model and repeat the steps from 5 to 11. (Multiple Linear Regression Model).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
