[Return to Sta113 Home]

Sta113: Lab 8 (Friday, April 4, 2003)

In this lab, we will use MatLab to illustrate simple linear regression.


Items that we will investigate using MatLab include:

Use the data from problem 11.51 in the book to investigate the linear relationship between the AUTOMARK scoring and INSTRUCTOR scoring for grading the same computer programming assignments. We are interested in whether there is a linear relationship between them. And if so, how well does the best fitting straight line predict the INSTRUCTOR score, given the AUTOMARK score (see problem 11.51, p. 580 for more details).

Read in the data and call the first column AUTOMARK, and the second column INSTRUCTOR, or some variation thereof.

score = load('lab8.dat');
AUTOMARK = [ones(length(score),1) score(:,1)]; % X needs to be a
                                               % matrix with a leading 
                                               % column of ones.
INSTRUCTOR = score(:,2);

Let's investigate the the items above:

Now you know how to use MatLab to do the basic linear regression analysis. In the coming weeks you'll learn how to build on this to consider more than one predictor variable at a time.