STA5106_FRADE_HW3

STA5106_FRADE_HW3 - STA5106: Dr. Srivastava Homework 3...

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

View Full Document Right Arrow Icon
STA5106: Dr. Srivastava Homework 3 Jaime Frade 1. multilinreg.m OUTPUT >> x = [3 3 3 1; 2 1 2 1; 1 3 3 1; 3 2 2 3; 1 3 2 1] x = 3 3 3 1 2 1 2 1 1 3 3 1 3 2 2 3 1 3 2 1 >> y = [52;28;44;48;40] y = 22 14 20 25 17 >> bhat = multilinreg(x,y) m1 = 0.999999999999974 1.999999999999997 3.000000000000015 4.000000000000004 bhat = 0.999999999999997 1.999999999999995 3.000000000000004 4.000000000000003
Background image of page 1

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

View Full DocumentRight Arrow Icon
Dr. Srivastava Homework 3 Jaime Frade CODE %generates upper trangular matrix, then calls backsub function to get least %squares estimated values, the betas. Also takes reflection matrix from %zero vector returned from house program. function m = multilinreg(x,y) [m,n] = size(x); V=zeros(m,1); for i=1:n, V(i:m,1) = house(x(i:m,i)); x(i:m,i:n) = rowhouse(x(i:m,i:n),V(i:m,1)); beta = -2*V(i:m,1)'*y(i:m,1)/(V(i:m,1)'*V(i:m,1)); y(i:m,1) = y(i:m,1)+ beta*V(i:m,1); end m=backsub(x,y); %can test by using built-in function m1 = inv((x'*x))*x'*y 3. OUTPUT
Background image of page 2
Image of page 3
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 / 5

STA5106_FRADE_HW3 - STA5106: Dr. Srivastava Homework 3...

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

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