Skip to content

Commit

Permalink
back to no bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
thorek1 committed Oct 8, 2024
1 parent 708d849 commit 1c7e937
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions test/test_sw07_estimation_2nd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -337,20 +337,12 @@ end

## Turing model definition
# bounds
# lo_bnds = vcat(zeros(7), zeros(7), zeros(18), -30, zeros(3), zeros(5))
# up_bnds = vcat(fill(2, 7), fill(1, 7), fill(1, 2), 30, 10, fill(1, 2), 30, fill(1, 4), 10, 5, 1, 2, 2, 100, 100, 30, 5, 1, 1, 1, 10, 1, 100, 100)

lo_bnds = vcat(zeros(7), zeros(7), zeros(18), -30, zeros(3), zeros(5))
up_bnds = vcat(fill(2, 7), fill(1, 7), fill(1, 2), 30, 10, fill(1, 2), 30, fill(1, 4), 10, 5, 1, 2, 2, 100, 100, 30, 5, 1, 1, 1, 10, 1, 100, 100)
Turing.@model function SW07_loglikelihood_function(data, m, observables, fixed_parameters, algorithm, filter)
all_params ~ Turing.arraydist(dists)

Turing.@model function SW07_loglikelihood_function(data, m, observables, fixed_parameters, algorithm, filter, bounds)
for (i,x) in enumerate(all_params)
if x < bounds[1][i] || x > bounds[2][i]
Turing.@addlogprob! -Inf
else
all_params ~ Turing.arraydist(dists)
end
end


z_ea, z_eb, z_eg, z_eqs, z_em, z_epinf, z_ew, crhoa, crhob, crhog, crhoqs, crhoms, crhopinf, crhow, cmap, cmaw, csadjcost, csigma, chabb, cprobw, csigl, cprobp, cindw, cindp, czcap, cfc, crpi, crr, cry, crdy, constepinf, constebeta, constelab, ctrend, cgy, calfa = all_params[1:36]

if priors == "original"
Expand Down Expand Up @@ -427,7 +419,7 @@ end
LLH = -1e-6


SW07_llh = SW07_loglikelihood_function(data, Smets_Wouters_2007, observables, fixed_parameters, algo, fltr, bounds)
SW07_llh = SW07_loglikelihood_function(data, Smets_Wouters_2007, observables, fixed_parameters, algo, fltr)

# Turing.logjoint(SW07_loglikelihood_function(data, Smets_Wouters_2007, observables, fixed_parameters, algo, fltr), (all_params = init_params,))
# Turing.logjoint(SW07_loglikelihood_function(data, Smets_Wouters_2007, observables, fixed_parameters, :pruned_second_order, fltr), (all_params = init_params,))
Expand Down

0 comments on commit 1c7e937

Please sign in to comment.