在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:lucabrugnolini/VectorAutoregressions.jl开源软件地址:https://github.com/lucabrugnolini/VectorAutoregressions.jl开源编程语言:Julia 100.0%开源软件介绍:VectorAutoregressions.jlVector autoregressive models for Julia InstallationPkg.add("https://github.com/lucabrugnolini/VectorAutoregressions.jl") IntroductionThis package is a work in progress for the estimation and identification of Vector Autoregressive (VAR) models. Status
Example## Example: fit a VAR(`p`) to the data and derive structural IRFs with asymptotic and bootstrap conf. bands.
using VectorAutoregressions
using DelimitedFiles: readdlm
using Plots
plotly()
# Read example data
path = joinpath(dirname(pathof(VectorAutoregressions)), "..") # set base path to load data
y = readdlm(joinpath(path,"test","cholvar_test_data.csv"), ',') #read example file with data
# Set VAR parameters
intercept = false #intercept in the estimation
p = 2 #select lag-length
H = 15 # IRFs horizon
nrep = 500 #bootstrap sample
# Fit VAR(2) to data
V = VAR(y,p,intercept)
# Estimate IRFs - Cholesky identification
mIRFa = IRFs_a(V,H,intercept) #asymptotic conf. bandf
mIRFb = IRFs_b(V,H,nrep,intercept) #bootstrap conf. bands
# Plot irf + asy ci
T,K = size(y)
pIRF_asy = plot(layout = grid(K,K));
[plot!(pIRF_asy, [mIRFa.CI.CIl[i,:] mIRFa.IRF[i,:] mIRFa.CI.CIh[i,:]], color = ["red" "red" "red"],
line = [:dash :solid :dash], legend = false, subplot = i) for i in 1:K^2]
gui(pIRF_asy)
# Plot irf + bootstraped ci
pIRF_boot = plot(layout = grid(K,K));
[plot!(pIRF_boot, [mIRFb.CI.CIl[i,:] mIRFb.IRF[i,:] mIRFb.CI.CIh[i,:]], color = ["blue" "blue" "blue"],
line = [:dash :solid :dash], legend = false, subplot = i) for i in 1:K^2]
gui(pIRF_boot) More in details, struct VAR
Y::Array # dep. variables
X::Array # covariates
β::Array # parameters
ϵ::Array # residuals
Σ::Array # VCV matrix
p::Int64 # lag-length
i::Bool # true or false for including an intercept (default is true)
end You can access to each element writing |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论