2025-03-25

Introduction

This presentation demonstrates the simple linear regression analysis and confidence interval of orange tree growth patterns using the trees dataset.

Data Overview

Key variables: Girth (inches), Height (feet), Volume: (cubic feet)

##   Girth Height Volume
## 1   8.3     70   10.3
## 2   8.6     65   10.3
## 3   8.8     63   10.2
## 4  10.5     72   16.4
## 5  10.7     81   18.8
## 6  10.8     83   19.7
## 'data.frame':    31 obs. of  3 variables:
##  $ Girth : num  8.3 8.6 8.8 10.5 10.7 10.8 11 11 11.1 11.2 ...
##  $ Height: num  70 65 63 72 81 83 66 75 80 75 ...
##  $ Volume: num  10.3 10.3 10.2 16.4 18.8 19.7 15.6 18.2 22.6 19.9 ...

Girth vs Volume Plot


The plot shows a positive correlation between Girth and Volume.

Plot with Linear Regression


The plot shows a positive correlation between Girth and Volume with a linear regression line. The gray area demonstrates the .95 confidence interval.

Linear Regression Information

mod <- lm(Girth ~ Volume, data=trees)
summary(mod)
## 
## Call:
## lm(formula = Girth ~ Volume, data = trees)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.2945 -0.5742 -0.1520  0.7131  1.5248 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 7.677857   0.308628   24.88   <2e-16 ***
## Volume      0.184632   0.009016   20.48   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8117 on 29 degrees of freedom
## Multiple R-squared:  0.9353, Adjusted R-squared:  0.9331 
## F-statistic: 419.4 on 1 and 29 DF,  p-value: < 2.2e-16

Linear Regression Equation

The relationship can be modeled as:

\(Volume = \beta^0 + \beta^1 × Girth + ϵ\)

Where:
\(\beta^0 = Intercept = 7.6778\)
\(\beta^1 = Slope\space coefficient = 0.1846\)
ϵ = Error term

Confidence Interval Equation

The 95% confidence interval for the regression slope is given by the equation:

\[\beta^1 \pm t_{\alpha/2, n-2} + SE(\beta^1)\]

Where:

\(\beta^1 = Estimated\space slope\)
\(t_{\alpha/2, n-2} = Critical\space t-value\)
\(SE(\beta^1) = Standard\space error\)

Girth vs Height Plot


The points are very scattered, with most points falling in between 12 - 16 feet of girth. There seems to be little to no correlation between Girth and Height.

Plot with Linear Regression


In this plot, we see that the linear regression model demonstrates that there is a very slight positive correlation between Girth and Height.

Plotly Plot


Here is an interactive plot between Girth and Volume, made with plotly.