Welch's t-test: Difference between revisions

Content added Content deleted
m (→‎Using Math::AnyNum: future-proof for 5.36, explicit :prototype)
m (→‎{{header|Wren}}: Minor tidy)
Line 2,691: Line 2,691:
{{libheader|Wren-math}}
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascript">import "/math" for Math, Nums
<syntaxhighlight lang="wren">import "./math" for Math, Nums
import "/fmt" for Fmt
import "./fmt" for Fmt


var welch = Fn.new { |a, b|
var welch = Fn.new { |a, b|
Line 2,729: Line 2,729:
var g3 = Math.gamma(nu/2 + 0.5).log
var g3 = Math.gamma(nu/2 + 0.5).log
var f = Fn.new { |r| r.pow(nu/2-1) / (1 - r).sqrt }
var f = Fn.new { |r| r.pow(nu/2-1) / (1 - r).sqrt }
return simpson0.call(2000, nu/(t*t + nu), f) / Math.exp(g1 + g2 - g3)
return simpson0.call(2000, nu/(t*t + nu), f) / (g1 + g2 - g3).exp
}
}