<div dir="ltr"><br>The problem is that the F distribution in distributions.c is missing<br>a multiplication by the ratio of the degrees of freedom, see the correct rk_noncentral_f<br><br><br>*dfden  / dfnum<br><br><br><a href="http://projects.scipy.org/scipy/numpy/browser/trunk/numpy/random/mtrand/distributions.c" target="_blank">http://projects.scipy.org/scipy/numpy/browser/trunk/numpy/random/mtrand/distributions.c</a><br>

<br>226     double rk_f(rk_state *state, double dfnum, double dfden)<br>227     {<br>228         return rk_chisquare(state, dfnum) / rk_chisquare(state, dfden);<br>229     }<br>230     <br>231     double rk_noncentral_f(rk_state *state, double dfnum, double dfden, double nonc)<br>

232     {<br>233         return ((rk_noncentral_chisquare(state, dfnum, nonc)*dfden) /<br>234                 (rk_chisquare(state, dfden)*dfnum));<br><br><br>change line 228 to<br>return (rk_chisquare(state, dfnum)*dfden)  / (rk_chisquare(state, dfden) *dfnum);<br>

<br><br>correct random variables require normalization:<br><br>>>> np.sum(1/2.0*40.0*np.random.f(2, 40, 1000000)>  2.44037)<br>99891<br><br>>>> np.sum(1/1.0*48.0*np.random.f(1, 48, 1000000)>  7.19)<br>

10118<br>>>> np.sum(1/1.0*48.0*np.random.f(1, 48, 1000000)>  7.19)<br>10174<br>>>> np.sum(1/1.0*48.0*np.random.f(1, 48, 1000000)>  7.19)<br>10043<br><br>Josef<br></div>