Skip to content

Commit

Permalink
Update folded normal distribution reference data
Browse files Browse the repository at this point in the history
Add mean/var values computed using SciPy foldnorm.
  • Loading branch information
aherbert committed Aug 15, 2024
1 parent 664cc15 commit 5ac7332
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ protected double getRelativeTolerance() {
* Test the mean. This is performed using the folding together of two truncated
* normal distributions, with the truncation at the origin.
*
* <p>This test cross-validates the mean computation as the scipy reference
* implementation only supports a positive mu (and no sigma); and the R
* reference library VGAM does not provide mean computation.
* <p>This test cross-validates the mean computation.
*/
@ParameterizedTest
@MethodSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
# Standard half-normal distribution
parameters = 0.0 1.0

# Computed using sqrt(2/pi)
mean = 0.797884560802865406
# Computed using 1 - 2/pi
variance = 0.363380227632418618
# Computed using scipy.stats.foldnorm(0, 0, 1.0) v1.11
mean = 0.7978845608028654
variance = 0.3633802276324186
lower = 0

# Computed using R 4.4.1; library VGAM 1.1-11; foldnorm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
# Scaled folded normal distribution
parameters = 0.0 0.75

# Computed using 0.75 * sqrt(2/pi)
# Computed using scipy.stats.foldnorm(0, 0, 0.75) v1.11
mean = 0.5984134206021491
# Computed using 0.75^2 * (1 - 2/pi)
variance = 0.20440137804323547
variance = 0.2044013780432355
lower = 0

# Computed using R 4.4.1; library VGAM 1.1-11; foldnorm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Shifted folded normal distribution
parameters = 1.5 1.0

# Computed using scipy.stats.foldnorm 1.11
# Computed using scipy.stats.foldnorm(1.5) v1.11
mean = 1.5586135875252092
variance = 0.8207236847817971
lower = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
# Shifted and scaled folded normal distribution
parameters = 1.5 0.75

# Computed in R 4.4.1: u=1.5; s=0.75;
# m=s*sqrt(2/pi)*exp(-u*u/(2*s*s))+u*(1-2*pnorm(-u/s))
# v=u*u+s*s-m*m
mean = 1.51273605392524457
variance = 0.524129631154679476
# Computed using scipy.stats.foldnorm(1.5/0.75, 0, 0.75) v1.11
mean = 1.5127360539252446
variance = 0.5241296311546797
lower = 0

# Computed using R 4.4.1; library VGAM 1.1-11; foldnorm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
# Shifted and scaled folded normal distribution
parameters = -1.5 1.25

# Computed in R 4.4.1: u=1.5; s=0.75;
# m=s*sqrt(2/pi)*exp(-u*u/(2*s*s))+u*(1-2*pnorm(-u/s))
# v=u*u+s*s-m*m
mean = 1.64025612679290766
variance = 1.12205983851832869
# Computed using scipy.stats.foldnorm(1.5/1.25, 0, 1.25) v1.11
mean = 1.6402561267929074
variance = 1.1220598385183294
lower = 0

# Computed using R 4.4.1; library VGAM 1.1-11; foldnorm
Expand Down

0 comments on commit 5ac7332

Please sign in to comment.