Welcome to the third lesson in the FES720 Statistics series! In this series of lessons, we are looking at how to do various common statistical tests in R, leading to more complex data and modelling approaches.

So far we have looked at solely categorical data (Testing Ratios) and continuous data from categories (Testing Populations).

In this lesson, we will look at methods to test whether two or more samples of continuous data are positively or negatively associated. We will also consider having multiple predictor variables. Our fundamental question is:

Is There An Association Between Two (or More) Variables?

Categorical Variables

For categorical variables, we can use a Chi-Squared test of association. See the Testing Ratios lesson for more details.

Two Continuous Variables

Consider that we have two (2) continuous variables. A first question might be: ‘Do these samples come from the same distribution?’ we can use a Kolmogorov-Smirnov Test to answer this.

The function ks.test() performs a two-sample test of the null hypothesis that x and y were drawn from the same continuous distribution.

Let’s generate some random data that we can use to test this function. Use the function rnorm() to generate 50 values drawn randomly from a normal distribution. Remember that rnorm() requires the number of samples (n =). You can also change the mean and standard deviation. In this case, just generate 50 values with the defaults. Assign this to x.

x <- rnorm(50)

Now, generate a vector or 50 values from a uniform distribution, and assign this to y.

y <- runif(50)

The ks.test() function takes x = and y =. Put our two new objects in there and test if they are from the same distribution.

ks.test(x, y)
## 
##  Two-sample Kolmogorov-Smirnov test
## 
## data:  x and y
## D = 0.6, p-value = 1.062e-08
## alternative hypothesis: two-sided

The p-value less than 0.001 suggests that x and y are indeed drawn from different distributions (as we suspected … ).

Correlation

Whether we run correlation or a regression depends on how we think the two variables are related. If we think that there is no causal relationship between the two, then we would test for a correlation. If we think that there is a causal relationship between the two, then we would run a regressin.

As they saying goes ‘correlation does not imply causation’.

The function cor() returns the correlation coefficient of two variables. It requires an x = and a y =, and a method =. Pearson’s product moment correlation coefficient (method = 'pearson') is the parametric version used for normal data (and the default). Kendall’s tau (method = 'kendall') or Spearman’s rho (method = 'spearman') are used for non-parametric data.

The function cor.test() tests for association—correlation—between paired samples, using one of Pearson’s product moment correlation coefficient, Kendall’s tau, or Spearman’s rho, as above. The three methods each estimate the association between paired samples and compute a test of the value being zero (indicating no association).

In the New Haven Road Race data, it would seem sensible that Net time and Pace are correlated. They are both measures of how long each person spent running, but a faster Pace does not cause a faster net time.

The race data are loaded with the lesson. Calculate the correlation coefficient of Net time and Pace.

cor(x = race$Nettime_mins, y = race$Pace_mins)
## [1] 0.9953277

Now test if this correlation coefficient is greater than 0.

cor.test(x = race$Nettime_mins, y = race$Pace_mins)
## 
##  Pearson's product-moment correlation
## 
## data:  race$Nettime_mins and race$Pace_mins
## t = 529.66, df = 2640, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.9949582 0.9956703
## sample estimates:
##       cor 
## 0.9953277

As usual, you can assign this to an object, and extract the various parts of the object, such as the coefficient, p-value, etc.

Simple Linear Regression

Ok, now we are coming to the statistical model that you will probably use most of all. If we think that one variable/s is driving variation in the other, we should use regression rather than correlation.

The function lm() is used to develop linear models. At its simplest, it takes one argument: formula =. This argument is the first one, and so folks rarely even write out the formula = part.

However, this formula is how models (i.e., statistical relationships between variables) are specified, symbolically. A typical model has the form response ~ terms, where response is the response (or dependent) variable and terms is (a series of) term/s which specifies a linear predictor (or independent) variable.

The response variable is fitted as a function of the predictor variable. The tilde symbol (~) signifies ‘as a function of’, and separates the response and predictor variables. Adding further predictor variables to the right hand side is also possible (see Formulae).

