[ 
https://issues.apache.org/jira/browse/RNG-137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17374117#comment-17374117
 ] 

Alex Herbert commented on RNG-137:
----------------------------------

Here are the same plots with the StableRandomGenerator. It has to be updated to 
convert the 1-parameterisation to the 0-parameterisation. However they do not 
look exactly the same:

!alpha1.3b.jpg!

!alpha0.5b.jpg!

!beta0.3b.jpg!

The alpha=1.3 plot is definitely broken for beta=1. The function does not 
appear to be continuous through beta 0 to beta 1.

The alpha=0.5 plot appears mostly the same except when beta=0.

The beta=0.3 plot is broken for alpha=2 as the variance of the Gaussian 
distribution is 1 in the CM implementation and not 2. It appears wrong as alpha 
-> 0.

The StableRandomGenerator will not pass the tests for the expected distribution 
deciles that the new generator passes. These deciles are the same (within 1e-10 
relative error) when computed with Matlab or the STABLE program provided by 
Nolan. I'll do some more test cases but I think the new generator is correct.

If you have matlab you can play around with this using e.g.
{noformat}
b = 0.3;
pd1 = makedist('Stable','alpha',0.1,'beta',b,'gam',1,'delta',0);
pd2 = makedist('Stable','alpha',0.5,'beta',b,'gam',1,'delta',0);
pd3 = makedist('Stable','alpha',1.0,'beta',b,'gam',1,'delta',0);
pd4 = makedist('Stable','alpha',1.5,'beta',b,'gam',1,'delta',0);
pd5 = makedist('Stable','alpha',2.0,'beta',b,'gam',1,'delta',0);

x = -5:.01:5;
p1 = cdf(pd1,x);
p2 = cdf(pd2,x);
p3 = cdf(pd3,x);
p4 = cdf(pd4,x);
p5 = cdf(pd5,x);

figure
plot(x,p1,'r--');
hold on
plot(x,p2,'g--');
plot(x,p3,'b--');
plot(x,p4,'r-');
plot(x,p5,'g-');
hold off

a = 1.3;
pd1 = makedist('Stable','alpha',a,'beta',0.0,'gam',1,'delta',0);
pd2 = makedist('Stable','alpha',a,'beta',0.25,'gam',1,'delta',0);
pd3 = makedist('Stable','alpha',a,'beta',0.5,'gam',1,'delta',0);
pd4 = makedist('Stable','alpha',a,'beta',0.75,'gam',1,'delta',0);
pd5 = makedist('Stable','alpha',a,'beta',1.0,'gam',1,'delta',0);

x = -5:.01:5;
p1 = cdf(pd1,x);
p2 = cdf(pd2,x);
p3 = cdf(pd3,x);
p4 = cdf(pd4,x);
p5 = cdf(pd5,x);

figure
plot(x,p1,'r--');
hold on
plot(x,p2,'g--');
plot(x,p3,'b--');
plot(x,p4,'r-');
plot(x,p5,'g-');
hold off
{noformat}

These look the same as the beta=0.3 plot and alpha=1.3 plot from the new 
StableGenerator. Note there is no alpha=0.01 as the distribution is numerically 
hard to compute as alpha -> 0 due to the limited precision of a double.

 

> Move class from "Commons Math"
> ------------------------------
>
>                 Key: RNG-137
>                 URL: https://issues.apache.org/jira/browse/RNG-137
>             Project: Commons RNG
>          Issue Type: Task
>          Components: sampling
>            Reporter: Gilles Sadowski
>            Assignee: Alex Herbert
>            Priority: Trivial
>              Labels: commons-math, port
>             Fix For: 1.4
>
>         Attachments: Alpha1Performance.jpg, Beta0Performance.jpg, 
> GeneralPerformance.jpg, alpha0.5.jpg, alpha0.5b.jpg, alpha1.3.jpg, 
> alpha1.3b.jpg, beta0.3.jpg, beta0.3b.jpg
>
>
> Shouldn't CM's class 
> [{{StableRandomGenerator}}|https://gitbox.apache.org/repos/asf?p=commons-math.git;a=blob;f=src/main/java/org/apache/commons/math4/random/StableRandomGenerator.java;h=f3a851b9b16c47546cac8371e272dbf59a909c09;hb=HEAD]
>  be moved to the \{{commons-rng-sampling}} module?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to