Local Regression and Likelihood, Figure 6.5. Author: Catherine Loader Local smooth of CO2 dataset. Use bivariate fit to capture the two trends. bonus plot: fitted values vs year.
0001 % Local Regression and Likelihood, Figure 6.5. 0002 % Author: Catherine Loader 0003 % 0004 % Local smooth of CO2 dataset. 0005 % Use bivariate fit to capture the two trends. 0006 % 0007 % bonus plot: fitted values vs year. 0008 0009 load co2; 0010 fit = locfit([month year+month/12],co2,'alpha',0.2,'style','an','scale',[6/pi,10]); 0011 0012 figure('Name','fig6_5a: Local smoothing'); 0013 lfplot(fit,'contour'); 0014 xlabel('Month'); 0015 ylabel('Year'); 0016 0017 figure('Name','fig6_5b: Local smoothing'); 0018 plot(year+month/12,fitted(fit)); 0019 xlabel('Year'); 0020 ylabel('CO_2'); 0021