fig6_4

PURPOSE ^

Local Regression and Likelihood, Figure 6.4.

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Local Regression and Likelihood, Figure 6.4.
 Author: Catherine Loader

 Local smooth of CO2 dataset. Estimate the main trend,
 then use periodic smoothing of the residuals to estimate
 the annual effect. Add main trend and periodic components
 to get overall smooth.

 A periodic smooth is specified by 'style','a'.
 Note that year+month/12 scales the predictor to have a period
 of 1. The 'scale' argument to locfit() is period/(2*pi).

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Local Regression and Likelihood, Figure 6.4.
0002 % Author: Catherine Loader
0003 %
0004 % Local smooth of CO2 dataset. Estimate the main trend,
0005 % then use periodic smoothing of the residuals to estimate
0006 % the annual effect. Add main trend and periodic components
0007 % to get overall smooth.
0008 %
0009 % A periodic smooth is specified by 'style','a'.
0010 % Note that year+month/12 scales the predictor to have a period
0011 % of 1. The 'scale' argument to locfit() is period/(2*pi).
0012 
0013 load co2;
0014 fit1 = locfit(year+month/12,co2,'alpha',0.5,'deg',1);
0015 res = residuals(fit1);
0016 fit2 = locfit(year+month/12,res,'alpha',[0 2],'style','a','scale',1/(2*pi));
0017 f1 = fitted(fit1);
0018 f2 = fitted(fit2);
0019 figure('Name','fig6_4: CO2 dataset local smoothing' );
0020 plot(year+month/12,f1+f2);

Generated on Fri 12-Aug-2011 11:36:15 by m2html © 2005