Comments (16)
Hi Fritz,
The reason you get this error is that the AbstractRepModel type is defined in src/abstractdsgemodel.jl so you would need to include that file before including "an_schorfheide.jl". However, the package is meant to be used is by doing loading the package and then using the functions built into it rather than by including individual files. If you look at src/DSGE.jl, you will see that loading the package will automatically include the "an_schorfheide.jl" file with the pre-requisite files loaded earlier. So, after loading the package, you can use any of the functions defined in "an_schorfheide.jl" to create your own AnSchorfheide model object. The following code, for example, will create an AnSchorfheide model object:
using DSGE
m = DSGE.AnSchorfheide()
Regards,
Shlok
from dsge.jl.
Dear Shlok - thanks!
I used your advice an got again an error message, after proceeding as follows:
julia> using DSGE
julia> m = DSGE.AnSchorfheide()
Dynamic Stochastic General Equilibrium Model
no. states: 8
no. anticipated policy shocks: 0
data vintage: 220119
description:
Julia implementation of model defined in 'Bayesian Estimation of DSGE Models' by Sungbae An and Frank Schorfheide: AnSchorfheide, ss0
julia> include("d:/FRBNY-DSGE_in_Julia/DSGE.jl/src/abstractdsgemodel.jl")
ERROR: LoadError: UndefVarError: ModelConstructors not defined
Stacktrace:
[1] top-level scope
@ d:\FRBNY-DSGE_in_Julia\DSGE.jl\src\abstractdsgemodel.jl:1
in expression starting at d:\FRBNY-DSGE_in_Julia\DSGE.jl\src\abstractdsgemodel.jl:1
There must be another missing input - but which one?
Fritz
from dsge.jl.
from dsge.jl.
Hi Fritz,
Sorry I wasn't clear. Once you do "using DSGE" all the functions within "an_schorfheide.jl" are available to you so you don't need to include any files. "m" is an An-Schorfheide model object as the Julia message indicates which I imagine is what you want.
If you are interested, the reason for the error is that you need to do "using ModelConstructors" before. However, going down this road is a slippery slope as there will undoubtedly be other files you would need to include before being able to include "an_schorfheide.jl". As a result, I recommend just doing loading DSGE.jl. However, if you want to do includes, you can just do "include src/DSGE.jl" and everything should work then.
One thing that might help is looking at the example scripts. For example, in the below script, we instantiate a Model1002 object: https://github.com/FRBNY-DSGE/DSGE.jl/blob/main/examples/run_default.jl
Regards,
Shlok
from dsge.jl.
from dsge.jl.
Hi Fritz,
The package is not intended to be used by including individual files. Once you do using DSGE
, all functions in an_schorfheide.jl
and smets_wouters.jl
are automatically loaded (which is the only purpose of loading in the files I can think of). Hence, you don't need to do include an_schorfheide.jl
. Instead, you can just proceed to whatever code you intend to run after including the files. So, you just need to run using DSGE
to load the files.
You can also check out https://github.com/FRBNY-DSGE/DSGE.jl/blob/main/examples/run_default.jl and just replace m = Model1002("ss10")
with m = AnSchorfheide()
or m = SmetsWouters()
depending on the model you want.
Regards,
Shlok
from dsge.jl.
from dsge.jl.
Hi Fritz,
I can't see the error message. I just see the following: "@.***"
If you are getting an issue in load_data(m; check_empty_columns = false)
(line 51 of make_packet.jl), then the reason probably is that you need a FRED API key as we pull data from FRED. You can get an API key by making an account with FRED: https://fred.stlouisfed.org/docs/api/api_key.html.
If the issue is instead in usual_model_forecast
(line 85 of make_packet.jl), then I would to see the error message you are getting to be able to debug it. The one issue I can imagine is that the input parameter file is not found. To resolve that problem, make sure you are running the file from DSGE.jl/examples
. That is, you are running just include("make_packet.jl")
as opposed to include("examples/make_packet.jl")
or something similar. This is because the filepath for the input file relies on the current working directory being examples/
.
Regards,
Shlok
from dsge.jl.
from dsge.jl.
Hi Fritz,
To tell Julia your API key, I would recommend running the following:
ENV["FRED_API_KEY"] = "[Your API Key Here]"
include("make_packet.jl")
The first line defines the environment variable FRED_API_KEY in Julia which the function Fred() will automatically look for. The reason your code didn't work is that f
is not passed into the function make_packet
and so the Fred
object you created is not used by the function.
Regards,
Shlok
from dsge.jl.
from dsge.jl.
Hi Fritz,
The fact that it started forecasting and got through 8 blocks suggests that the FRED data is being loaded correctly. I still can't see the error message you are getting. I just see the following:
@.***
and:
@.***
I guess you are trying to copy and paste the error but GitHub is not picking it up. Could you save the error as an image and send that? I might be able to view that to help with debugging the issue.
Regards,
Shlok
from dsge.jl.
from dsge.jl.
from dsge.jl.
Hi Fritz,
The warnings can be safely ignored. The error has to do with the inputted vector of parameter values not aligning with the model's internal parameters. Namely, overrides[:full]
in line 55 is set to the file containing the parameter values but these values were constructed for Model1002("ss10")
(as that's the model the example is for) whose parameters differ from the Smets-Wouters model.
Once you run run_default.jl
, it estimates the model and stores the results in the directory given by rawpath(m, "estimate")
. Using default settings, this will be in DSGE/save/output_data/smets_wouters/ss0/estimate/raw/mhsave_vint=181115.h5
. In line 55 of make_packet.jl
, you want to replace the filepath and point to this filepath instead.
Regards,
Shlok
from dsge.jl.
from dsge.jl.
Related Issues (20)
- metropolis_hastings() running too slow HOT 6
- metropolis-hastings draws fixed at the mode for some free parameters HOT 4
- Eval can be replaced by getfield in smooth HOT 1
- TagBot trigger issue HOT 3
- Docker file error HOT 1
- Plots error
- Policy Simulation Library Catalog Criteria HOT 6
- ZLB handling method HOT 2
- Is it possible to update Performance Comparison? HOT 2
- The package doesn't work with GR.jl above v.53 HOT 2
- Installation hangs with Julia 1.6.3 HOT 1
- make_packet.jl HOT 1
- run_default.jl HOT 1
- Can't Get Simple Example To Xqt HOT 3
- run_default.jl HOT 1
- mhsave_vint HOT 2
- After 2020 Q3.
- Installation on Julia 1.9.4 HOT 1
- Failed installation on Julia 1.10 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dsge.jl.