fig6_5.m 519 B

123456789101112131415161718192021
  1. % Local Regression and Likelihood, Figure 6.5.
  2. % Author: Catherine Loader
  3. %
  4. % Local smooth of CO2 dataset.
  5. % Use bivariate fit to capture the two trends.
  6. %
  7. % bonus plot: fitted values vs year.
  8. load co2;
  9. fit = locfit([month year+month/12],co2,'alpha',0.2,'style','an','scale',[6/pi,10]);
  10. figure('Name','fig6_5a: Local smoothing');
  11. lfplot(fit,'contour');
  12. xlabel('Month');
  13. ylabel('Year');
  14. figure('Name','fig6_5b: Local smoothing');
  15. plot(year+month/12,fitted(fit));
  16. xlabel('Year');
  17. ylabel('CO_2');