Make a scatterplot of the data, Title the plot and label the axes appropriately
Index<-c(16.7,17.1,18.2,18.1,17.2,18.2,16.0,17.2,18.0,17.2,16.9,17.1,18.2,17.3,17.5,16.6)
Days<-c(91,105,106,108,88,91,58,82,81,65,61,48,61,43,33,36)
plot(Index,Days,title(main = 'Scatterplot'),xlab = 'Index', ylab = 'Days')
What are the Least Squares estimates of the parameters of a simple linear regression?
model <- lm(Days~Index)
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
coefficients(model)
## (Intercept) Index
## -192.98383 15.29637
--> As You can see estimates.$$\beta_{0} = -192.98383$$ $$\beta_{1}=15.29637$$
Add the least squares line to the scatter plot
plot(Index,Days,title(main = 'Scatterplot'),xlab = 'Index', ylab = 'Days')
plot(Days~Index)+abline(model)
## integer(0)
--> As you can see the above is the scattered data points and line fitted to the data
Check for model adequacy using diagnostic plots. Show the plots and comment on the assumptions of Constant Variance and Normality.
plot(model,2)
plot(model,1)
i=seq(1,16,1)
plot(i,model$residuals,ylab = 'Residuals',xlab = 'i')
Does the regression appear to be significant? 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
--> Because P - value is less than 0.05, x is not significant. Moreover there are no ** asterisks in P value