Skip to content

Commit

Permalink
Only specify lower bound of partially truncated distributions (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion authored Sep 5, 2022
1 parent c574fe0 commit 15e84f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TuringGLM"
uuid = "0004c1f4-53c5-4d43-a221-a1dac6cf6b74"
authors = ["Jose Storopoli <thestoropoli@gmail.com>, Rik Huijzer <t.h.huijzer@rug.nl>, and contributors"]
version = "2.0.1"
version = "2.1.0"

[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand All @@ -19,7 +19,7 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"

[compat]
Distributions = "0.25"
Distributions = "0.25.42"
GLM = "1.5"
LazyArrays = "0.22"
MixedModels = "4.5"
Expand Down
10 changes: 5 additions & 5 deletions src/turing_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function _model(μ_X, σ_X, prior, intercept_ranef, idx, ::Type{Normal})
σ ~ Exponential(residual)
μ = α .+ X * β
if !isempty(intercept_ranef)
τ ~ mad(y) * truncated(TDist(3), 0, Inf)
τ ~ mad(y) * truncated(TDist(3); lower=0)
zⱼ ~ filldist(Normal(), n_gr)
αⱼ = zⱼ .* τ
μ .+= αⱼ[idxs]
Expand Down Expand Up @@ -222,7 +222,7 @@ function _model(μ_X, σ_X, prior, intercept_ranef, idx, ::Type{TDist})
ν ~ prior.auxiliary
μ = α .+ X * β
if !isempty(intercept_ranef)
τ ~ 0 + mad(y) * truncated(TDist(3), 0, Inf)
τ ~ 0 + mad(y) * truncated(TDist(3); lower=0)
zⱼ ~ filldist(Normal(), n_gr)
αⱼ = zⱼ .* τ
μ .+= αⱼ[idxs]
Expand Down Expand Up @@ -262,7 +262,7 @@ function _model(μ_X, σ_X, prior, intercept_ranef, idx, ::Type{Bernoulli})
β ~ filldist(prior.predictors, predictors)
μ = α .+ X * β
if !isempty(intercept_ranef)
τ ~ mad(y) * truncated(TDist(3), 0, Inf)
τ ~ mad(y) * truncated(TDist(3); lower=0)
zⱼ ~ filldist(Normal(), n_gr)
αⱼ = zⱼ .* τ
μ .+= αⱼ[idxs]
Expand Down Expand Up @@ -300,7 +300,7 @@ function _model(μ_X, σ_X, prior, intercept_ranef, idx, ::Type{Poisson})
β ~ filldist(prior.predictors, predictors)
μ = α .+ X * β
if !isempty(intercept_ranef)
τ ~ mad(y) * truncated(TDist(3), 0, Inf)
τ ~ mad(y) * truncated(TDist(3); lower=0)
zⱼ ~ filldist(Normal(), n_gr)
αⱼ = zⱼ .* τ
μ .+= αⱼ[idxs]
Expand Down Expand Up @@ -340,7 +340,7 @@ function _model(μ_X, σ_X, prior, intercept_ranef, idx, ::Type{NegativeBinomial
ϕ = 1 / ϕ⁻
μ = α .+ X * β
if !isempty(intercept_ranef)
τ ~ mad(y) * truncated(TDist(3), 0, Inf)
τ ~ mad(y) * truncated(TDist(3); lower=0)
zⱼ ~ filldist(Normal(), n_gr)
αⱼ = zⱼ .* τ
μ .+= αⱼ[idxs]
Expand Down

2 comments on commit 15e84f5

@storopoli
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/67735

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.1.0 -m "<description of version>" 15e84f53182f8194b5eaa370812365813ffe0bad
git push origin v2.1.0

Please sign in to comment.