fig6_4.html 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/REC-html40/loose.dtd">
  3. <html>
  4. <head>
  5. <title>Description of fig6_4</title>
  6. <meta name="keywords" content="fig6_4">
  7. <meta name="description" content="Local Regression and Likelihood, Figure 6.4.">
  8. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  9. <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  10. <meta name="robots" content="index, follow">
  11. <link type="text/css" rel="stylesheet" href="../../../m2html.css">
  12. <script type="text/javascript">
  13. if (top.frames.length == 0) { top.location = "../../../index.html"; };
  14. </script>
  15. </head>
  16. <body>
  17. <a name="_top"></a>
  18. <!-- ../../menu.html chronux_2_10 --><!-- # locfit --><!-- menu.html Book -->
  19. <h1>fig6_4
  20. </h1>
  21. <h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  22. <div class="box"><strong>Local Regression and Likelihood, Figure 6.4.</strong></div>
  23. <h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  24. <div class="box"><strong>This is a script file. </strong></div>
  25. <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  26. <div class="fragment"><pre class="comment"> Local Regression and Likelihood, Figure 6.4.
  27. Author: Catherine Loader
  28. Local smooth of CO2 dataset. Estimate the main trend,
  29. then use periodic smoothing of the residuals to estimate
  30. the annual effect. Add main trend and periodic components
  31. to get overall smooth.
  32. A periodic smooth is specified by 'style','a'.
  33. Note that year+month/12 scales the predictor to have a period
  34. of 1. The 'scale' argument to locfit() is period/(2*pi).</pre></div>
  35. <!-- crossreference -->
  36. <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  37. This function calls:
  38. <ul style="list-style-image:url(../../../matlabicon.gif)">
  39. <li><a href="../../../chronux_2_10/locfit/m/fitted.html" class="code" title="function y = fitted(fit)">fitted</a> Fitted values from a locfit object.</li><li><a href="../../../chronux_2_10/locfit/m/locfit.html" class="code" title="function fit=locfit(varargin)">locfit</a> Smoothing noisy data using Local Regression and Likelihood.</li><li><a href="../../../chronux_2_10/locfit/m/residuals.html" class="code" title="function y = residuals(fit,type)">residuals</a> Residuals (or a few other things) from a locfit() fit.</li></ul>
  40. This function is called by:
  41. <ul style="list-style-image:url(../../../matlabicon.gif)">
  42. <li><a href="runbook.html" class="code" title="">runbook</a> </li></ul>
  43. <!-- crossreference -->
  44. <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  45. <div class="fragment"><pre>0001 <span class="comment">% Local Regression and Likelihood, Figure 6.4.</span>
  46. 0002 <span class="comment">% Author: Catherine Loader</span>
  47. 0003 <span class="comment">%</span>
  48. 0004 <span class="comment">% Local smooth of CO2 dataset. Estimate the main trend,</span>
  49. 0005 <span class="comment">% then use periodic smoothing of the residuals to estimate</span>
  50. 0006 <span class="comment">% the annual effect. Add main trend and periodic components</span>
  51. 0007 <span class="comment">% to get overall smooth.</span>
  52. 0008 <span class="comment">%</span>
  53. 0009 <span class="comment">% A periodic smooth is specified by 'style','a'.</span>
  54. 0010 <span class="comment">% Note that year+month/12 scales the predictor to have a period</span>
  55. 0011 <span class="comment">% of 1. The 'scale' argument to locfit() is period/(2*pi).</span>
  56. 0012
  57. 0013 load co2;
  58. 0014 fit1 = <a href="../../../chronux_2_10/locfit/m/locfit.html" class="code" title="function fit=locfit(varargin)">locfit</a>(year+month/12,co2,<span class="string">'alpha'</span>,0.5,<span class="string">'deg'</span>,1);
  59. 0015 res = <a href="../../../chronux_2_10/locfit/m/residuals.html" class="code" title="function y = residuals(fit,type)">residuals</a>(fit1);
  60. 0016 fit2 = <a href="../../../chronux_2_10/locfit/m/locfit.html" class="code" title="function fit=locfit(varargin)">locfit</a>(year+month/12,res,<span class="string">'alpha'</span>,[0 2],<span class="string">'style'</span>,<span class="string">'a'</span>,<span class="string">'scale'</span>,1/(2*pi));
  61. 0017 f1 = <a href="../../../chronux_2_10/locfit/m/fitted.html" class="code" title="function y = fitted(fit)">fitted</a>(fit1);
  62. 0018 f2 = <a href="../../../chronux_2_10/locfit/m/fitted.html" class="code" title="function y = fitted(fit)">fitted</a>(fit2);
  63. 0019 figure(<span class="string">'Name'</span>,<span class="string">'fig6_4: CO2 dataset local smoothing'</span> );
  64. 0020 plot(year+month/12,f1+f2);</pre></div>
  65. <hr><address>Generated on Fri 12-Aug-2011 11:36:15 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
  66. </body>
  67. </html>