Skip to content

Commit

Permalink
Increase h. Tests passing sometimes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushpatnaikgit committed Oct 22, 2024
1 parent 03af97f commit 790ee13
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/bayesian/negativebinomial_regression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ end

"""
```julia
fit(formula::FormulaTerm, data::DataFrame, modelClass::NegBinomRegression, prior::Prior_Ridge, h::Float64 = 0.1, sim_size::Int64 = 1000)
fit(formula::FormulaTerm, data::DataFrame, modelClass::NegBinomRegression, prior::Prior_Ridge, h::Float64 = 1.0, sim_size::Int64 = 1000)
```
Fit a Bayesian Negative Binomial Regression model on the input data with a Ridge prior.
Expand Down Expand Up @@ -103,7 +103,7 @@ function fit(
data::DataFrame,
modelClass::NegBinomRegression,
prior::Prior_Ridge,
h::Float64 = 0.1,
h::Float64 = 1.0,
sim_size::Int64 = 1000
)
@model NegativeBinomialRegression(X, y) = begin
Expand Down Expand Up @@ -218,7 +218,7 @@ function fit(
data::DataFrame,
modelClass::NegBinomRegression,
prior::Prior_Laplace,
h::Float64 = 0.1,
h::Float64 = 1.0,
sim_size::Int64 = 1000
)
@model NegativeBinomialRegression(X, y) = begin
Expand Down Expand Up @@ -511,6 +511,7 @@ function fit(
data::DataFrame,
modelClass::NegBinomRegression,
prior::Prior_HorseShoe,
h::Float64 = 1.0,
sim_size::Int64 = 1000
)
@model NegativeBinomialRegression(X, y) = begin
Expand All @@ -523,11 +524,11 @@ function fit(

τ ~ halfcauchy ## Global Shrinkage
λ ~ filldist(halfcauchy, p) ## Local Shrinkage
σ ~ halfcauchy
σ ~ InverseGamma(h, h)
#α ~ Normal(0, τ * σ)
β0 = repeat([0], p) ## prior mean
β ~ MvNormal(β0, λ * τ *σ)

# β ~ MvNormal(β0, λ * τ *σ)
β ~ MvNormal(β0, λ * τ)

## link
#z = α .+ X * β
Expand Down
4 changes: 2 additions & 2 deletions test/numerical/bayesian/LogisticRegression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ tests = [
(
Prior_HorseShoe(),
(
(Logit(), 0.38683395333332327),
(Probit(), 0.38253233489484173),
(Logit(), 0.7599999999740501),
(Probit(), 0.7580564600751047),
(Cloglog(), 0.7667553778881738),
(Cauchit(), 0.7706755564626601)
)
Expand Down

0 comments on commit 790ee13

Please sign in to comment.