Skip to content

Commit 6bd5170

Browse files
committed
improve docs
1 parent db56d5d commit 6bd5170

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/owent.jl

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# Owen's T Function
22
# Written by Andy Gough; August 2021 (see https://github.com/JuliaStats/StatsFuns.jl/issues/99#issuecomment-1124581689)
3-
# Edited by Johanni Brea to make type stable; January 2025
3+
# Edited by Johanni Brea; January 2025
44
# Rev 1.09
55
# MIT License
66
#
77
# dependencies
88
# IrrationalConstants
99
# SpecialFunctions
10-
# LinearAlgebra
1110
#
1211
# HISTORY
1312
# In the past 20 or so years, most implementations of Owen's T function have followed the algorithms given in "Fast and accurate Calculation of Owen's
@@ -33,32 +32,31 @@
3332
# T1 through T4 are not implemented. Instead, if a < 0.999999, T5 is used to calculate Owen's T (using 48 point Gauss-Legendre quadrature)
3433
# For 0.999999 < a < 1.0, T6 is implemented.
3534
#
36-
# REFERENCES
37-
# [1] "Fast and accurate Calculation of Owen's T-Function", by M. Patefield and D. Tandy, Journal of Statistical Software, 5 (5), 1 - 25 (2000)
38-
# [2] "Tables for Computing Bivariate Normal Probabilities", by Donald P. Owen, The Annals of Mathematical Statistics, Vol. 27, No. 4 (Dec 1956), pp. 1075-1090
39-
#
4035
# Partial Derivatives (FYI)
4136
# D[owent[x,a],x] = -exp(-0.5*x^2)*erf(a*x/sqrt2)/(2*sqrt2π)
4237
# D[owent[x,a],a] = exp(-0.5*(1+a^2)*(x^2))/((1+a^2)*2π)
4338
#
4439
@doc raw"""
45-
owent(h,a) : Returns the value of Owen's T function for (h,a)
40+
owent(h, a)
4641
47-
Owen's T function:
42+
Returns the value of Owen's T function
4843
```math
4944
T(h,a) = \frac{1}{2\pi } \int_{0}^{a} \frac{e^{-\frac{1}{2}h^2(1+x^2)}}{1+x^2}dx\quad(-\infty < h,a < +\infty)
5045
```
5146
52-
For *h* and *a* > 0, *T(h,a)* gives the volume of the uncorrelated bivariate normal distribution with zero mean and unit variance
53-
over the area from *y = ax* and *y = 0* and to the right of *x = h*.
47+
For *h* and *a* > 0, *T(h,a)* gives the volume of the uncorrelated bivariate normal distribution with zero mean and unit variance over the area from *y = ax* and *y = 0* and to the right of *x = h*.
5448
55-
EXAMPLE:
49+
## Example
5650
```
5751
julia> owent(0.0625, 0.025)
5852
0.003970281304296922
5953
```
6054
61-
Worst case accuracy is about 2e-16.
55+
## References
56+
"Fast and accurate Calculation of Owen's T-Function", by M. Patefield and D. Tandy, Journal of Statistical Software, 5 (5), 1 - 25 (2000)
57+
58+
"Tables for Computing Bivariate Normal Probabilities", by Donald P. Owen, The Annals of Mathematical Statistics, Vol. 27, No. 4 (Dec 1956), pp. 1075-1090
59+
#
6260
"""
6361
function owent(h::T, a::T) where {T <: Real}
6462

0 commit comments

Comments
 (0)