fig2_6.m 606 B

1234567891011121314151617181920212223
  1. % Local Regression and Likelihood, Figure 2.6.
  2. %
  3. % Influence and variance functions.
  4. load ethanol;
  5. d = [2 3];
  6. a = [0.49 0.59];
  7. main = {'Local Quadratic','Local Cubic'};
  8. f=['a','b'];
  9. for (i=1:2)
  10. figure('Name', sprintf( 'figure2_6%c: Influence and variance functions', f(i) ) );
  11. fit = locfit(E,NOx,'nn',a(i),'deg',d(i),'ev','grid','mg',100);
  12. vecr(fit)
  13. plot(E,zeros(88,1),'o');
  14. title(main{i});
  15. hold on;
  16. lfplot(fit,'what','infl');
  17. lfplot(fit,'what','vari','--');
  18. xlabel('Equivalence Ratio');
  19. ylabel('Influence');
  20. legend('Data','Influence Function','Variance Function');
  21. hold off;
  22. end;