Correlation and Least-Squares Regression

The command cor computes correlations. The correlation of our height and weight variables is computed by
The command lm (whort for Linear Model) fits a least squares regression. Use the following command to fit a regression with weight as the response variable and height as the explanatory variable:
The slope of this line is b = r*sy/sx; you can check this with the command
The intercept is a = $ \overline{{y}}$ - a$ \overline{{x}}$:
Using the least squares line, the weights we would predict for the observed heights are computed by
The residuals can then be computes as Computing the residuals:
Try some examples of your own in the work area below.

Work Area
Enter your own commands here; then click the Submit button.
Luke Tierney 2001-12-03