Skip to content

Commit

Permalink
add shcoks size to irf
Browse files Browse the repository at this point in the history
  • Loading branch information
thorek1 committed Oct 20, 2024
1 parent 60dc423 commit 180585a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/MacroModelling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6384,6 +6384,7 @@ function irf(state_update::Function,
periods::Int = 40,
shocks::Union{Symbol_input,String_input,Matrix{Float64},KeyedArray{Float64}} = :all,
variables::Union{Symbol_input,String_input} = :all,
shock_size::Real = 1,
negative_shock::Bool = false)

pruning = initial_state isa Vector{Vector{Float64}}
Expand Down Expand Up @@ -6428,7 +6429,7 @@ function irf(state_update::Function,
end

if shocks == :simulate
shock_history = randn(T.nExo,periods)
shock_history = randn(T.nExo,periods) * shock_size

shock_history[contains.(string.(T.exo),"ᵒᵇᶜ"),:] .= 0

Expand Down Expand Up @@ -6469,7 +6470,7 @@ function irf(state_update::Function,

if shocks != :simulate && shocks isa Union{Symbol_input,String_input}
shock_history = zeros(T.nExo,periods)
shock_history[ii,1] = negative_shock ? -1 : 1
shock_history[ii,1] = negative_shock ? -shock_size : shock_size
end

initial_state_copy = state_update(initial_state_copy, shock_history[:,1])
Expand Down Expand Up @@ -6507,6 +6508,7 @@ function girf(state_update::Function,
periods::Int = 40,
shocks::Union{Symbol_input,String_input,Matrix{Float64},KeyedArray{Float64}} = :all,
variables::Union{Symbol_input,String_input} = :all,
shock_size::Real = 1,
negative_shock::Bool = false,
warmup_periods::Int = 100,
draws::Int = 50)
Expand Down Expand Up @@ -6564,7 +6566,7 @@ function girf(state_update::Function,

if shocks != :simulate && shocks isa Union{Symbol_input,String_input}
shock_history = zeros(T.nExo,periods)
shock_history[ii,1] = negative_shock ? -1 : 1
shock_history[ii,1] = negative_shock ? -shock_size : shock_size
end

if pruning
Expand Down

0 comments on commit 180585a

Please sign in to comment.