partial.m (405B)
1 function []=partial(y,X,tle,depv,indv,i,codes); 2 3 % partial.m Produces partial regression plots, skipping the first column of 4 % X (assumes its a constant). 5 % 6 % i.e. plot y versus M_Z * X -- regression coefficient from plot recovers 7 % original coefficient. 8 9 [T K]=size(X); 10 Z=X; 11 Z(:,i)=[]; 12 PZ=Z*inv(Z'*Z)*Z'; 13 MZ=eye(T)-PZ; 14 MZX = MZ*X(:,i); 15 plotreg(MZX,MZ*y,codes); 16 xlabel(indv); 17 ylabel(depv); 18 title(tle);