days <- c(91, 105, 106, 108, 88, 91, 58, 82, 81, 65, 61, 48, 61 ,43, 33, 36)
index <- c(16.7, 17.1, 18.2, 18.1, 17.2, 18.2, 16, 17.2, 18, 17.2, 16.9, 17.1, 18.2, 17.3, 17.5, 16.6)
Make a scatterplot of the data, Title the plot and label the axes appropriately
plot(index,days)
title("Scatterplot Days vs. Index")
What are the Least Squares estimates of the parameters of a simple linear regression?
model <- lm(days~index)
coef(model)
## (Intercept) index
## -192.98383 15.29637
B1 is 15.29637 and B0 is -192.98383
Add the least squares line to the scatterplot.
plot(index,days)
abline(model)
title("Scatterplot Days vs. Index")
Check for model adequacy using diagnostic plots. Show the plots and comment on the assumptions of Constant Variance, Normality, and whether there appear to be outliers.
plot(lm(days~index))
Figure 1
Figure 2
Figure 3
Does the regression appear to be signficant? Why or why not?
summary(model)
##
## Call:
## lm(formula = days ~ index)
##
## Residuals:
## Min 1Q Median 3Q Max
## -41.70 -21.54 2.12 18.56 36.42
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -192.984 163.503 -1.180 0.258
## index 15.296 9.421 1.624 0.127
##
## Residual standard error: 23.79 on 14 degrees of freedom
## Multiple R-squared: 0.1585, Adjusted R-squared: 0.09835
## F-statistic: 2.636 on 1 and 14 DF, p-value: 0.1267
As shown in the model summary we see that the t value of the slope is 1.624, comparing this value with 2.1448, we can’t reject the null hypothesis, the alternative is to be B1=0 . The model appear to be insignficant . [ P-value can be used that 0.1267>0.05 that’s mean we fail to reject the null hypothesis].