For now, we will carry out a simple regression of a single predictor and response. This model estimates values for the three elements of the equation: y ~ beta0 + beta1 * x + sigma.

In other words: y ~ intercept + slope * x + sd of the error. We will come back to this later.

We will illustrate the use of lm() using the sparrow data, loaded with this lesson (even though we know there is actually no causality here).

First, as always, look at the data. Display the head of the sparrow data, sparrow.

head(sparrow)
##   Species    Sex Wingcrd Tarsus Head Culmen Nalospi   Wt Observer Age
## 1    SSTS   Male    58.0   21.7 32.7   13.9    10.2 20.3        2   0
## 2    SSTS Female    56.5   21.1 31.4   12.2    10.1 17.4        2   0
## 3    SSTS   Male    59.0   21.0 33.3   13.8    10.0 21.0        2   0
## 4    SSTS   Male    59.0   21.3 32.5   13.2     9.9 21.0        2   0
## 5    SSTS   Male    57.0   21.0 32.5   13.8     9.9 19.8        2   0
## 6    SSTS Female    57.0   20.7 32.5   13.3     9.9 17.5        2   0

Second, let’s plot the data that we want to model. Plot Tarsus as a function of Wingcrd, making sure that you use a formula and the data = argument.

plot(Tarsus ~ Wingcrd, data = sparrow)

It looks like there is a positive relationship between the two. Ok, now we are ready to run the actual model. Call the output m0, and use lm() to model Tarsus as a function of Wingcrd. Notice that you can use almost the same code as you used to plot the data.

m0 <- lm(Tarsus ~ Wingcrd, data = sparrow)

Ok, so our model is stored in the object m0. We can use several functions to extract all or part of this object. As usual, we can use str() to look at everything contained in the model object m0. Try that.

str(m0)
## List of 12
##  $ coefficients : Named num [1:2] 8.374 0.226
##   ..- attr(*, "names")= chr [1:2] "(Intercept)" "Wingcrd"
##  $ residuals    : Named num [1:979] 0.1935 -0.0669 -0.733 -0.433 -0.2801 ...
##   ..- attr(*, "names")= chr [1:979] "1" "2" "3" "4" ...
##  $ effects      : Named num [1:979] -671.968 16.218 -0.74 -0.44 -0.285 ...
##   ..- attr(*, "names")= chr [1:979] "(Intercept)" "Wingcrd" "" "" ...
##  $ rank         : int 2
##  $ fitted.values: Named num [1:979] 21.5 21.2 21.7 21.7 21.3 ...
##   ..- attr(*, "names")= chr [1:979] "1" "2" "3" "4" ...
##  $ assign       : int [1:2] 0 1
##  $ qr           :List of 5
##   ..$ qr   : num [1:979, 1:2] -31.289 0.032 0.032 0.032 0.032 ...
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:979] "1" "2" "3" "4" ...
##   .. .. ..$ : chr [1:2] "(Intercept)" "Wingcrd"
##   .. ..- attr(*, "assign")= int [1:2] 0 1
##   ..$ qraux: num [1:2] 1.03 1.02
##   ..$ pivot: int [1:2] 1 2
##   ..$ tol  : num 1e-07
##   ..$ rank : int 2
##   ..- attr(*, "class")= chr "qr"
##  $ df.residual  : int 977
##  $ xlevels      : Named list()
##  $ call         : language lm(formula = Tarsus ~ Wingcrd, data = sparrow)
##  $ terms        :Classes 'terms', 'formula'  language Tarsus ~ Wingcrd
##   .. ..- attr(*, "variables")= language list(Tarsus, Wingcrd)
##   .. ..- attr(*, "factors")= int [1:2, 1] 0 1
##   .. .. ..- attr(*, "dimnames")=List of 2
##   .. .. .. ..$ : chr [1:2] "Tarsus" "Wingcrd"
##   .. .. .. ..$ : chr "Wingcrd"
##   .. ..- attr(*, "term.labels")= chr "Wingcrd"
##   .. ..- attr(*, "order")= int 1
##   .. ..- attr(*, "intercept")= int 1
##   .. ..- attr(*, "response")= int 1
##   .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> 
##   .. ..- attr(*, "predvars")= language list(Tarsus, Wingcrd)
##   .. ..- attr(*, "dataClasses")= Named chr [1:2] "numeric" "numeric"
##   .. .. ..- attr(*, "names")= chr [1:2] "Tarsus" "Wingcrd"
##  $ model        :'data.frame':   979 obs. of  2 variables:
##   ..$ Tarsus : num [1:979] 21.7 21.1 21 21.3 21 20.7 22 20.8 20.1 22.2 ...
##   ..$ Wingcrd: num [1:979] 58 56.5 59 59 57 57 57 57 53.5 56.5 ...
##   ..- attr(*, "terms")=Classes 'terms', 'formula'  language Tarsus ~ Wingcrd
##   .. .. ..- attr(*, "variables")= language list(Tarsus, Wingcrd)
##   .. .. ..- attr(*, "factors")= int [1:2, 1] 0 1
##   .. .. .. ..- attr(*, "dimnames")=List of 2
##   .. .. .. .. ..$ : chr [1:2] "Tarsus" "Wingcrd"
##   .. .. .. .. ..$ : chr "Wingcrd"
##   .. .. ..- attr(*, "term.labels")= chr "Wingcrd"
##   .. .. ..- attr(*, "order")= int 1
##   .. .. ..- attr(*, "intercept")= int 1
##   .. .. ..- attr(*, "response")= int 1
##   .. .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> 
##   .. .. ..- attr(*, "predvars")= language list(Tarsus, Wingcrd)
##   .. .. ..- attr(*, "dataClasses")= Named chr [1:2] "numeric" "numeric"
##   .. .. .. ..- attr(*, "names")= chr [1:2] "Tarsus" "Wingcrd"
##  - attr(*, "class")= chr "lm"

There is a lot in there! Given that it is a list, we can access any part of it as we would any other list. For example, we could use m0$coefficients to pull out the model coefficients. Try that.

m0$coefficients
## (Intercept)     Wingcrd 
##   8.3738466   0.2264258

There are also a number of generic functions that are built to work on any model object. One of these generic functions is coef(), which we can use to pull out the coefficient estimates of the model. Try putting m0 in a call to coef().

coef(m0)
## (Intercept)     Wingcrd 
##   8.3738466   0.2264258

Both m0$coefficients and coef(m0) return a (identical) named vector: The names of each coefficient estimate are given for each element of the vector. The intercept is the intercept, i.e., when x = 0, at what point the regression line crosses the y-axis. The slope of the regression line is given by the element named for the predictor variable in the model (in this case Wingcrd). The slope means for a unit change in x, what the change in y is. In this case, a 1-unit change in Wingcrd leads to an increase of 0.23 in Tarsus.

Let’s look at a more traditional output of the statistical model. We can use summary() to return that. Do so.

summary(m0)
## 
## Call:
## lm(formula = Tarsus ~ Wingcrd, data = sparrow)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.06691 -0.53297 -0.03297  0.42273  3.04060 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  8.37385    0.61834   13.54   <2e-16 ***
## Wingcrd      0.22643    0.01068   21.21   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7648 on 977 degrees of freedom
## Multiple R-squared:  0.3152, Adjusted R-squared:  0.3145 
## F-statistic: 449.7 on 1 and 977 DF,  p-value: < 2.2e-16

Here we see several parts to the model output. First, the model itself (Call), then a summary of the residuals (Residuals), then details of the coefficients (Coefficients), their values, standard errors, t values, and p values. The p-values correspond to specific tests. First, the test is if the intercept is significantly different from 0. We are not too often interested in this value or significance. What we are usually more interested in is if there is indeed a positive or negative relationship between the two variables in the model. The p-value in this case tells us if the slope is significantly different from 0. In this case it is, and so we infer that as Wingcrd increases, so does Tarsus.

