自由度 df1, df2 のF分布において,x 以上の値をとる確率を与える関数です。
# F分布の上側確率 <a name="fxp">fxp.awk</a> function fxp(f, df1, df2, i1, i2, c, p, s, w, y, m2pi) { m2pi = 0.636619772367581343076 m_pi = 3.14159265358979323846 i1 = 2-(df1%2) i2 = 2-(df2%2) w = df2/(df2+df1*f) y = 1.0-w p = sqrt(w) s = sqrt(y) if (2*i1-i2 == 0) { p = 1.0-s c = s*w/2.0 } else if (2*i1-i2 == 1) { c = s*p/m_pi p = 1.0-atan2(s, p)*m2pi } else if (2*i1-i2 == 2) { p = w c = w*y } else { c = y*p/2.0 } for (; df2 > i2; i2 += 2) { p -= 2.0/i2*c c *= w*(i1+i2)/i2 } for (; df1 > i1; i1 += 2) { p += 2.0/i1*c c *= y*(i1+i2)/i1 } return (p < 0.0 && abs(p) < 1e-10) ? 0.0 : p }