-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AnSchorfheide #167
Comments
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:
Regards, |
Dear Shlok - thanks!
|
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
Von: ShlokG ***@***.***>
Gesendet: Mittwoch, 19. Jänner 2022 05:22
An: FRBNY-DSGE/DSGE.jl ***@***.***>
Cc: Breuss, Fritz ***@***.***>; Author ***@***.***>
Betreff: Re: [FRBNY-DSGE/DSGE.jl] AnSchorfheide (Issue #167)
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()
—
Reply to this email directly, view it on GitHub<#167 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AWXSUMUMSYPQXGL6FWSDV3LUWY377ANCNFSM5MC6VZ6Q>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
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, |
Dear Shlok,
thank you for your answer. Well I tried to start again with the following steps:
1. using ModelConstructors
2. using DSGE
3. m = DSGE.AnSchorfheide()
4. include(“…GitHub/DSGE.jl/src/abstractdsgemodel.jl”) --- # file is where DSGE.jl is downloaded via GitHub
gives another error message:
“LoadError: cannot assign a value to variable DSGE.AbstractDSGEModel from module Main” --- also ***@***.***” leads to errors!!!
Well, maybe we finally converge to a solution. But instead of puzzling further around, I would be grateful if you would just tell me the steps, how you are able to run successfully the files “an_schorfheide.jl” and maybe “smets_wouters.jl”. it would be a pity if only you as the expert is able to use this excellent programs in Julia and not also ordinary users after the program has been made available to the public.
Maybe it has also something to do with the versions of Julia (I tried version 1.1.1 and 1.7.1)?
Thanks already a lot in advance.
Best regards,
Fritz
I would be grateful if you would just tell me how to get the file X to work
Von: ShlokG ***@***.***>
Gesendet: Mittwoch, 19. Jänner 2022 17:18
An: FRBNY-DSGE/DSGE.jl ***@***.***>
Cc: Breuss, Fritz ***@***.***>; Author ***@***.***>
Betreff: Re: [FRBNY-DSGE/DSGE.jl] AnSchorfheide (Issue #167)
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.
Regards,
Shlok
—
Reply to this email directly, view it on GitHub<#167 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AWXSUMUUG6IK2DHTEUCREH3UW3P3ZANCNFSM5MC6VZ6Q>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Hi Fritz, The package is not intended to be used by including individual files. Once you do You can also check out https://github.com/FRBNY-DSGE/DSGE.jl/blob/main/examples/run_default.jl and just replace Regards, |
Dear Shlok,
thank you very much for your precise advice. Now, I succeeded in running the AnSchorfheide and the SmetsWouters model via changing “m” in the file “run_default.jl”.
Now I have a question concerning the data output. The raw forecast output is saved in 6 files in “…\output_data\smets_wouters\ss0\forecast\raw\...*.jld2”.
I guess that one can see the data (plots of forecast and shocks etc.) by running the file “make_packet.jl”, if one changes the “m” to “m = AnSchorfheide() or m = SmetsWouters()”.
I made these changes and got, however, an error message:
***@***.***
Why does the input file not exist and what must I change to be able to run successfully the file “make_packet.jl”?
Best regards,
Fritz
Von: ShlokG ***@***.***>
Gesendet: Mittwoch, 19. Jänner 2022 18:57
An: FRBNY-DSGE/DSGE.jl ***@***.***>
Cc: Breuss, Fritz ***@***.***>; Author ***@***.***>
Betreff: Re: [FRBNY-DSGE/DSGE.jl] AnSchorfheide (Issue #167)
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
—
Reply to this email directly, view it on GitHub<#167 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AWXSUMRLE56FANQJOZTV7WTUW33OLANCNFSM5MC6VZ6Q>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Hi Fritz, I can't see the error message. I just see the following: "@.***" If you are getting an issue in If the issue is instead in Regards, |
Dear Shlok,
thank you for the hint with the FRED API. Well, I have already an API key but I do not know how to implement it into the line 51 of “make_packet.jl”.
I tried the following:
1. julia> f = Fred("599d13811a607b2cc6b33c2dbae1f019") ….# my API key
2. julia> f = Fred() ….# API key loaded
3. Then I run: “make_packet.jl” ….# line 30: m = Model1002(“ss10”) … here one could change to “AnSchorfheide()” or “SmetsWouters()”
….# line 51: df = load_data(m; check_emptiy_colums = false) ….. # I did not change this line; maybe one must do it in order to refer to
the FRED API key, but how?
1. As a result I got Warnings and error messages like these:
***@***.***
and
***@***.***
The question is how to implement the own API key into the file “make_packet.jl”?
Best regards,
Fritz
Von: ShlokG ***@***.***>
Gesendet: Freitag, 21. Jänner 2022 06:53
An: FRBNY-DSGE/DSGE.jl ***@***.***>
Cc: Breuss, Fritz ***@***.***>; Author ***@***.***>
Betreff: Re: [FRBNY-DSGE/DSGE.jl] AnSchorfheide (Issue #167)
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
—
Reply to this email directly, view it on GitHub<#167 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AWXSUMRWPYKPYDF6MT4RAQDUXDYD7ANCNFSM5MC6VZ6Q>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Hi Fritz, To tell Julia your API key, I would recommend running the following:
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 Regards, |
Dear Shlok,
thank you for the suggestion, how to include the FRED API key. Unfortunately, the result is still not satisfactory.
I have – as suggested by your - started with the line “ENV[ ….”; then I firstly rerun “run_default.jl” from “…/examples/..”. After a long time the run was successful. Then I rerun “make_packet.jl” and I got the following error messages:
***@***.***
and:
***@***.***
After the “Info: Forecasting block 8 of 50 …” there is something missing! But what?
Best regards,
Fritz
Von: ShlokG ***@***.***>
Gesendet: Freitag, 21. Jänner 2022 18:59
An: FRBNY-DSGE/DSGE.jl ***@***.***>
Cc: Breuss, Fritz ***@***.***>; Author ***@***.***>
Betreff: Re: [FRBNY-DSGE/DSGE.jl] AnSchorfheide (Issue #167)
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
—
Reply to this email directly, view it on GitHub<#167 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AWXSUMS7UU5Y2TXJI6IUEDLUXGNHBANCNFSM5MC6VZ6Q>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
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: @.*** 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, |
Dear Shlok,
attached I send you the error messages which I told you yesterday. I hope that you can read it.
Best regards,
Fritz
Von: ShlokG ***@***.***>
Gesendet: Freitag, 21. Jänner 2022 22:53
An: FRBNY-DSGE/DSGE.jl ***@***.***>
Cc: Breuss, Fritz ***@***.***>; Author ***@***.***>
Betreff: Re: [FRBNY-DSGE/DSGE.jl] AnSchorfheide (Issue #167)
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
Regards,
Shlok
—
Reply to this email directly, view it on GitHub<#167 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AWXSUMQLKKEKA2DOA5E4RNTUXHISZANCNFSM5MC6VZ6Q>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Dear Shlok,
1. The run with „run_default.jl” (m = SmetsWouters() model) was successful with Julia version 1.1.1. The results were saved as “tex” files in:
C:/.julia/packages/DSGE/fjU1P/save/output_data/smets_wouters/ss0/estimate/tables/…*.tex (4 files for Tabl1: moments, parameter estimates etc….)
After the input: “ENV[“FRED_API_KEY”] = “[my key]”
1. The run with “make_packet.jl” (m = SmetsWouters() model) was not successful and delivered the following error messages:
“Warning: Type annotations on keyword arguments not currently supported in recipes. Type information has been discarded” --- this line is repeated several times
After telling that the “dataset creation successful” – obs_gdp, Frequency of missing/NaNs: 0.0” … this statement for other variables, e.g.: “obs_hours, Frequency of missing/NaNs: 0.07594…”
“Info: Forecasting block 1 of 50… “
Loading draws from c:\users\fritz\OneDrive\Dokumente\GitHub\DSGE.jl\examples/../test/reference/mhsave_vint=181115.h5
ERROR: LoadError: New value of ρ_μ (-45.498892312835) is out of bounds ((1.0e-5, 0.999))
Then the run stops and refers to the file “make_packet.jl” – line 60.
Why is it not possible to replicate the file “make_packet.jl” when all inputs/changes (e.g. m = SmetsWouters()) are made correctly?
Best regards,
Fritz
Von: ShlokG ***@***.***>
Gesendet: Freitag, 21. Jänner 2022 22:53
An: FRBNY-DSGE/DSGE.jl ***@***.***>
Cc: Breuss, Fritz ***@***.***>; Author ***@***.***>
Betreff: Re: [FRBNY-DSGE/DSGE.jl] AnSchorfheide (Issue #167)
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
Regards,
Shlok
—
Reply to this email directly, view it on GitHub<#167 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AWXSUMQLKKEKA2DOA5E4RNTUXHISZANCNFSM5MC6VZ6Q>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
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, Once you run Regards, |
Dear Shlok,
thank you for the hint to change the loading filepath to capture the Smets_Wouters “.h5” file. I did this by changing line 55:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# overrides[:full] = "$(fn)/../test/reference/mhsave_vint=181115.h5"
overrides[:full] = "c:/users/fritz/.julia/packages/DSGE/fjU1P/save/output_data/smets_wouters/ss0/estimate/raw/mhsave_vint=181115.h5"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Maybe this was not the correct statement of the new filepath, because I got the following error messages:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[ Info: Forecasting block 1 of 50...
Loading draws from c:/users/fritz/.julia/packages/DSGE/fjU1P/save/output_data/smets_wouters/ss0/estimate/raw/mhsave_vint=181115.h5
HDF5-DIAG: Error detected in HDF5 (1.10.5) thread 0:
#000: E:/mingwbuild/mingw-w64-hdf5/src/hdf5-1.10.5/src/H5Pdcpl.c line 2048 in H5Pset_chunk(): all chunk dimensions must be positive
major: Invalid arguments to routine
minor: Out of range
ERROR: LoadError: Error setting chunk size
Stacktrace:
[1] error(::String) at .\error.jl:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Did I change line 55 not correctly?
Best regards,
Fritz
Von: ShlokG ***@***.***>
Gesendet: Dienstag, 25. Jänner 2022 23:31
An: FRBNY-DSGE/DSGE.jl ***@***.***>
Cc: Breuss, Fritz ***@***.***>; Author ***@***.***>
Betreff: Re: [FRBNY-DSGE/DSGE.jl] AnSchorfheide (Issue #167)
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
—
Reply to this email directly, view it on GitHub<#167 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AWXSUMWVWS5WTHAKGO3E5ULUX4QD5ANCNFSM5MC6VZ6Q>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
When running the Julia file "an_schorfheide.jl" one gets immediately an error message "Load Error: UndefVarError: AbstractRepModel not defined". This happens in Julia version 1.1.1 and also in version 1.7.1.
How can one run the an_schorfheide file without this error message?
Best regards,
Fritz
The text was updated successfully, but these errors were encountered: