Why Predict Tree Volume?

Tree volume is useful for estimating how much wood a tree contains, but measuring volume directly can be difficult.

Simple linear regression lets us use an easier measurement, such as tree girth, to predict tree volume.

In this presentation, we will use the built-in trees data set in R to explore this relationship.

What Is Simple Linear Regression?

Simple linear regression studies the relationship between two numerical variables.

  • The predictor variable \(x\) is used to explain or predict another variable.
  • The response variable \(y\) is the outcome we want to understand.
  • A straight line is used to summarize the relationship between them.

For our example:

  • \(x\) = Tree Girth
  • \(y\) = Tree Volume

The Regression Model

A simple linear regression model is written as:

\[ Y_i = \beta_0 + \beta_1 X_i + \epsilon_i \]

where:

  • \(\beta_0\) is the intercept
  • \(\beta_1\) is the slope
  • \(\epsilon_i\) represents random error

For our tree example:

\[ \text{Volume}_i = \beta_0 + \beta_1(\text{Girth}_i) + \epsilon_i \]

Understanding the Regression Line

After fitting the model, the predicted value is written as:

\[ \hat{Y} = b_0 + b_1X \]

  • \(b_0\) is the estimated intercept.
  • \(b_1\) is the estimated slope.
  • \(\hat{Y}\) is the predicted value of the response.

For our example, the slope tells us how much the predicted tree volume changes when girth increases by one unit.

A positive slope would mean that trees with larger girth tend to have larger volume.

Meet the Trees Data

We will use R’s built-in trees data set to test the relationship between tree size and volume.

The data contains three measurements:

  • Girth — tree diameter measured in inches
  • Height — tree height measured in feet
  • Volume — amount of timber measured in cubic feet

Our regression model will focus on whether Girth can be used to predict Volume.

First Look at the Relationship

Before fitting a regression model, we can visualize how girth and volume move together.

Fitting the Regression Line

Now we can add a fitted linear regression line to summarize the relationship.

Interactive View of the Regression

The same relationship can be explored interactively with Plotly.

Building the Model in R

The regression model can be created with only a few lines of R code.

model <- lm(Volume ~ Girth, data = trees)

ggplot(trees, aes(x = Girth, y = Volume)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE)

Main Takeaway

The data shows a clear positive relationship between tree girth and volume.

As girth increases, predicted tree volume also increases, making girth useful for estimating volume with a simple linear regression model.