Below this, we also get some information on the remaining unexplained variation, R2 values, and F tests.

The other useful parts of the model that you may want to look at, at least for model-checking, are the residuals, using either m0$residuals or the generic function residuals(). Try either of those.

Both of these return all residuals values for each data point … you may want to assign this to another object, e.g., m0.resid in future, or just use them as is, if needed.

Adding the fitted line to the plot

We have our plot, we have our model; now we want to combine them. Usually, you would not add non-significant fitted regression lines to a plot. This model was significant, so we can feel doing so. The function to add a straight line to a plot is abline() (which I think is supposed to be pronounced ‘a-b-line’, but ‘ab-line’ rolls off the tongue much more easily to me …).

abline() can take a variety of inputs. For plotting a fitted line, you would either provide coef = (a vector of length two giving the intercept and slope), or a = and b = (the intercept and slope, as single values). Usefully, abline() can also extract the intercept and slope automagically from a model object. Pass m0 to abline() and watch the plotting window …

If you look at the help page for abline(), you will see that it has elipses (…) as its final argument. You can therefore access all the plotting commands that would affect the appearance of the line from within the call to abline(). Make another call to abline(), but make the line twice as wide, and red.

More than one predictor variable: Multiple regression

In the ANOVA and simple regression models that we have run so far, they have all had single response/dependent variable as a function of a single predictor/independent variable. But in many cases we know that there are several things that could reasonably influence the response variable. For example, species and sex could both affect sparrow size; age and sex could both influence running time.

It is straightforward to include multiple predictors in a model. We start with the simple, special (!), case of Analysis of Covariance (ANCOVA).

One continuous and one categorical predictor: Analysis of Covariance

Statisticians realised early on that ANOVA was merely the beginning of analysing experiments—other factors apart from the experimental treatment might influence the response variable they were interested in. This issue is especially pertinent when considering change, i.e., does our experimental treatment affect growth or survival? The starting point of each sample is important. If we are measuring growth of seedlings, how big that seedling is at the start of the experiment will have a big effect on its’ growth. Moreover, if by chance all the big seedlings ended up in one treatment and the small ones in another, we may erroneously assign significance to the treatment.

Thus, analysis of variance with a continuous covariate was born (i.e., Analysis of Covariance), and we can ask if our treatment had a significant effect, accounting for the measured variation in initial conditions (seedling initial size, for example).

What does the model tell us? Nest the call to lm() within the summary() function, to output the result table in one line of code.

summary(lm(Head ~ Sex, data = sparrow))
## 
## Call:
## lm(formula = Head ~ Sex, data = sparrow)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.5817 -0.5452 -0.1452  0.2548  3.5548 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 31.78166    0.05554 572.214  < 2e-16 ***
## SexMale      0.36356    0.06616   5.495 4.98e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9442 on 977 degrees of freedom
## Multiple R-squared:  0.02998,    Adjusted R-squared:  0.02899 
## F-statistic:  30.2 on 1 and 977 DF,  p-value: 4.978e-08

This model suggest that male sparrows have larger heads than female sparrows. In more detail, because we called lm(), the results show us the mean value for females ((Intercept)) and the difference between males and females (SexMale) (because the predictor variable is categorical).

(Note that we ran an ANOVA here with the lm() function … crazy! … Actually, ANOVA is essentially a special case of a linear model, so we can use lm() and aov() interchangeably to run an ANOVA. The only real effect will be how things like summary() work. To look at the ANOVA table after a call to lm(), you would need to use summary.aov(); to look at the linear model table after a call to aov(), you would need to use summary.lm(). Simples … )

However, we could reasonably assume that larger sparrows in general will have larger heads. Accounting for sparrow size as we compare sex might be a good idea. We can include a different measure of sparrow size, such as Tarsus length, in the model.

