STA5106_FRADE_HW4-2

STA5106_FRADE_HW4-2 - STA5106 Dr Srivastava Homework 4 Jaime Frade 1 OUTPUT%to display variables > load hw3c_dat.mat > whos Name Size Bytes Class X

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
STA5106: Dr. Srivastava Homework 4 Jaime Frade 1. OUTPUT %to display variables >> load hw3c_dat.mat >> whos Name Size Bytes Class Attributes X 200x100 160000 double y 200x1 1600 double (a) (i) Find the sample covariance matrix C OUTPUT >>covariance = Cov(X) (ii) Compute the singular value decomposition (SVD) of C to obtain the orthogonal matrix U ([U,S,V] = svd(X) produces a diagonal matrix S of the same dimension as X, with nonnegative diagonal elements in decreasing order, and unitary matrices U and V so that X = U*S*V'). OUTPUT >> [U,S,V] = svd(covariance) (iii) Set U1 to be the ±rst d columns of U OUTPUT >>U1 =U(:,1:10) iv) de±ne X= XU1. OUTPUT >> X1 = X*U1 (b) Now solve for the coe cients OUTPUT >> b = multilinreg(X1,y) b = -1.074246475689229 -1.768803339766948 0.103995851378360 0.363285989089155 -0.386387913937695 0.496460463446647 -0.862278562017916 -1.395317673919767 0.018537789075906 -1.006355988254308
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
STA5106: Dr. Srivastava Homework 4 Jaime Frade (c) Compute the sum of squares of error OUTPUT >> sse = (norm(y-X1*b))^2 sse = 1.130853648333638e+003 Compute and plot the SSE for values of d ranging from 10 to 100 in the steps of 10. OUTPUT >> a1 = [10 20 30 40 50 60 70 80 90 100] a1 = 10 20 30 40 50 60 70 80 90 100 >> b1 = zeros(1,10) b1 = 0 0 0 0 0 0 0 0 0 0 >> sseplot(X,y, 10,a1,b1) b1 = 1.0e+003 * Columns 1 through 6 1.130853648333638 0.764345279714724 0.440732053997771 0.368127671571441 0.301161070585707 0.231333529662689 Columns 7 through 10 0.134913323346826 0.066181556125977 0.020619729204690 0.000000000000000
Background image of page 2
STA5106: Dr. Srivastava Homework 4 Jaime Frade CODE function
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/14/2011 for the course STAT 5106 taught by Professor Staff during the Fall '08 term at FSU.

Page1 / 11

STA5106_FRADE_HW4-2 - STA5106 Dr Srivastava Homework 4 Jaime Frade 1 OUTPUT%to display variables > load hw3c_dat.mat > whos Name Size Bytes Class X

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online