Applied Statistical Methods - Solution 3
Problem 1: Simple Linear Regression
Use the data on Width
and Height
that we collected during the class to fit a linear regression model to the data. Use the formula derived in class to compute estimates \(\widehat{b}_0\) and \(\widehat{b}_1\) for the intercept (\(b_0\)) and the slope (\(b_1\)) that define the linear regression line. Verify the obtained results using the function lm()
in R.
Tasks
- Read data from
https://charlotte-ngs.github.io/asmasss2024/data/asm_width_height.csv
using the functionread.table()
- Compute estimate \(\widehat{b}_1\) for the slope \(b_1\) using the formula from class given as
\[\widehat{b}_1 = \frac{(xy). - N\bar{x}.\bar{y}.}{(x^2). - N\bar{x}.^2}\]
- Compute estimate \(\widehat{b}_0\) for the slope \(b_0\) using the formula from class given as
\[\hat{b}_0 = \bar{y}. - \hat{b}_1\bar{x}. \]
- Validation with R