107 lines
4.6 KiB
HTML
107 lines
4.6 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<title>Description of smirnov</title>
|
|
<meta name="keywords" content="smirnov">
|
|
<meta name="description" content="Smirnov test for 2 distributions">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<meta name="generator" content="m2html © 2003 Guillaume Flandin">
|
|
<meta name="robots" content="index, follow">
|
|
<link type="text/css" rel="stylesheet" href="../m2html.css">
|
|
</head>
|
|
<body>
|
|
<a name="_top"></a>
|
|
<div><a href="../index.html">Home</a> > <a href="index.html">.</a> > smirnov.m</div>
|
|
|
|
<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td>
|
|
<td align="right"><a href="index.html">Index for . <img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
|
|
|
|
<h1>smirnov
|
|
</h1>
|
|
|
|
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
|
<div class="box"><strong>Smirnov test for 2 distributions</strong></div>
|
|
|
|
<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
|
<div class="box"><strong>function [H,prob,d] = smirnov(x1 , x2 , alpha, iflag ) </strong></div>
|
|
|
|
<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
|
<div class="fragment"><pre class="comment"> Smirnov test for 2 distributions
|
|
[H,prob,d] = smirnov(x1 , x2 , alpha, iflag )
|
|
|
|
Copyright (C) 2005 Marco Ratto</pre></div>
|
|
|
|
<!-- crossreference -->
|
|
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
|
This function calls:
|
|
<ul style="list-style-image:url(../matlabicon.gif)">
|
|
</ul>
|
|
This function is called by:
|
|
<ul style="list-style-image:url(../matlabicon.gif)">
|
|
<li><a href="filt_mc_.html" class="code" title="function [rmse_MC, ixx] = filt_mc_(vvarvecm, loadSA, pfilt, alpha, alpha2, OutDir, istart, alphaPC)">filt_mc_</a> copyright Marco Ratto 2006</li><li><a href="stab_map_1.html" class="code" title="function [proba, dproba] = stab_map_1(lpmat, ibehaviour, inonbehaviour, aname, iplot, ipar, dirname)">stab_map_1</a> function [proba, dproba] = stab_map_1(lpmat, ibehaviour, inonbehaviour, aname, iplot, ipar, dirname)</li></ul>
|
|
<!-- crossreference -->
|
|
|
|
|
|
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
|
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [H,prob,d] = smirnov(x1 , x2 , alpha, iflag )</a>
|
|
0002 <span class="comment">% Smirnov test for 2 distributions</span>
|
|
0003 <span class="comment">% [H,prob,d] = smirnov(x1 , x2 , alpha, iflag )</span>
|
|
0004 <span class="comment">%</span>
|
|
0005 <span class="comment">% Copyright (C) 2005 Marco Ratto</span>
|
|
0006 <span class="comment">%</span>
|
|
0007
|
|
0008
|
|
0009
|
|
0010 <span class="keyword">if</span> nargin<3
|
|
0011 alpha = 0.05;
|
|
0012 <span class="keyword">end</span>
|
|
0013 <span class="keyword">if</span> nargin<4,
|
|
0014 iflag=0;
|
|
0015 <span class="keyword">end</span>
|
|
0016
|
|
0017 <span class="comment">% empirical cdfs.</span>
|
|
0018 xmix= [x1;x2];
|
|
0019 bin = [-inf ; sort(xmix) ; inf];
|
|
0020
|
|
0021 ncount1 = histc (x1 , bin);
|
|
0022 ncount2 = histc (x2 , bin);
|
|
0023
|
|
0024 cum1 = cumsum(ncount1)./sum(ncount1);
|
|
0025 cum1 = cum1(1:end-1);
|
|
0026
|
|
0027 cum2 = cumsum(ncount2)./sum(ncount2);
|
|
0028 cum2 = cum2(1:end-1);
|
|
0029
|
|
0030 n1= length(x1);
|
|
0031 n2= length(x2);
|
|
0032 n = n1*n2 /(n1+n2);
|
|
0033
|
|
0034 <span class="comment">% Compute the d(n1,n2) statistics.</span>
|
|
0035
|
|
0036 <span class="keyword">if</span> iflag==0,
|
|
0037 d = max(abs(cum1 - cum2));
|
|
0038 <span class="keyword">elseif</span> iflag==-1
|
|
0039 d = max(cum2 - cum1);
|
|
0040 <span class="keyword">elseif</span> iflag==1
|
|
0041 d = max(cum1 - cum2);
|
|
0042 <span class="keyword">end</span>
|
|
0043 <span class="comment">%</span>
|
|
0044 <span class="comment">% Compute P-value check H0 hypothesis</span>
|
|
0045 <span class="comment">%</span>
|
|
0046
|
|
0047 lam = max((sqrt(n) + 0.12 + 0.11/sqrt(n)) * d , 0);
|
|
0048 <span class="keyword">if</span> iflag == 0
|
|
0049 j = [1:101]';
|
|
0050 prob = 2 * sum((-1).^(j-1).*exp(-2*lam*lam*j.^2));
|
|
0051
|
|
0052 prob=max(prob,0);
|
|
0053 prob=min(1,prob);
|
|
0054 <span class="keyword">else</span>
|
|
0055 prob = exp(-2*lam*lam);
|
|
0056 <span class="keyword">end</span>
|
|
0057
|
|
0058 H = (alpha >= prob);</pre></div>
|
|
<hr><address>Generated on Fri 16-Jun-2006 09:09:06 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address>
|
|
</body>
|
|
</html> |