data(Orange) head(Orange)
Tree age circumference 1 1 118 30 2 1 484 58 3 1 664 87 4 1 1004 115 5 1 1231 120 6 1 1372 142
February 08, 2026
.gdbar { width: 200px !important; height: 100px !important; }
Orangedata(Orange) head(Orange)
Tree age circumference 1 1 118 30 2 1 484 58 3 1 664 87 4 1 1004 115 5 1 1231 120 6 1 1372 142
Orange: Age (in days from 12/31/68) vs. Circumferencex <- Orange$age y <- Orange$circumference model <- lm(y~x, data = Orange) orangefig <- plot_ly(Orange, x = ~age, y = ~circumference, z = ~Tree) %>% add_markers(color = ~Tree) orangefig
model: \(\sum_{i=1}^n(y_i - \bar{y})^2 = \sum_{i=1}^n(\hat{y}_i - \bar{y})^2 + \sum_{i=1}^n(y_i - \hat{y}_i)^2\)
`geom_smooth()` using formula = 'y ~ x'
og <- ggplot(Orange, aes(x = age, y = circumference)) + geom_point(aes(color = Tree)) og + geom_smooth(method="lm", se=FALSE, color="coral")
\(circumference = \beta_0 + \beta_1\cdot age + \varepsilon\), where \(\varepsilon \sim\mathcal{N}(\mu=0; \,\,\sigma^2)\)
\(\displaystyle MSE = {SSE \over n-2} = {1\over n-2} \sum_{i=1}^n (y_i - \hat{y}_i)^2\)