Skip to content

Commit

Permalink
a minor bug fix to Chi
Browse files Browse the repository at this point in the history
  • Loading branch information
lindahua committed Aug 2, 2015
1 parent 5b016a7 commit c7ff270
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/univariate/continuous/chi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ logpdf(d::Chi, x::Float64) = (ν = d.ν;
(1.0 - 0.5 * ν) * logtwo +- 1.0) * log(x) - 0.5 * x^2 - lgamma(0.5 * ν)
)

gradlogpdf(d::Chi, x::Float64) = x >= 0.0 ? (d.μ - 1.0) / x - x : 0.0
gradlogpdf(d::Chi, x::Float64) = x >= 0.0 ? (d.ν - 1.0) / x - x : 0.0

cdf(d::Chi, x::Float64) = chisqcdf(d.ν, x^2)
ccdf(d::Chi, x::Float64) = chisqccdf(d.ν, x^2)
Expand Down
3 changes: 2 additions & 1 deletion test/dirichlet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using Distributions
using Base.Test

srand(34567)

d = Dirichlet(3, 2.0)

@test length(d) == 3
Expand Down Expand Up @@ -73,4 +75,3 @@ r = fit_mle(Dirichlet, x)

r = fit_mle(Dirichlet, x, fill(2.0, n))
@test_approx_eq_eps r.alpha d.alpha 0.25

0 comments on commit c7ff270

Please sign in to comment.