@@ -15,56 +15,7 @@ function draw2(μ)
15
15
end
16
16
17
17
@testset " Parameterized Measures" begin
18
- @testset " Binomial" begin
19
- D = Binomial{(:n , :p )}
20
- par = merge ((n= 20 ,),transform (asparams (D, (n= 20 ,)), randn (1 )))
21
- d = D (par)
22
- (n,p) = (par. n, par. p)
23
- logitp = logit (p)
24
- probitp = norminvcdf (p)
25
- y = rand (d)
26
-
27
- ℓ = logdensity (Binomial (;n, p), y)
28
- @test ℓ ≈ logdensity (Binomial (;n, logitp), y)
29
- @test ℓ ≈ logdensity (Binomial (;n, probitp), y)
30
-
31
- @test_broken logdensity (Binomial (n,p), CountingMeasure (ℤ[0 : n]), x) ≈ binomlogpdf (n,p,x)
32
- end
33
-
34
- @testset " NegativeBinomial" begin
35
- D = NegativeBinomial{(:r , :p )}
36
- par = transform (asparams (D), randn (2 ))
37
- d = D (par)
38
- (r,p) = (par. r, par. p)
39
- logitp = logit (p)
40
- λ = p * r / (1 - p)
41
- y = rand (d)
42
-
43
- ℓ = logdensity (NegativeBinomial (;r, p), y)
44
- @test ℓ ≈ logdensity (NegativeBinomial (;r, logitp), y)
45
- @test ℓ ≈ logdensity (NegativeBinomial (;r, λ), y)
46
-
47
- @test_broken logdensity (Binomial (n,p), CountingMeasure (ℤ[0 : n]), x) ≈ binomlogpdf (n,p,x)
48
- end
49
-
50
- @testset " Normal" begin
51
- D = Normal{(:μ ,:σ )}
52
- par = transform (asparams (D), randn (2 ))
53
- d = D (par)
54
- @test params (d) == par
55
-
56
- μ = par. μ
57
- σ = par. σ
58
- σ² = σ^ 2
59
- τ = 1 / σ²
60
- logσ = log (σ)
61
- y = rand (d)
62
-
63
- ℓ = logdensity (Normal (;μ,σ), y)
64
- @test ℓ ≈ logdensity (Normal (;μ,σ²), y)
65
- @test ℓ ≈ logdensity (Normal (;μ,τ), y)
66
- @test ℓ ≈ logdensity (Normal (;μ,logσ), y)
67
- end
18
+
68
19
end
69
20
70
21
@testset " Kernel" begin
0 commit comments