[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: betainc.oct, beta_cdf
From: |
Samir Sharshar |
Subject: |
Re: betainc.oct, beta_cdf |
Date: |
Wed, 18 May 2005 12:32:40 +0200 |
Hello,
Thanks for your quick answer... But it doesn't resolve my problem...
I've used an own function (calctau.m) to test the significativity of
the difference of a distribution of computed values against a beta
distribution.
Results whose are given by calctau.m on a debian machine using octave
2.1.57 and a winXP using octave 2.1.36 are identical. But they are
not the same on a mac os 10.4.1 using the binary octave 2.1.69 from
hpc.sourceforge.net.
Any idea ?
Here is the relevant code :
%-------------------------------------------------------------------
function x = qt(p,a)
%QT The student t inverse distribution function
%
% x = qt(p,DegreesOfFreedom)
% Anders Holtsberg, 18-11-93
% Copyright (c) Anders Holtsberg
s = p<0.5;
p = p + (1-2*p).*s;
p = 1-(2*(1-p));
x = qbeta(p,1/2,a/2);
x = x.*a./((1-x));
x = (1-2*s).*sqrt(x);
function x = qbeta(p,a,b)
%QBETA The beta inverse distribution function
%
% x = qbeta(p,a,b)
% Anders Holtsberg, 27-07-95
% Copyright (c) Anders Holtsberg
if any(any((a<=0)|(b<=0)))
error('Parameter a or b is nonpositive')
end
if any(any(abs(2*p-1)>1))
error('A probability should be 0<=p<=1, please!')
end
b = min(b,100000);
x = a ./ (a+b);
dx = 1;
while any(any(abs(dx)>256*eps*max(x,1)))
dx = (betainc(x,a,b) - p) ./ dbeta(x,a,b);
x = x - dx;
x = x + (dx - x) / 2 .* (x<0);
x = x + (1 + (dx - x)) / 2 .* (x>1);
end
function d = dbeta(x,a,b)
%DBETA The beta density function
%
% f = dbeta(x,a,b)
% Anders Holtsberg, 18-11-93
% Copyright (c) Anders Holtsberg
if any(any((a<=0)|(b<=0)))
error('Parameter a or b is nonpositive')
end
I = find((x<0)|(x>1));
d = x.^(a-1) .* (1-x).^(b-1) ./ beta(a,b);
d(I) = 0*I;
%----------------------------------------------------------
Le 18 mai 05 à 10:22, David Bateman a écrit :
Samir Sharshar wrote:
Hello there,
Is anyone can tell me if they were significant changes of the
betainc.oct file (and/or the beta_cdf function -- in case the oct
file calls it)
between versions 2.1.52 and 2.1.69 ?
Thanks
Samir Sharshar
The Fbetainc function was modified to allow NDArray's at the 2.1.58
release. The underlying betainc function were equally modified in
the same manner. THough nothing that will change their basic
behaviour.
You can check the difference's between the current versions and
those at 2.1.52 with the links
http://www.octave.org/cgi-bin/viewcvs.cgi/octave/src/DLD-FUNCTIONS/
betainc.cc?sortby=date&r2=1.2&r1=1.3.2.1
and
http://www.octave.org/cgi-bin/viewcvs.cgi/octave/liboctave/lo-
specfun.cc?sortby=date&r2=1.17&r1=1.19.2.1
Regards
David
--
David Bateman
address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01
(Fax) 91193 Gif-Sur-Yvette FRANCE
The information contained in this communication has been classified
as:
[x] General Business Information [ ] Motorola Internal Use Only [ ]
Motorola Confidential Proprietary
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------