#Creating our training and test data frames
sample.split(diamonds$price,SplitRatio =0.65)-> split_values #uses a 0.65 to 0.35 split subset(diamonds,split_values==T)-> train_reg subset(diamonds,split_values==F)-> test_reg
#buidling linear model lm(price~.,data=train_reg)->mod_regress predict(mod_regress,test_reg)-> result_regress cbind(Actual=test_reg$price,Predicted=result_regress)-> Final_Data as.data.frame(Final_Data)->Final_Data View(Final_Data)
This type of plot will help indicate if the predictor variables and the outcome variables have a linear or non-linear relationship. If there are equally spread residuals sitting around a horizontal line, this would be a good indicator of a linear relationship. However, if there is no equal spread around a horizontal line this could be indicating a non-linear relationship. In the case above, it could be assumed that the model has a linear relationship as in the plot there is a somewhat equal spread around a horizontal line however there is a slight progressive increase to the line which could be hinting at a parameter of the model which has not been defined.
A normal Q-Q plot will show if the residuals are normally distributed. This is demonstrated when they follow a straight line or not. A positive result would be the residuals lined up well on the straight line. Following these assumptions, the Normal Q-Q plot we have above looks concerning.