@@ -3,34 +3,37 @@ using Test, Random, Distributions
33
44@testset " AlphaStableDistributions.jl" begin
55
6- for α in 0.6 : 0.1 : 2
7- d1 = AlphaStable (α= α)
8- s = rand (d1, 100000 )
6+ stabletypes = [AlphaStable,SymmetricAlphaStable]
7+ αs = [0.6 : 0.1 : 2 ,1 : 0.1 : 2 ]
8+ for (i, stabletype) in enumerate (stabletypes)
9+ for α in αs[i]
10+ d1 = AlphaStable (α= α)
11+ s = rand (d1, 100000 )
912
10- d2 = fit (AlphaStable , s)
13+ d2 = fit (stabletype , s)
1114
12- @test d1. α ≈ d2. α rtol= 0.1
13- @test d1. β ≈ d2. β atol= 0.2
14- @test d1. scale ≈ d2. scale rtol= 0.1
15- @test d1. location ≈ d2. location atol= 0.1
16- end
15+ @test d1. α ≈ d2. α rtol= 0.1
16+ stabletype != SymmetricAlphaStable && @test d1. β ≈ d2. β atol= 0.2
17+ @test d1. scale ≈ d2. scale rtol= 0.1
18+ @test d1. location ≈ d2. location atol= 0.1
19+ end
1720
18- xnormal = rand (Normal (3.0 , 4.0 ), 96000 )
19- d = fit (AlphaStable , xnormal)
20- @test d. α ≈ 2 rtol= 0.2
21- @test d. β ≈ 0 atol= 0.2
22- @test d. scale ≈ 4 /√ 2 rtol= 0.2
23- @test d. location ≈ 3 rtol= 0.1
21+ xnormal = rand (Normal (3.0 , 4.0 ), 96000 )
22+ d = fit (stabletype , xnormal)
23+ @test d. α ≈ 2 rtol= 0.2
24+ stabletype != SymmetricAlphaStable && @test d. β ≈ 0 atol= 0.2
25+ @test d. scale ≈ 4 /√ 2 rtol= 0.2
26+ @test d. location ≈ 3 rtol= 0.1
2427
25- xcauchy = rand (Cauchy (3.0 , 4.0 ), 96000 )
26- d = fit (AlphaStable, xcauchy)
27- @test d. α ≈ 1 rtol= 0.2
28- @test d. β ≈ 0 atol= 0.2
29- @test d. scale ≈ 4 rtol= 0.2
30- @test d. location ≈ 3 rtol= 0.1
28+ xcauchy = rand (Cauchy (3.0 , 4.0 ), 96000 )
29+ d = fit (stabletype, xcauchy)
30+ @test d. α ≈ 1 rtol= 0.2
31+ @test d. β ≈ 0 atol= 0.2
32+ @test d. scale ≈ 4 rtol= 0.2
33+ @test d. location ≈ 3 rtol= 0.1
34+ end
3135
3236 for α in 1.1 : 0.1 : 1.9
33-
3437 d = AlphaSubGaussian (n= 96000 , α= α)
3538 x = rand (d)
3639 x2 = copy (x)
0 commit comments