fig2_5.m 478 B

1234567891011121314151617181920
  1. % Local Regression and Likelihood, Figure 2.5.
  2. %
  3. % Using different smoothing parameters.
  4. load ethanol;
  5. alp = [0.2 0.4 0.6 0.8];
  6. f=['a','b','c','d'];
  7. for (i=1:4)
  8. figure('Name', sprintf( 'figure2_5%c: Smoothing parameters', f(i) ) );
  9. fit = locfit(E,NOx,'alpha',alp(i));
  10. res = residuals(fit);
  11. fit2 = locfit(E,res,'alpha',0.2);
  12. lfplot(fit2);
  13. title(strcat('a = ',num2str(alp(i))));
  14. ylabel('Residual');
  15. hold on;
  16. plot([min(E) max(E)], [0 0], ':');
  17. hold off;
  18. end;