The simplest model we can make with two variables is an additive model. Here, we specify response ~ variable1 + variable2. What we are actually asking is if there is a difference between the mean values of variable1 and variable2 at the intercept (i.e., testing if the fitted lines for each variable have different intercepts). Modify your previous model to add Tarsus after Sex.

summary(lm(Head ~ Sex + Tarsus, data = sparrow))
## 
## Call:
## lm(formula = Head ~ Sex + Tarsus, data = sparrow)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.49966 -0.42453  0.00034  0.42574  2.46084 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 16.552598   0.522026  31.708   <2e-16 ***
## SexMale      0.001364   0.049871   0.027    0.978    
## Tarsus       0.721000   0.024640  29.261   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6895 on 976 degrees of freedom
## Multiple R-squared:  0.4833, Adjusted R-squared:  0.4822 
## F-statistic: 456.4 on 2 and 976 DF,  p-value: < 2.2e-16

The model summary shows that now, Sex is not significant but Tarsus is, i.e., male and female sparrows do not have significantly different Head size accounting for Tarsus size, and also that the relationship between Head and Tarsus is significant and positive. We could also think about this the other way: the relationship between Head and Tarsus is the same for males and females, i.e., there is no morphological difference between sparrow sexes.

One final detail. Run the same model within summary(), but using aov() instead of lm()…

summary(aov(Head ~ Sex + Tarsus, data = sparrow))
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## Sex           1   26.9    26.9   56.63 1.19e-13 ***
## Tarsus        1  407.0   407.0  856.23  < 2e-16 ***
## Residuals   976  464.0     0.5                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Now run the same model again, but swap the places of Sex and Tarsus.

summary(aov(Head ~ Tarsus + Sex, data = sparrow))
##              Df Sum Sq Mean Sq F value Pr(>F)    
## Tarsus        1    434   434.0 912.863 <2e-16 ***
## Sex           1      0     0.0   0.001  0.978    
## Residuals   976    464     0.5                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

You should have two ANOVA tables displayed in the console. You appear to have run the same model (Head as a function of Sex and Tarsus), yet the results are quite different.

R conducts ANOVA tests (aov()) sequentially. Thus in the model Head ~ Tarsus + Sex, it removes (or accounts) for the effect of Tarsus before testing for differences between the sexes. In this second model, then, the effect of Sex is not significant, which is also what we saw in the output from lm() above (it makes no difference what order the variables are in for lm()).

Ok, we can use this simple model structure to ask not only if males and females have different head sizes on average, but also if the relationship between Head and Tarsus differes between the sexes (i.e., are the slopes significantly different).

We can run this interaction model by replacing the + in the model formula with a *. Try that, modifying your previous model that used lm(), still within summary().

summary(lm(Head ~ Sex * Tarsus, data = sparrow))
## 
## Call:
## lm(formula = Head ~ Sex * Tarsus, data = sparrow)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.49831 -0.42447  0.00169  0.43124  2.45326 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    15.72467    0.93116  16.887   <2e-16 ***
## SexMale         1.21537    1.13177   1.074    0.283    
## Tarsus          0.76020    0.04404  17.260   <2e-16 ***
## SexMale:Tarsus -0.05705    0.05313  -1.074    0.283    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6894 on 975 degrees of freedom
## Multiple R-squared:  0.4839, Adjusted R-squared:  0.4823 
## F-statistic: 304.7 on 3 and 975 DF,  p-value: < 2.2e-16

Let’s walk through these results. As before, we have the model and a summary of the residuals. Next is the coefficient table.

This table shows the coefficient estimates, standard error, and the t values and associated p values for significance tests. The way that the coefficients and tests are presented are different between categorical and continuous variables.

In this case, the first row of the output ((Intercept)) shows the mean Head size of females (‘female’ comes before ‘male’ alphanumerically). The test is whether this mean value is different from 0 (not usually that useful).

