Welch's t-test: Difference between revisions
Content added Content deleted
(→Using Burkardt's betain: merged betain function inside calculate_pvalue, eliminated redundant variables to clean code, should run a little faster) |
(GP) |
||
Line 874: | Line 874: | ||
-9.559498 2.000852 0.010752</lang> |
-9.559498 2.000852 0.010752</lang> |
||
=={{header|PARI/GP}}== |
|||
<lang parigp>B2(x,y)=exp(lngamma(x)+lngamma(y)-lngamma(x+y)) |
|||
B3(x,a,b)=a--;b--;intnum(r=0,x,r^a*(1-r)^b) |
|||
Welch2(u,v)=my(m1=vecsum(u)/#u, m2=vecsum(v)/#v, v1=var(u,m1), v2=var(v,m2), s=v1/#u+v2/#v, t=(m1-m2)/sqrt(s), nu=s^2/(v1^2/#u^2/(#u-1)+v2^2/#v^2/(#v-1))); B3(nu/(t^2+nu),nu/2,1/2)/B2(nu/2,1/2); |
|||
Welch2([3,4,1,2.1], [490.2,340,433.9])</lang> |
|||
{{out}} |
|||
<pre>%1 = 0.010751561149784496723954539777213062928</pre> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |