% % % epage 432 % % 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; clc; addpath('../../Code/CSTool'); load anaerob; fd1=figure; rd=plot( x, y, '.k' ); hold on; xlabel( 'x' ); ylabel( 'y' ); fd2=figure; rd=plot( x, y, '.k' ); hold on; xlabel( 'x' ); ylabel( 'y' ); x_sample = linspace( min(x), max(x), 50 ); ph_deg_1 = []; tt_deg_1 = {}; ph_deg_2 = []; tt_deg_2 = {}; ln_colors = 'rbgcmk'; nc = length(ln_colors); % pick different values for the alpha parameter: a_array = [ 0.2, 0.5, 0.7, 0.9 ]; for ai=1:length(a_array), alpha = a_array(ai); deg=1; y_loess = csloess(x,y,x_sample,alpha,deg); figure(fd1); ph_deg_1(end+1) = plot(x_sample,y_loess,['-',ln_colors(mod(ai,nc)+1)]); tt_deg_1{end+1} = ['alpha = ',num2str(alpha)]; deg=2; y_loess = csloess(x,y,x_sample,alpha,deg); figure(fd2); ph_deg_2(end+1) = plot(x_sample,y_loess,['-',ln_colors(mod(ai,nc)+1)]); tt_deg_2{end+1} = ['alpha = ',num2str(alpha)]; end % add in this loess correction to the main model: figure(fd1); axis( [500,4500,10,150] ); title( 'the anaerob data with loess models of degree 1' ); legend( ph_deg_1, tt_deg_1, 'location', 'southeast' ); saveas( gcf, ['../../WriteUp/Graphics/Chapter10/prob_10_11_loess_deg_1'], 'epsc' ); figure(fd2); axis( [500,4500,10,150] ); title( 'the anaerob data with loess models of degree 2' ); legend( ph_deg_2, tt_deg_2, 'location', 'southeast' ); saveas( gcf, ['../../WriteUp/Graphics/Chapter10/prob_10_11_loess_deg_2'], 'epsc' ); clear functions;