% % problem is on epage 432, while the example is on epage 428. % % Written by: % -- % John L. Weatherwax 2008-02-20 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- clear all; close all; drawnow; clc; addpath( '../../Code/eda_toolbox' ); addpath( '../../Code/eda_data' ); load abrasion; x = tensile; y = abrasion; % Get a domain over which to get the loess curve. xo = linspace(min(x),max(x)); % Get both the regular loess. alpha = 0.6; yhat_1 = loess(x,y,xo,alpha,1); yhat_2 = loess(x,y,xo,alpha,2); % Plot fh=figure; pdh = plot(x,y,'xr'); hold on; plh_1 = plot(xo,yhat_1,'-k'); plh_2 = plot(xo,yhat_2,'-b'); legend([pdh,plh_1,plh_2], {'Original Data','Loess(lambda=1)','Loess(lambda=2)'}); xlabel('Tension'); ylabel('Abrasion') axis tight; saveas( gcf, ['../../WriteUp/Graphics/Chapter7/prob_7_4_ta'], 'epsc' ); x = hardness; y = abrasion; % Get a domain over which to get the loess curve. xo = linspace(min(x),max(x)); % Get both the regular loess. alpha = 0.6; yhat_1 = loess(x,y,xo,alpha,1); yhat_2 = loess(x,y,xo,alpha,2); % Plot fh=figure; pdh = plot(x,y,'xr'); hold on; plh_1 = plot(xo,yhat_1,'-k'); plh_2 = plot(xo,yhat_2,'-b'); legend([pdh,plh_1,plh_2], {'Original Data','Loess(lambda=1)','Loess(lambda=2)'}); xlabel('Hardness'); ylabel('Abrasion') axis tight; saveas( gcf, ['../../WriteUp/Graphics/Chapter7/prob_7_4_ha'], 'epsc' );