Skip to content

Commit

Permalink
fix kalman filter pullback and estimation test
Browse files Browse the repository at this point in the history
  • Loading branch information
thorek1 committed Oct 27, 2023
1 parent 0308b14 commit 9fe91d2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/MacroModelling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5767,7 +5767,7 @@ function calculate_kalman_filter_loglikelihood(𝓂::ℳ, data::AbstractArray{Fl

if Fdet < eps() return -Inf end

= RF.lu(F, check = false)
= .lu(F, check = false)

if !.issuccess(F̄) return -Inf end

Expand Down
22 changes: 21 additions & 1 deletion test/test_estimation.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using MacroModelling
import Turing
import Turing: NUTS, sample, logpdf
import Turing: NUTS, sample, logpdf#, SMC, PG, ESS
# import AdvancedPS
import Optim, LineSearches
using Random, CSV, DataFrames, MCMCChains, AxisKeys
import DynamicPPL: logjoint
# using Pigeons

include("models/FS2000.jl")

Expand Down Expand Up @@ -41,11 +43,29 @@ FS2000_loglikelihood = FS2000_loglikelihood_function(data, FS2000, observables)

n_samples = 1000


# pt = pigeons(target = TuringLogPotential(FS2000_loglikelihood_function(data, FS2000, observables)),
# # record = [traces; record_default()],
# record = [traces; round_trip; record_default()],
# n_rounds = 7,
# n_chains = 10,
# multithreaded = true,
# show_report = true)#,explorer = AAPS());

# samples = Chains(sample_array(pt), variable_names(pt))

# import StatsPlots
# StatsPlots.plot(samples)

# using Zygote
# Turing.setadbackend(:zygote)
# sampsSMC = sample(FS2000_loglikelihood, SMC( AdvancedPS.resample_systematic), n_samples, progress = true)#, init_params = sol)
# sampsSMC = sample(FS2000_loglikelihood, SMC(1000), n_samples, progress = true)#, init_params = sol)
samps = sample(FS2000_loglikelihood, NUTS(), n_samples, progress = true)#, init_params = sol)

# println(mean(samps).nt.mean)
# using StatsPlots
# StatsPlots.plot(sampsSMC)

Random.seed!(30)

Expand Down

0 comments on commit 9fe91d2

Please sign in to comment.