lf_censor.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 lf_censor</title>
  6. <meta name="keywords" content="lf_censor">
  7. <meta name="description" content="">
  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>lf_censor
  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></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 fit = lf_censor(x,y,cens,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">
  27. Censored local regression using normal assumption.
  28. Must provide x, y and cens.
  29. All other arguments to locfit() can be provided, with the
  30. exception of weights.
  31. NEED: Kaplan Meier Estimate. Iterations are fixed.</pre></div>
  32. <!-- crossreference -->
  33. <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  34. This function calls:
  35. <ul style="list-style-image:url(../../../matlabicon.gif)">
  36. <li><a href="fitted.html" class="code" title="function y = fitted(fit)">fitted</a> Fitted values from a locfit object.</li><li><a href="locfit.html" class="code" title="function fit=locfit(varargin)">locfit</a> Smoothing noisy data using Local Regression and Likelihood.</li><li><a href="rsum.html" class="code" title="function z = rsum(fit)">rsum</a> </li></ul>
  37. This function is called by:
  38. <ul style="list-style-image:url(../../../matlabicon.gif)">
  39. <li><a href="../../../chronux_2_10/locfit/Book/fig7_3.html" class="code" title="">fig7_3</a> Local Regression and Likelihood, Figure 7.3.</li></ul>
  40. <!-- crossreference -->
  41. <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  42. <div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function fit = lf_censor(x,y,cens,varargin)</a>
  43. 0002 <span class="comment">%</span>
  44. 0003 <span class="comment">% Censored local regression using normal assumption.</span>
  45. 0004 <span class="comment">% Must provide x, y and cens.</span>
  46. 0005 <span class="comment">% All other arguments to locfit() can be provided, with the</span>
  47. 0006 <span class="comment">% exception of weights.</span>
  48. 0007 <span class="comment">%</span>
  49. 0008 <span class="comment">% NEED: Kaplan Meier Estimate. Iterations are fixed.</span>
  50. 0009 <span class="comment">%</span>
  51. 0010
  52. 0011 lfc_y = y;
  53. 0012 unc = find(~cens);
  54. 0013
  55. 0014 <span class="keyword">for</span> i = 0:3
  56. 0015 fit = <a href="locfit.html" class="code" title="function fit=locfit(varargin)">locfit</a>(x,lfc_y,varargin{:});
  57. 0016 fh = <a href="fitted.html" class="code" title="function y = fitted(fit)">fitted</a>(fit);
  58. 0017
  59. 0018 rs = <a href="rsum.html" class="code" title="function z = rsum(fit)">rsum</a>(fit);
  60. 0019 df0 = rs(1);
  61. 0020 df1 = rs(2);
  62. 0021
  63. 0022 rdf = sum(1-cens) - 2*df0 + df1;
  64. 0023 sigma = sqrt(sum( (y-fh).*(lfc_y-fh) / rdf));
  65. 0024 sr = (y-fh)/sigma;
  66. 0025 lfc_y = fh + sigma*normpdf(sr)./normcdf(-sr);
  67. 0026 lfc_y(unc) = y(unc);
  68. 0027 <span class="keyword">end</span>;
  69. 0028
  70. 0029 <span class="keyword">return</span>;</pre></div>
  71. <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>
  72. </body>
  73. </html>