The summary Function for regression models
The summary function in \(R\) is useful to quickly summarize the values in a vector, data frame, regression model, or ANOVA model in R.
For this practical we will look at it the summary function in regards to regression models.
Using a model created in practical 4 shown below
stopping<-read.csv("Stopping.csv", header=TRUE)
Model1 <- lm(sqrt(Distance) ~ Speed, data = stopping)we apply the summary function, which gives the following output;
summary(Model1)## 
## Call:
## lm(formula = sqrt(Distance) ~ Speed, data = stopping)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.4879 -0.5487  0.0098  0.5291  1.5545 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 0.918283   0.197406   4.652 1.82e-05 ***
## Speed       0.252568   0.009246  27.317  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7193 on 61 degrees of freedom
## Multiple R-squared:  0.9244, Adjusted R-squared:  0.9232 
## F-statistic: 746.2 on 1 and 61 DF,  p-value: < 2.2e-16
As you can see from this output there are a few different elements displayed. brief descriptions are stated below of each:
call: This shows us of the formula that we used in our regression model. It works as a nice reminder
Residuals: This is the summary of the distribution of residuals from the regression model.
Coefficients: This shows us estimated coefficients of the regression model. we need these to form the regression equation.
within this section the column headers are:
Estimate: The estimated coefficient.
Std. Error:This is the standard error of the coefficient.
t value:This is the t-statistic for the predictor variable, calculated as (Estimate) / (Std. Error)
Pr(>|t|):This is the p-value that corresponds to the t-statistic
Residual standard error: the residual standard error is the average SQUARED distance between the observed values of y and the fitted values
Multiple R-squared: This tells us coefficient of determination.
Adjusted R-squared R-squared that has been adjusted for the number of predictors in the model
F-statistic:
The F statistic is the test statistic for the hypothesis test H0: all parameters = 0 vs H1: not all parameters = 0
p-value: p-value corresponding to the F-test