- Topic: Simple Linear Regression
- Definition: A statistical representation of the relationship between two variables.
- Parameters: Must include a dependent and an independent variable.
- Equation y = mx+b
2025-11-09
We model a response \(Y\) as a linear function of a single predictor \(X\): \[ Y_i = \beta_0 + \beta_1 X_i + \varepsilon_i,\quad i=1,\ldots,n \] with random errors \(\varepsilon_i\) that satisfy: \[ \mathbb{E}[\varepsilon_i]=0,\quad \mathrm{Var}(\varepsilon_i)=\sigma^2,\quad \text{and the } \varepsilon_i \text{ are independent.} \]
plot_ly(CO2,
x = ~conc,
y = ~uptake,
z = ~as.numeric(Type),
type = "scatter3d",
mode = "markers",
color = ~Treatment,
symbol = ~Type,
text = ~paste("Plant:", Plant, "<br>Type:",
Type, "<br>Treatment:", Treatment)
) %>%
layout(title = "3D CO2 Uptake vs Concentation and Type",
width = 600, height = 400, scene = list(
xaxis = list(title = "CO2 Concentration"),
yaxis = list(title = "Uptake"), zaxis = list(title = "Plant Type")
)
)
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point(color = "steelblue", size = 2) +
geom_smooth(method = "lm", se = TRUE, color = "darkred") +
labs(title = "Miles per Gallon vs Car Weight",
x = "Weight (1000 lbs)", y = "MPG") +
theme_minimal(base_size = 16)
ggplot(CO2, aes(x = conc, y = uptake)) + geom_point(alpha = 0.8) +
geom_smooth(method = "lm", se = TRUE) +
labs(title = "CO2 Uptake vs CO2 Concentration",
x = "CO2 Concentration", y = "Uptake") +
theme_minimal(base_size = 16)