lfband.html 5.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 lfband</title>
  6. <meta name="keywords" content="lfband">
  7. <meta name="description" content="adds confidence bands around the plot of a locfit() fit.">
  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 m -->
  19. <h1>lfband
  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>adds confidence bands around the plot of a locfit() fit.</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>function lfband(fit,varargin) </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"> adds confidence bands around the plot of a locfit() fit.
  27. for 2-d fits, produces separate surface plots of upper and
  28. lower confidence limits.
  29. Bands are based on 95% pointwise coverage, using a single
  30. (i.e. global) estimate of sigma^2.</pre></div>
  31. <!-- crossreference -->
  32. <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  33. This function calls:
  34. <ul style="list-style-image:url(../../../matlabicon.gif)">
  35. <li><a href="invlink.html" class="code" title="function y0 = invlink(y,fali)">invlink</a> inverse link function for locfit.</li><li><a href="lfmarg.html" class="code" title="function xfit = lfmarg(fit)">lfmarg</a> computes grid margins from a locfit object, used for plotting.</li><li><a href="predict.html" class="code" title="function [y, se] = predict(varargin)">predict</a> Interpolate a fit produced by locfit().</li></ul>
  36. This function is called by:
  37. <ul style="list-style-image:url(../../../matlabicon.gif)">
  38. <li><a href="../../../chronux_2_10/locfit/Book/fig4_1.html" class="code" title="">fig4_1</a> Local Regression and Likelihood, Figure 4.1.</li><li><a href="../../../chronux_2_10/locfit/Book/fig4_2.html" class="code" title="">fig4_2</a> Local Regression and Likelihood, Figure 4.2.</li><li><a href="../../../chronux_2_10/locfit/Neuro/lfex1.html" class="code" title="">lfex1</a> Local Estimation a spike firing rate (in spikes per unit time).</li><li><a href="../../../chronux_2_10/locfit/Neuro/lfex2.html" class="code" title="">lfex2</a> Model the success probability of successive trials of a monkey</li><li><a href="../../../chronux_2_10/spectral_analysis/helper/den_jack.html" class="code" title="function [m,ll,ul,llj,ulj]=den_jack(X,family,varargin)">den_jack</a> Function to compute smooth estimates of the mean of x using locfit,</li></ul>
  39. <!-- crossreference -->
  40. <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  41. <div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function lfband(fit,varargin)</a>
  42. 0002
  43. 0003 <span class="comment">% adds confidence bands around the plot of a locfit() fit.</span>
  44. 0004 <span class="comment">%</span>
  45. 0005 <span class="comment">% for 2-d fits, produces separate surface plots of upper and</span>
  46. 0006 <span class="comment">% lower confidence limits.</span>
  47. 0007 <span class="comment">%</span>
  48. 0008 <span class="comment">% Bands are based on 95% pointwise coverage, using a single</span>
  49. 0009 <span class="comment">% (i.e. global) estimate of sigma^2.</span>
  50. 0010
  51. 0011 xfit = <a href="lfmarg.html" class="code" title="function xfit = lfmarg(fit)">lfmarg</a>(fit);
  52. 0012 <span class="comment">% placing 'band','g' before varargin{:} ensures that</span>
  53. 0013 <span class="comment">% user-provided 'band' has precedence.</span>
  54. 0014 ypp = <a href="predict.html" class="code" title="function [y, se] = predict(varargin)">predict</a>(fit,xfit,<span class="string">'band'</span>,<span class="string">'g'</span>,varargin{:});
  55. 0015 yfit = ypp{1};
  56. 0016 se = ypp{2};
  57. 0017 bands = ypp{3};
  58. 0018
  59. 0019 data = fit.data;
  60. 0020 xdata = data.x;
  61. 0021 p = size(xdata,2);
  62. 0022 cv = 1.96;
  63. 0023 fali = fit.fit_points.family_link;
  64. 0024 cl = <a href="invlink.html" class="code" title="function y0 = invlink(y,fali)">invlink</a>(bands(:,1),fali);
  65. 0025 cu = <a href="invlink.html" class="code" title="function y0 = invlink(y,fali)">invlink</a>(bands(:,2),fali);
  66. 0026
  67. 0027 <span class="keyword">if</span> (p==1)
  68. 0028 hold on;
  69. 0029 plot(xfit{1},cu,<span class="string">':'</span>);
  70. 0030 plot(xfit{1},cl,<span class="string">':'</span>);
  71. 0031 hold off;
  72. 0032 <span class="keyword">end</span>;
  73. 0033
  74. 0034 <span class="keyword">if</span> (p==2)
  75. 0035 x1 = xfit{1};
  76. 0036 x2 = xfit{2};
  77. 0037 figure(1);
  78. 0038 surf(x1,x2,reshape(cl,length(x1),length(x2))');
  79. 0039 figure(2);
  80. 0040 surf(x1,x2,reshape(cu,length(x1),length(x2))');
  81. 0041 <span class="keyword">end</span>;
  82. 0042
  83. 0043 <span class="keyword">return</span>;</pre></div>
  84. <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>
  85. </body>
  86. </html>