lfex2.html 5.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 lfex2</title>
  6. <meta name="keywords" content="lfex2">
  7. <meta name="description" content="Model the success probability of successive trials of a monkey">
  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 Neuro -->
  19. <h1>lfex2
  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>Model the success probability of successive trials of a monkey</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"> Model the success probability of successive trials of a monkey
  27. performing a task.
  28. The 'y' variable is a vector of 0/1, with 1 denoting success on
  29. the trial; 0 failure. The fitting procedure uses logistic
  30. regression within sliding windows (specified by the 'family','binomial'
  31. arguments).
  32. Choosing the bandwidth here is critical. The data shows `on/off' behavior,
  33. exhibiting periods of mainly successes, and mainly failures, respectively.
  34. Large values of alpha will smooth out this behavior, while small values
  35. will be too sensitive to random variability. Values of 0.15 to 0.2 seem
  36. reasonable for this example.
  37. AIC is based on asymptotic approximations, and seems unreliable here --
  38. formal model selection needs more investigation.
  39. Data is from Keith Purpura.</pre></div>
  40. <!-- crossreference -->
  41. <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  42. This function calls:
  43. <ul style="list-style-image:url(../../../matlabicon.gif)">
  44. <li><a href="../../../chronux_2_10/locfit/m/lfband.html" class="code" title="function lfband(fit,varargin)">lfband</a> adds confidence bands around the plot of a locfit() fit.</li><li><a href="../../../chronux_2_10/locfit/m/lfplot.html" class="code" title="function lfplot(varargin)">lfplot</a> Plot (for one or two dimensions) a locfit() fit.</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></ul>
  45. This function is called by:
  46. <ul style="list-style-image:url(../../../matlabicon.gif)">
  47. </ul>
  48. <!-- crossreference -->
  49. <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
  50. <div class="fragment"><pre>0001 <span class="comment">% Model the success probability of successive trials of a monkey</span>
  51. 0002 <span class="comment">% performing a task.</span>
  52. 0003 <span class="comment">%</span>
  53. 0004 <span class="comment">% The 'y' variable is a vector of 0/1, with 1 denoting success on</span>
  54. 0005 <span class="comment">% the trial; 0 failure. The fitting procedure uses logistic</span>
  55. 0006 <span class="comment">% regression within sliding windows (specified by the 'family','binomial'</span>
  56. 0007 <span class="comment">% arguments).</span>
  57. 0008 <span class="comment">%</span>
  58. 0009 <span class="comment">% Choosing the bandwidth here is critical. The data shows `on/off' behavior,</span>
  59. 0010 <span class="comment">% exhibiting periods of mainly successes, and mainly failures, respectively.</span>
  60. 0011 <span class="comment">% Large values of alpha will smooth out this behavior, while small values</span>
  61. 0012 <span class="comment">% will be too sensitive to random variability. Values of 0.15 to 0.2 seem</span>
  62. 0013 <span class="comment">% reasonable for this example.</span>
  63. 0014 <span class="comment">%</span>
  64. 0015 <span class="comment">% AIC is based on asymptotic approximations, and seems unreliable here --</span>
  65. 0016 <span class="comment">% formal model selection needs more investigation.</span>
  66. 0017 <span class="comment">%</span>
  67. 0018 <span class="comment">% Data is from Keith Purpura.</span>
  68. 0019
  69. 0020 load 050527_correct.mat;
  70. 0021 y = byTrial(1).correct';
  71. 0022 n = length(y);
  72. 0023 fit = <a href="../../../chronux_2_10/locfit/m/locfit.html" class="code" title="function fit=locfit(varargin)">locfit</a>((1:n)',y,<span class="string">'family'</span>,<span class="string">'binomial'</span>,<span class="string">'alpha'</span>,0.15);
  73. 0024 <a href="../../../chronux_2_10/locfit/m/lfplot.html" class="code" title="function lfplot(varargin)">lfplot</a>(fit);
  74. 0025 title(<span class="string">'Local Logistic Regression - Estimating Success Probability'</span>);
  75. 0026 <a href="../../../chronux_2_10/locfit/m/lfband.html" class="code" title="function lfband(fit,varargin)">lfband</a>(fit);</pre></div>
  76. <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>
  77. </body>
  78. </html>