Skip to content

Commit

Permalink
get tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Sabanes Bove committed Feb 22, 2024
1 parent 78ffbdd commit 5182bb2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/SafetySignalDetection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module SafetySignalDetection

using Turing
using StatsPlots
using DataFrames
using Distributions
using SpecialFunctions
using Statistics
Expand Down
11 changes: 10 additions & 1 deletion src/meta_analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,17 @@ meta_analysis_model(

a ~ prior_a
b ~ prior_b
pis ~ filldist(Beta(a * b * n, (1 - a) * b * n), n_trials)

# Truncate the two Beta distribution parameters to be larger than zero to avoid
# initialization problems.
beta_par_min = floatmin(Float64)
first = max(beta_par_min, a * b * n)
second = max(beta_par_min, (1 - a) * b * n)

# Add one more pi parameter here to represent the new trial
# where we want to have the prior for.
pis ~ filldist(Beta(first, second), n_trials + 1)

for i in 1:n
pi = pis[trialindex[i]]
mu = log(-log(1 - pi))
Expand Down
2 changes: 1 addition & 1 deletion test/test_meta_analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ end

end

@testset "meta_analytic_samples" begin
@testset "meta_analytic_samples runs as expected" begin
rng = StableRNG(123)

n_trials = 5
Expand Down

0 comments on commit 5182bb2

Please sign in to comment.