next up previous index
Next: Homework - Lab. 3 Up: Projects Previous: Homework Lab. 1   Index

Homework $-$ Lab. 2

These exercices should be done by Monday February 10th, email the functions you write to fulfill the analyses for exercices numbers 1,2, and 3. to me at sph11@cornell.edu. (As a text file, with your last name dot 2 as a subject ( mine would be : holmes.2), please NO binary, word, etc....)

1. The centering matrix

a
Write a function that generates the centering matrix of size $n$, that is the matrix that takes a matrix of data $X_{n \times p}$ and takes out of each element the mean of that column.

Through empirical trials (about 10 should be enough), find out what order of flops this method takes to center a matrix.

b
Write a function that centers a matrix with matlab's inbuilt mean function.

Show how many flops this takes as a function of $n$.

c
Optional: Can you find a more efficient way of centering a matrix.
2. Regression Program

Write a matlab function that takes a data matrix $X$ and a response vector $y$, computes the linear regression of $y$ on the columns of $X$ and outputs the residuals and the predicted values $\hat{y}$.

Optional: Put in graphics and eventually step by step procedures to find the `best regressor set' of a certain size.

3. Cross Validation for Simple regression
Write a matlab function that computes the cross-validated $Press$ (predicted error of sums of squares) using Matlab.

4. Analysis of variance
Write a one-way anova program with matlab:
a.
Reread what the one-way anova model is, and remind yourself what the explanatory variables are in this case (there are more than one of them).
b.
Find which equations you have to minimize.
c.
Show a classical analysis of variance table.

5. Web-reading exercice

Take yourself to visit:
http://www.cns.ed.ac.uk/people/mark/intro/intro.html

Find the chapter on least squares, you could try downloading the matlab functions too.

Find the differences between his notations/vocabulary and mine. (send me at least five, with the translations).


next up previous index
Next: Homework - Lab. 3 Up: Projects Previous: Homework Lab. 1   Index
Susan Holmes 2002-01-12