-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobservables.jl
62 lines (46 loc) · 2.58 KB
/
observables.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function init_observable_mappings!(m::XGabaix)
observables = OrderedDict{Symbol,Observable}()
population_mnemonic = get(get_setting(m, :population_mnemonic))
############################################################################
## 1. Real GDP Growth
############################################################################
gdp_fwd_transform = function (levels)
# FROM: Level of GDP (from FRED)
# TO: Quarter-to-quarter percent change of real GDP per capita
levels[!,:temp] = percapita(m, :GDP, levels)
gdp = 1000 * nominal_to_real(:temp, levels)
oneqtrpctchange(gdp)
end
gdp_rev_transform = loggrowthtopct_annualized_percapita
observables[:obs_gdp] = Observable(:obs_gdp, [:GDP__FRED, population_mnemonic, :GDPDEF__FRED],
gdp_fwd_transform, gdp_rev_transform,
"Real GDP Growth", "Real GDP Growth Per Capita")
############################################################################
## 2. CPI Inflation
############################################################################
cpi_fwd_transform = function (levels)
# FROM: CPI urban consumers index (from FRED)
# TO: Annualized quarter-to-quarter percent change of CPI index
quartertoannual(oneqtrpctchange(levels[!,:CPIAUCSL]))
end
cpi_rev_transform = loggrowthtopct_annualized
observables[:obs_cpi] = Observable(:obs_cpi, [:CPIAUCSL__FRED],
cpi_fwd_transform, cpi_rev_transform,
"CPI Inflation",
"CPI Inflation")
############################################################################
## 3. Nominal short-term interest rate (3 months)
############################################################################
nominalrate_fwd_transform = function (levels)
# FROM: Nominal effective federal funds rate (aggregate daily data at a
# quarterly frequency at an annual rate)
# TO: Nominal effective fed funds rate, at a quarterly rate annualized
levels[!,:DFF]
end
nominalrate_rev_transform = identity
observables[:obs_nominalrate] = Observable(:obs_nominalrate, [:DFF__FRED],
nominalrate_fwd_transform, nominalrate_rev_transform,
"Nominal FFR",
"Nominal Effective Fed Funds Rate")
m.observable_mappings = observables
end