Regression Model: $Y = β_0 + β_1X + ε$
Regression Function: $E(Y ) = β_0 + β_1X$
Use least squares estimation to estimate $β_0$ and $β_1$.
Estimated Regression Function:
$$ ⁍ $$
where
$$ b_1=\frac{\sum_{i=1}^n(X_i-\bar{X})(Y_i-\bar{Y})}{\sum_{i=1}^n(X_i-\bar{X})^2}{}=\frac{S_{xy}}{S_{xx}}, calculate\:in\:RStudio $$
$$ b_0=\bar{Y}-b_1\bar{X}, $$
we call $\hat{Y}$ the value of the estimated regression function at the level X of the predictor variable.
library("ALSM")
mydata <- TolucaCompany #from library ALSM
dim(mydata)#notates number of obs. and variables
help(dim)
X <- mydata$x #Sets $x from mydata as a separate values set.
Y <- mydata$y #$y into Y value.