The difference between the mean Head size of males and the mean Head size of females is shown in the row indicated by SexMale. The test is whether this difference is 0 (here, there is no significant difference). To obtain the actual mean value of male Head size, you need to add the estimate for males to the estimate for females: 15.725 + 1.215.

The other two rows in the results table describe the slopes of the two fitted relationships. The row Tarsus shows the slope of the continuous variable (Tarsus) for the first level of the factor $Sex (females, 0.76). The test is whether this slope is different from 0 (yes, it is).

The row indicated by Tarsus:SexMale shows the difference in the slope between males and females. The test is whether this difference is different from 0 (i.e., do females and males have different slopes). (they don’t). To get the actual slope for males, you have to take the slope for females (0.76) and add this difference (0.76 + -0.057).

Now, let’s plot! Make a plot of Head on Tarsus.

plot(Head ~ Tarsus, data = sparrow)

To plot the regression lines on our plot of Head ~ Tarsus, we have to extract them from the model output. Make a new model, m1, using lm() to model Head as a function of the interaction between Sex and Tarsus.

m1 <- lm(Head ~ Sex * Tarsus, data = sparrow)

Extract the coefficients using coef().

coef(m1)
##    (Intercept)        SexMale         Tarsus SexMale:Tarsus 
##    15.72466830     1.21536938     0.76019705    -0.05705086

Now using the named elements of coef(m1), subset out the value for mean female Head size (i.e., the intercept).

coef(m1)['(Intercept)']
## (Intercept) 
##    15.72467

Now extract the value for the slope of females.

coef(m1)['Tarsus']
##    Tarsus 
## 0.7601971

Now, put these two sections of code into a call to abline() and add the fitted line for female sparrows to the plot, using the arguments a = and b =.

plot(Head ~ Tarsus, data = sparrow)
abline(a = coef(m1)['(Intercept)'], b = coef(m1)['Tarsus'])

We can modify this call to abline() to add the fitted line for males. Remember that the two values given for males are the differences between males and females. All within a new call to abline(), add in the calculation to obtain the absolute values for males to plot the fitted line. Make the line red.

plot(Head ~ Tarsus, data = sparrow)
abline(a = coef(m1)['(Intercept)'], b = coef(m1)['Tarsus'])
abline(a = (coef(m1)['(Intercept)'] + coef(m1)['SexMale']), b = (coef(m1)['Tarsus'] + coef(m1)['SexMale:Tarsus']), col = 'red')

Multiple regression with continuous predictors

Multiple regression allows us to see the relationship between two variables, accounting for other variables in the model.

Let’s continue with the sparrow data to illustrate this. Run an additive linear model (lm()) of Head as a function of Wingcrd, Tarsus, Culmen and Nalospi. Assign the output to m2.

m2 <- lm(Head ~ Wingcrd + Tarsus + Culmen + Nalospi, data = sparrow)

Look at the summary of this model.

summary(m2)
## 
## Call:
## lm(formula = Head ~ Wingcrd + Tarsus + Culmen + Nalospi, data = sparrow)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.37555 -0.29379  0.06689  0.36548  1.50872 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 13.955983   0.469109  29.750  < 2e-16 ***
## Wingcrd      0.062762   0.009058   6.929 7.71e-12 ***
## Tarsus       0.255380   0.026351   9.691  < 2e-16 ***
## Culmen       0.346275   0.032392  10.690  < 2e-16 ***
## Nalospi      0.456229   0.036478  12.507  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5306 on 974 degrees of freedom
## Multiple R-squared:  0.6946, Adjusted R-squared:  0.6933 
## F-statistic: 553.8 on 4 and 974 DF,  p-value: < 2.2e-16

Here, we see the common intercept for all the four predictors, as well as their individual slopes (we have no categorical variables in this model, so there are no differences between levels to worry about).

Check the multiple regression page to see how you might go about making a figure of these data.

This is the end. You should now be able to make a wide variety of simple additive and interaction models using continuous and categorical variables.