-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfrbus.nw
8743 lines (6420 loc) · 329 KB
/
frbus.nw
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass{book}
\usepackage{noweb}
\usepackage{hyperref}
\hypersetup{final=true}
\usepackage[toc,page]{appendix}
\usepackage{multicol}
\usepackage{framed}
\usepackage{xcolor}
\let\oldquote=\quote
\let\endoldquote=\endquote
\colorlet{shadecolor}{orange!15}
\renewenvironment{quote}{\begin{shaded*}\begin{oldquote}}{\end{oldquote}\end{shaded*}}
\title{Reverse Engineering the FRB/US Model in R}
\author{Gary Young}
\begin{document}
\pagestyle{noweb}
\maketitle
\tableofcontents
\newpage
\chapter{Introduction}
I am starting to reverse engineer\footnote{The pdf was created with noweb, the literate programming tool: "noweb frbus.nw | pdflatex -synctex=1 -interaction=nonstopmode frbus.tex"} the Federal Reserve's \href{https://www.federalreserve.gov/econresdata/frbus/us-models-package.htm}{FRB/US model packages} to create my own version in the R Language. I quote their
\href{https://www.federalreserve.gov/econresdata/frbus/us-models-about.htm}{about page}:
\begin{quote}
The FRB/US model is a large-scale estimated general equilibrium model of the U.S. economy that has been in use at the Federal Reserve Board since 1996. The model is designed for detailed analysis of monetary and fiscal policies. One distinctive feature compared to dynamic stochastic general equilibrium (DSGE) models is the ability to switch between alternative assumptions about expectations formation of economic agents. Another is the model’s level of detail: FRB/US contains all major components of the product and income sides of the U.S. national accounts. Since its original development, the model has continuously undergone changes to cope with the evolving structure of the economy, including conceptual revisions to sectoral definitions of the national accounts.
The article \href{https://www.federalreserve.gov/econresdata/notes/feds-notes/2014/a-tool-for-macroeconomic-policy-analysis.html}{"The FRB/US Model: A Tool for Macroeconomic Policy Analysis"} provides a brief overview of the structure of FRB/US, and presents some key properties of the model and some applications, code for which is included with the main FRB/US model package. The article \href{https://www.federalreserve.gov/econresdata/notes/feds-notes/2014/november-2014-update-of-the-frbus-model-20141121.html}{"November 2014 Update of the FRB/US Model"} presents some model properties of the most recently released version of FRB/US.
\end{quote}
This is an evolving document, where I will initially create the Fed's model files byte for byte and reverse engineer the structure of the model. Then I plan to morph it into the \href{https://www.r-project.org/}{R software environment for statistical computing and graphics}, to use to create my own models. I'm using the \href{https://en.wikipedia.org/wiki/Literate_programming}{literate programming} method of \href{https://en.wikipedia.org/wiki/Donald_Knuth}{Donald Knuth} to combine the documentation with the actual code.
\chapter{Model Equations and Coefficients}
Compare my version of the "Model Equations and Coefficients" to the \href{http://htmlpreview.github.io/?https://github.com/proudindiv/FRBUSinR/blob/ReverseEngineer/frbus_package/documentation/equations.html}{documentation}.
\section{Household Expenditures}
\subsection[a.1 ECO]{a.1 ECO: Consumer expenditures on non-durable goods and non-housing services, cw 2009\$}
<<variable ECO>>=
ECO = Consumer expenditures on non-durable goods and non-housing services, cw 2009$
@ %def ECO
<<equation eco>>=
eco: d( log(eco), 0, 1) - eco_aerr _
= (y_eco(1) * log(qeco(-1)/eco(-1)) _
+ y_eco(2) * d(log(eco(-1)), 0, 1) _
+ y_eco(3) * zeco) * (1-y_eco(4)) _
+ y_eco(4) * (d(log(yhl+yht), 0, 1))
@ %def eco
<<coefficient y{\_}eco>>=
y_eco 4 0.1088704831212408,0.4609714707829828,1,0.252176379778204
@ %def y_eco
\subsection[a.2 ECD]{a.2 ECD: Consumer expenditures on durable goods, cw 2009\$}
<<variable ECD>>=
ECD = Consumer expenditures on durable goods, cw 2009$
@ %def ECD
<<equation ecd>>=
ecd: d( log(ecd), 0, 1) - ecd_aerr _
= y_ecd(1) * log(qecd(-1)/ecd(-1)) _
+ y_ecd(2) * d( log(ecd(-1)), 0, 1) _
+ y_ecd(3) * zecd _
+ y_ecd(4) * zgapc2 / 400
@ %def ecd
<<coefficient y{\_}ecd>>=
y_ecd 4 0.1553557918476032,-0.05860156240430123,1,9.039065475739223
@ %def y_ecd
\subsection[a.3 EH]{a.3 EH: Residential investment expenditures, cw 2009\$}
<<variable EH>>=
EH = Residential investment expenditures, cw 2009$
@ %def EH
<<equation eh>>=
eh: d( log(eh), 0, 1 ) - eh_aerr _
= y_eh(1) * log(qeh(-1)/eh(-1)) _
+ y_eh(2) * d( log(eh(-1)), 0, 1 ) _
+ y_eh(3) * d( log(eh(-2)), 0, 1 ) _
+ y_eh(4) * zeh _
+ y_eh(5) * d( rme(-1), 0, 1 ) _
+ y_eh(6) * d83 * d( rme(-1), 0, 1 )
@ %def eh
<<coefficient y{\_}eh>>=
y_eh 6 0.01184830003855771,0.3575993755366778,0.2161402157869259,1,-0.05135790678323379,0.02487247623721819
@ %def y_eh
\subsection[a.4 ECH]{a.4 ECH: Consumer expenditures on housing services, cw 2009\$}
<<variable ECH>>=
ECH = Consumer expenditures on housing services, cw 2009$
@ %def ECH
<<equation ech>>=
ech: d( (ech)/kh(-1), 0, 1 ) - ech_aerr _
= y_ech(1) _
+ y_ech(2) * ech(-1)/kh(-2) _
+ y_ech(3) * d( ech(-1)/kh(-2), 0, 1 ) _
+ y_ech(4) * rrmet/100
@ %def ech
<<coefficient y{\_}ech>>=
y_ech 4 0.002890569762594884,-0.02415873224871467,0.5006794105950545,0.001736793669371161
@ %def y_ech
\subsection[a.5 QEC]{a.5 QEC: Desired level of consumption (FRBUS definition)}
<<variable QEC>>=
QEC = Desired level of consumption (FRBUS definition)
@ %def QEC
<<equation qec>>=
qec: qec - qec_aerr = y_qec(1) * zyh _
+ y_qec(2) * (dcon*(zyh-zyht)) _
+ y_qec(3) * zyht _
+ y_qec(4) * zyhp _
+ y_qec(5) * (wps+wpo)
@ %def qec
<<coefficient y{\_}qec>>=
y_qec 5 0.7592609842874721,0.002578773939057793,0.2407390157125279,-0.2514158240890368,0.03153868180983269
@ %def y_qec
\subsection[a.6 QECO]{a.6 QECO: Desired level of consumption of nondurable goods and nonhousing services}
<<variable QECO>>=
QECO = Desired level of consumption of nondurable goods and nonhousing services
@ %def QECO
<<equation qeco>>=
qeco: log(qeco) - qeco_aerr = log(qec) - log(pcor) + y_qeco(1)
@ %def qeco
<<coefficient y{\_}qeco>>=
y_qeco 1 -0.3372292498223053
@ %def y_qeco
\subsection[a.7 QECD]{a.7 QECD: Target level of consumption of durable goods, trending component}
<<variable QECD>>=
QECD = Target level of consumption of durable goods, trending component
@ %def QECD
<<equation qecd>>=
qecd: qecd - qecd_aerr = qec _
* (jrcd/4 + hggdpt/400 + y_qecd(1)*hgpcdr/400) _
* exp(y_qecd(2) + y_qecd(3)*log(pcdr*rccd))
@ %def qecd
<<coefficient y{\_}qecd>>=
y_qecd 3 -0.6165972226120303,2.557266037164673,-0.6165972226120303
@ %def y_qecd
\subsection[a.8 QEH]{a.8 QEH: Target level of residential investment}
<<variable QEH>>=
QEH = Target level of residential investment
@ %def QEH
<<equation qeh>>=
qeh: qeh - qeh_aerr = qec _
* (jrh/4 + hggdpt/400) _
* exp(y_qeh(1) - log(phr*pxp/pcnia) + y_qeh(2)*log(rcch))
@ %def qeh
<<coefficient y{\_}qeh>>=
y_qeh 2 1.935026993649364,-0.1570195518635583
@ %def y_qeh
\subsection[a.9 ECNIA]{a.9 ECNIA: Personal consumption expenditures, cw 2009\$ (NIPA definition)}
<<variable ECNIA>>=
ECNIA = Personal consumption expenditures, cw 2009$ (NIPA definition)
@ %def ECNIA
<<equation ecnia>>=
ecnia: log(ecnia) - ecnia_aerr = log(ecnia(-1)) + _
.5 * .01 * (pcor*pcnia*eco/ecnian _
+ pcor(-1)*pcnia(-1)*eco(-1)/ecnian(-1)) _
* d(log(eco), 0, 1) _
+ .5 * .01 * (pcdr*pcnia*ecd/ecnian _
+ pcdr(-1)*pcnia(-1)*ecd(-1)/ecnian(-1)) _
* d(log(ecd), 0, 1) _
+ .5 * .01 * (pchr*pcnia*ech/ecnian _
+ pchr(-1)*pcnia(-1)*ech(-1)/ecnian(-1)) _
* d(log(ech), 0, 1)
@ %def ecnia
\subsection[a.10 ECNIAN]{a.10 ECNIAN: Personal consumption expenditures, current \$ (NIPA definition)}
<<variable ECNIAN>>=
ECNIAN = Personal consumption expenditures, current $ (NIPA definition)
@ %def ECNIAN
<<equation ecnian>>=
ecnian: ecnian - ecnian_aerr = .01*pcnia*ecnia
@ %def ecnian
\subsection[a.11 EHN]{a.11 EHN: Residential investment expenditures}
<<variable EHN>>=
EHN = Residential investment expenditures
@ %def EHN
<<equation ehn>>=
ehn: ehn - ehn_aerr = .01 * phr * pxp * eh
@ %def ehn
\subsection[a.12 KCD]{a.12 KCD: Stock of consumer durables, cw 2009\$}
<<variable KCD>>=
KCD = Stock of consumer durables, cw 2009$
@ %def KCD
<<equation kcd>>=
kcd: kcd - kcd_aerr = .25*ecd + (1-jrcd/4)*kcd(-1)
@ %def kcd
\subsection[a.13 KH]{a.13 KH: Stock of residential structures, cw 2009\$}
<<variable KH>>=
KH = Stock of residential structures, cw 2009$
@ %def KH
<<equation kh>>=
kh: kh - kh_aerr = .25*eh + (1-jrh/4)*kh(-1)
@ %def kh
\subsection[a.14 RCCD]{a.14 RCCD: Cost of capital for consumer durables}
<<variable RCCD>>=
RCCD = Cost of capital for consumer durables
@ %def RCCD
<<equation rccd>>=
rccd: rccd - rccd_aerr = (@recode((100*jrcd + rcar - zpi5)>( .01),100*jrcd + rcar - zpi5, .01))
@ %def rccd
\subsection[a.15 RCCH]{a.15 RCCH: Cost of capital for residential investment}
<<variable RCCH>>=
RCCH = Cost of capital for residential investment
@ %def RCCH
<<equation rcch>>=
rcch: rcch - rcch_aerr = (@recode((100*jrh + (1-trfpm/100)*(rme+100*trspp) - zpi10)>( .1),100*jrh + (1-trfpm/100)*(rme+100*trspp) - zpi10, .1))
@ %def rcch
\subsection[a.16 JKCD]{a.16 JKCD: Consumption of fixed capital, consumer durables}
<<variable JKCD>>=
JKCD = Consumption of fixed capital, consumer durables
@ %def JKCD
<<equation jkcd>>=
jkcd: jkcd - jkcd_aerr = jrcd * kcd(-1)
@ %def jkcd
\subsection[a.17 EC]{a.17 EC: Consumption, cw 2009\$ (FRB/US definition)}
<<variable EC>>=
EC = Consumption, cw 2009$ (FRB/US definition)
@ %def EC
<<equation ec>>=
ec: log(ec) - ec_aerr = log(ec(-1)) + _
.5 * (pcor*pcnia*eco/(ec*pcnia) _
+ pcor(-1)*pcnia(-1)*eco(-1)/(ec(-1)*pcnia(-1))) _
* d(log(eco), 0, 1) _
+ .5 * (pchr*pcnia*ech/(ec*pcnia) _
+ pchr(-1)*pcnia(-1)*ech(-1)/(ec(-1)*pcnia(-1))) _
* d(log(ech), 0, 1) _
+ .5 * ((pcdr*pcnia*yhpcd+pcdr*pcnia*jkcd)/(ec*pcnia) _
+ (pcdr(-1)*pcnia(-1)*yhpcd(-1)+pcdr(-1)*pcnia(-1)*jkcd(-1))/(ec(-1)*pcnia(-1))) _
* d(log(yhpcd+jkcd), 0, 1)
@ %def ec
\subsection[a.18 YHPCD]{a.18 YHPCD: Imputed income of the stock of consumer durables, 2009\$}
<<variable YHPCD>>=
YHPCD = Imputed income of the stock of consumer durables, 2009$
@ %def YHPCD
<<equation yhpcd>>=
yhpcd: log(yhpcd) - yhpcd_aerr = log(y_yhpcd(1)) + log(kcd(-1))
@ %def yhpcd
<<coefficient y{\_}yhpcd>>=
y_yhpcd 1 0.053750000000000000E+00
@ %def y_yhpcd
\section{Business Expenditures}
\subsection[b.1 EPD]{b.1 EPD: Investment in equipment, cw 2009\$}
<<variable EPD>>=
EPD = Investment in equipment, cw 2009$
@ %def EPD
<<equation epd>>=
epd: d( log(epd), 0, 1 ) - epd_aerr = _
( y_epd(1)*(log(qepd(-2)/epd(-2))) _
+ ( y_epd(2) * d( log(epd(-1)), 0, 1 ) + y_epd(3) * d( log(epd(-2)), 0, 1 )) _
+ zxbd(-1) _
+ zvpd(-1) )*(1-y_epd(4)) _
+ y_epd(4) * (d( log(xbo(-1)), 0, 1 ) + hgvpd(-1))
@ %def epd
<<coefficient y{\_}epd>>=
y_epd 4 0.1639648722427122,0.4446158979500308,0.3699597791648127,0.5
@ %def y_epd
\subsection[b.2 EPI]{b.2 EPI: Investment in intellectual property, cw 2009\$}
<<variable EPI>>=
EPI = Investment in intellectual property, cw 2009$
@ %def EPI
<<equation epi>>=
epi: d( log(epi), 0, 1 ) - epi_aerr = _
( y_epi(1)*(log(qepi(-2)/epi(-2))) _
+ ( y_epi(2) * d( log(epi(-1)), 0, 1 ) + y_epi(3) * d( log(epi(-2)), 0, 1 )) _
+ zxbi(-1) _
+ zvpi(-1) )*(1-y_epi(4)) _
+ y_epi(4) * d( log(xbo(-1)), 0, 1 )
@ %def epi
<<coefficient y{\_}epi>>=
y_epi 4 0.01211724517486588,0.6819035622357826,0.1766782129232528,0.212294527301806
@ %def y_epi
\subsection[b.3 EPS]{b.3 EPS: Investment in nonresidential structures, cw 2009\$}
<<variable EPS>>=
EPS = Investment in nonresidential structures, cw 2009$
@ %def EPS
<<equation eps>>=
eps: d( log(eps), 0, 1 ) - eps_aerr = _
(y_eps(1) * log(qeps(-2)/eps(-2)) _
+ ( y_eps(2) * d( log(eps(-1)), 0, 1 ) + y_eps(3) * d( log(eps(-2)), 0, 1 )) _
+ zxbs(-1) _
+ zvps(-1)) * (1-y_eps(4)) _
+ y_eps(4) * (d( log(xbo(-1)), 0, 1 )) _
+ y_eps(5) * d01q4
@ %def eps
<<coefficient y{\_}eps>>=
y_eps 5 0.06660965676110558,0.5425646472109228,0.3261733908091358,0.5,-0.09697975834849955
@ %def y_eps
\subsection[b.4 KI]{b.4 KI: Stock of private inventories, cw 2009\$}
<<variable KI>>=
KI = Stock of private inventories, cw 2009$
@ %def KI
<<equation ki>>=
ki: d( log(ki), 0, 1 ) - ki_aerr _
= y_ki(5) _
+ y_ki(1) * (log(qkir) - log(ki(-1)/xfs(-1))) _
+ y_ki(2) * (d( log(ki(-1)), 0, 1 ) - y_ki(5)) _
+ y_ki(3) * d( log(xfs(-1)), 0, 1 ) _
+ y_ki(4) * d( log(xfs(-2)), 0, 1 )
@ %def ki
<<coefficient y{\_}ki>>=
y_ki 5 0.01679108530917215,0.451650730999944,0.2617948535758293,0.2865544154242267,-0.001309818569766082
@ %def y_ki
\subsection[b.5 EI]{b.5 EI: Change in private inventories, cw 2009\$}
<<variable EI>>=
EI = Change in private inventories, cw 2009$
@ %def EI
<<equation ei>>=
ei: ei - ei_aerr = 4*d( ki, 0, 1 )
@ %def ei
\subsection[b.6 QEPD]{b.6 QEPD: Desired level of investment in equipment}
<<variable QEPD>>=
QEPD = Desired level of investment in equipment
@ %def QEPD
<<equation qepd>>=
qepd: log(qepd) - qepd_aerr = y_qepd(1) _
+ y_qepd(2) * log(xbo) _
+ y_qepd(3) * log(vpd) _
+ y_qepd(4) * log(hgx/100 + jrpd )
@ %def qepd
<<coefficient y{\_}qepd>>=
y_qepd 4 0,1.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
@ %def y_qepd
\subsection[b.7 QEPS]{b.7 QEPS: Desired level of investment in structures}
<<variable QEPS>>=
QEPS = Desired level of investment in structures
@ %def QEPS
<<equation qeps>>=
qeps: log(qeps) - qeps_aerr = y_qeps(1) _
+ y_qeps(2) * log(xbo) _
+ y_qeps(3) * log(vps) _
+ y_qeps(4) * log(hgx/100 + jrps )
@ %def qeps
<<coefficient y{\_}qeps>>=
y_qeps 4 0,1.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
@ %def y_qeps
\subsection[b.8 QEPI]{b.8 QEPI: Desired level of investment in intellectual property}
<<variable QEPI>>=
QEPI = Desired level of investment in intellectual property
@ %def QEPI
<<equation qepi>>=
qepi: log(qepi) - qepi_aerr = y_qepi(1) _
+ y_qepi(2) * log(xbo) _
+ y_qepi(3) * log(vpi) _
+ y_qepi(4) * log(hgx/100 + jrpi )
@ %def qepi
<<coefficient y{\_}qepi>>=
y_qepi 4 0,1.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
@ %def y_qepi
\subsection[b.9 QKIR]{b.9 QKIR: Desired Inventory Sales Ratio}
<<variable QKIR>>=
QKIR = Desired Inventory Sales Ratio
@ %def QKIR
<<equation qkir>>=
qkir: log(qkir) - qkir_aerr = (1-dglprd)*y_qkir(1) + log(qkir(-1))
@ %def qkir
<<coefficient y{\_}qkir>>=
y_qkir 1 -0.001885366737710053
@ %def y_qkir
\subsection[b.10 KPD]{b.10 KPD: Capital stock - Equipment, 2009\$}
<<variable KPD>>=
KPD = Capital stock - Equipment, 2009$
@ %def KPD
<<equation kpd>>=
kpd: kpd - kpd_aerr = 0.25 * epd + (1-jrpd/4) * kpd(-1)
@ %def kpd
\subsection[b.11 KPI]{b.11 KPI: Capital Stock - Intellectual Property, 2009\$}
<<variable KPI>>=
KPI = Capital Stock - Intellectual Property, 2009$
@ %def KPI
<<equation kpi>>=
kpi: kpi - kpi_aerr = 0.25 * epi + (1-jrpi/4) * kpi(-1)
@ %def kpi
\subsection[b.12 KPS]{b.12 KPS: Capital stock - nonresidential structures, 2009\$}
<<variable KPS>>=
KPS = Capital stock - nonresidential structures, 2009$
@ %def KPS
<<equation kps>>=
kps: kps - kps_aerr = 0.25 * eps + (1-jrps/4) * kps(-1)
@ %def kps
\subsection[b.13 HKS]{b.13 HKS: Growth rate of KS, cw 2009\$ (compound annual rate)}
<<variable HKS>>=
HKS = Growth rate of KS, cw 2009$ (compound annual rate)
@ %def HKS
<<equation hks>>=
hks: hks - hks_aerr = 400 * (ykpdn * d( log(kpd), 0, 1 ) _
+ ykpsn * d( log(kps), 0, 1 ) + ykin * d( log(ki), 0, 1 )) / _
(ykpdn + ykpsn + ykin) + hksr
@ %def hks
\subsection[b.14 KS]{b.14 KS: Capital services, 2009 \$}
<<variable KS>>=
KS = Capital services, 2009 $
@ %def KS
<<equation ks>>=
ks: log(ks) - ks_aerr = log(ks(-1)) + hks/400
@ %def ks
\subsection[b.15 RPD]{b.15 RPD: After-tax real financial cost of capital for business investment}
<<variable RPD>>=
RPD = After-tax real financial cost of capital for business investment
@ %def RPD
<<equation rpd>>=
rpd: rpd - rpd_aerr = 0.5*(7.2 + (1-trfcim)*(rg5e + rbbbe- rg10e) - zpib5) + 0.5*req
@ %def rpd
\subsection[b.16 RTPD]{b.16 RTPD: User cost of capital for equipment}
<<variable RTPD>>=
RTPD = User cost of capital for equipment
@ %def RTPD
<<equation rtpd>>=
rtpd: rtpd - rtpd_aerr = (.01*rpd + jrpd - .01*hgpdr) _
* ((1-.01*tapdt-trfcim*(1-tapddp*.01*tapdt)*tapdd)/(1-trfcim)) _
* ( ( pxp*pkpdr + pxp(-1)*pkpdr(-1)) /2)/pxb
@ %def rtpd
\subsection[b.17 RTPI]{b.17 RTPI: User cost of capital for intellectual property}
<<variable RTPI>>=
RTPI = User cost of capital for intellectual property
@ %def RTPI
<<equation rtpi>>=
rtpi: rtpi - rtpi_aerr = (.01*rpd + jrpi - .01*hgpir) _
* ( ( pxp*ppir + pxp(-1)*ppir(-1)) /2)/pxb
@ %def rtpi
\subsection[b.18 RTPS]{b.18 RTPS: User cost of capital for nonresidential structures}
<<variable RTPS>>=
RTPS = User cost of capital for nonresidential structures
@ %def RTPS
<<equation rtps>>=
rtps: rtps - rtps_aerr = (@recode(((.01*rpd + jrps - .01*hgppsr) _
* ((1-trfcim*tapsda)/(1-trfcim)) _
* ( ( pxp*ppsr + pxp(-1)*ppsr(-1)) /2)/pxb)>( .02),(.01*rpd + jrps - .01*hgppsr) _
* ((1-trfcim*tapsda)/(1-trfcim)) _
* ( ( pxp*ppsr + pxp(-1)*ppsr(-1)) /2)/pxb, .02))
@ %def rtps
\subsection[b.19 RTINV]{b.19 RTINV: User cost of capital for inventories}
<<variable RTINV>>=
RTINV = User cost of capital for inventories
@ %def RTINV
<<equation rtinv>>=
rtinv: rtinv - rtinv_aerr = (.01*rpd - .01*hgpkir) _
* ( ( pxp*pkir + pxp(-1)*pkir(-1)) /2)/pxb
@ %def rtinv
\subsection[b.20 VPD]{b.20 VPD: Desired equipment-output ratio}
<<variable VPD>>=
VPD = Desired equipment-output ratio
@ %def VPD
<<equation vpd>>=
vpd: vpd - vpd_aerr = uvpd*(pkpdr/ppdr)/rtpd
@ %def vpd
\subsection[b.21 VPI]{b.21 VPI: Desired intellectual property-output ratio}
<<variable VPI>>=
VPI = Desired intellectual property-output ratio
@ %def VPI
<<equation vpi>>=
vpi: vpi - vpi_aerr = uvpi/rtpi
@ %def vpi
\subsection[b.22 VPS]{b.22 VPS: Desired structures-output ratio}
<<variable VPS>>=
VPS = Desired structures-output ratio
@ %def VPS
<<equation vps>>=
vps: vps - vps_aerr = uvps/rtps
@ %def vps
\subsection[b.23 HGVPD]{b.23 HGVPD: Trend Growth of VPD}
<<variable HGVPD>>=
HGVPD = Trend Growth of VPD
@ %def HGVPD
<<equation hgvpd>>=
hgvpd: hgvpd - hgvpd_aerr = y_hgvpd(1) * hgvpd(-1) _
+ y_hgvpd(2) * log(vpd/vpd(-1))
@ %def hgvpd
<<coefficient y{\_}hgvpd>>=
y_hgvpd 2 0.97,0.03
@ %def y_hgvpd
\subsection[b.24 HGVPS]{b.24 HGVPS: Trend growth rate of VPS}
<<variable HGVPS>>=
HGVPS = Trend growth rate of VPS
@ %def HGVPS
<<equation hgvps>>=
hgvps: hgvps - hgvps_aerr = y_hgvps(1) * hgvps(-1) _
+ y_hgvps(2) * log(vps/vps(-1))
@ %def hgvps
<<coefficient y{\_}hgvps>>=
y_hgvps 2 0.97,0.03
@ %def y_hgvps
\subsection[b.25 EPDN]{b.25 EPDN: Investment in equipment, current \$}
<<variable EPDN>>=
EPDN = Investment in equipment, current $
@ %def EPDN
<<equation epdn>>=
epdn: epdn - epdn_aerr = 0.01*ppdr*pxp*epd
@ %def epdn
\subsection[b.26 EPIN]{b.26 EPIN: Investment in intellectual property, current \$}
<<variable EPIN>>=
EPIN = Investment in intellectual property, current $
@ %def EPIN
<<equation epin>>=
epin: epin - epin_aerr = 0.01*ppir*pxp*epi
@ %def epin
\subsection[b.27 EPSN]{b.27 EPSN: Investment in nonresidential structures, current \$}
<<variable EPSN>>=
EPSN = Investment in nonresidential structures, current $
@ %def EPSN
<<equation epsn>>=
epsn: epsn - epsn_aerr = .01 * ppsr * pxp * eps
@ %def epsn
\subsection[b.28 EIN]{b.28 EIN: Change in business inventories, current \$}
<<variable EIN>>=
EIN = Change in business inventories, current $
@ %def EIN
<<equation ein>>=
ein: ein - ein_aerr = .01*pxp*pkir*ei
@ %def ein
\subsection[b.29 TAPSDA]{b.29 TAPSDA: Present value of depreciation allowances for nonresidential structures}
<<variable TAPSDA>>=
TAPSDA = Present value of depreciation allowances for nonresidential structures
@ %def TAPSDA
<<equation tapsda>>=
tapsda: tapsda - tapsda_aerr = (1-tapsad)*(1-exp(-0.01*(rpd+zpib5)*tapssl))/ _
(0.01*(rpd+zpib5)*tapssl) + _
tapsad*(1-d69) * 2 * _
(1 - (1-exp(-0.01*(rpd+zpib5)*tapssl))/ _
(0.01*(rpd+zpib5)*tapssl)) / (0.01*(rpd+zpib5)*tapssl) _
+ tapsad*(d69-d81) *( (1.5 / _
(1.5 + .01 * tapssl * (rpd + zpib5))) * _
(1 - exp(-0.5-0.33*(0.01*(rpd+zpib5)*tapssl))) + _
(exp(-0.5)/(0.67*(0.01*(rpd+zpib5)*tapssl)))* _
(exp(-0.33*(0.01*(rpd+zpib5)*tapssl)) - _
exp(-(0.01*(rpd+zpib5)*tapssl))) ) _
+ tapsad * (d81-d86) *( (1.75 / _
(1.75 + .01 * tapssl * (rpd + zpib5))) * _
(1 - exp(-0.75-0.428*(0.01*(rpd+zpib5)*tapssl))) + _
(exp(-0.75)/(0.572*(0.01*(rpd+zpib5)*tapssl)))* _
(exp(-0.428*(0.01*(rpd+zpib5)*tapssl)) - _
exp(-(0.01*(rpd+zpib5)*tapssl))) ) _
+ tapsad * d86 * (1-exp(-0.01*(rpd+zpib5)*tapssl))/ _
(0.01*(rpd+zpib5)*tapssl)
@ %def tapsda
\subsection[b.30 TAPDD]{b.30 TAPDD: Present value of depreciation allowances for equipment}
<<variable TAPDD>>=
TAPDD = Present value of depreciation allowances for equipment
@ %def TAPDD
<<equation tapdd>>=
tapdd: tapdd - tapdd_aerr = .5 * d2003 + .5 * d2003 * (2.0 / (2.0 + .01 * tapds * (rpd + zpib5))) _
+ .3 * d2002 + .7 * d2002 * (2.0 / (2.0 + .01 * tapds * (rpd + zpib5))) _
+ (d87 - d2002 - d2003) * (2.0 / (2.0 + .01 * tapds * (rpd + zpib5))) _
+ (d81-d87) * (1.5 / (1.5 + .01 * tapds * (rpd + zpib5))) _
+ (1-d81) _
* (((1-tapdad)*(1-exp(-(.01*tapds*(rpd+zpib5)))) _
/(.01*tapds*(rpd+zpib5))) _
+ tapdad *2*(1-(1-exp(-(.01*tapds*(rpd+zpib5)))) _
/(.01*tapds*(rpd+zpib5))) _
/(.01 * tapds * (rpd + zpib5)))
@ %def tapdd
\subsection[b.31 EGPDIN]{b.31 EGPDIN: Gross private domestic investment}
<<variable EGPDIN>>=
EGPDIN = Gross private domestic investment
@ %def EGPDIN
<<equation egpdin>>=
egpdin: egpdin - egpdin_aerr = epdn + epsn + epin + ehn + ein
@ %def egpdin
\subsection[b.32 HGVPI]{b.32 HGVPI: Trend growth rate of VPI}
<<variable HGVPI>>=
HGVPI = Trend growth rate of VPI
@ %def HGVPI
<<equation hgvpi>>=
hgvpi: hgvpi - hgvpi_aerr = y_hgvpi(1) * hgvpi(-1) _
+ y_hgvpi(2) * log(vpi/vpi(-1))
@ %def hgvpi
<<coefficient y{\_}hgvpi>>=
y_hgvpi 2 0.97,0.03
@ %def y_hgvpi
\section{Foreign Trade}
\subsection[c.1 EX]{c.1 EX: Exports of goods and services, cw 2009 \$}
<<variable EX>>=
EX = Exports of goods and services, cw 2009 $
@ %def EX
<<equation ex>>=
ex: d( log(ex), 0, 1 ) - ex_aerr _
= y_ex(1) _
+ y_ex(2) * log(ex(-1)*(pxr(-1)*pxp(-1)*fpx(-1))/(fgdp(-1)*fpc(-1))) _
+ y_ex(3) * (fxgap - fxgap(-1))/100 _
+ y_ex(4) * (fxgap(-1) - fxgap(-2))/100 _
+ y_ex(5) * ddockx
@ %def ex
<<coefficient y{\_}ex>>=
y_ex 5 0.8118629319610274,-0.1074807087618527,1.38575824141273,1.092856118288064,1.014561010220407
@ %def y_ex
\subsection[c.2 EXN]{c.2 EXN: Exports of goods and services, current \$}
<<variable EXN>>=
EXN = Exports of goods and services, current $
@ %def EXN
<<equation exn>>=
exn: exn - exn_aerr = .01*pxp*pxr*ex
@ %def exn
\subsection[c.3 EMO]{c.3 EMO: Imports of goods and services ex. petroleum, cw 2009\$}
<<variable EMO>>=
EMO = Imports of goods and services ex. petroleum, cw 2009$
@ %def EMO
<<equation emo>>=
emo: d( log(emo), 0, 1 ) - emo_aerr _
= y_emo(1) _
+ y_emo(2) * log(emo(-1)*(pmo(-1)/100)/(uemot(-1)*xgden(-1))) _
+ y_emo(3) * (xgap2-xgap2(-1))/100 _
+ y_emo(4) * (xgap2(-1)-xgap2(-2))/100 _
+ y_emo(5) * log(ddockm) _
+ y_emo(6) * log(ddockm/ddockm(-1))
@ %def emo
<<coefficient y{\_}emo>>=
y_emo 6 0.01701497186817749,-0.1984753225812535,1.352328263830308,1.673976681206801,0.3566283231277721,0.3803113605562196
@ %def y_emo
\subsection[c.4 EMON]{c.4 EMON: Imports of goods and services ex. petroleum}
<<variable EMON>>=
EMON = Imports of goods and services ex. petroleum
@ %def EMON
<<equation emon>>=
emon: emon - emon_aerr = .01 * pmo * emo
@ %def emon
\subsection[c.5 CENG]{c.5 CENG: Consumption of crude energy (oil, coal, natural gas), 2009 \$}
<<variable CENG>>=
CENG = Consumption of crude energy (oil, coal, natural gas), 2009 $
@ %def CENG
<<equation ceng>>=
ceng: d( log(ceng), 0, 1 ) - ceng_aerr = _
y_ceng(1) * (log(ceng(-1))-log(xg(-1)*veoa(-1))) _
+ y_ceng(2) * d( log(xg), 0, 1 ) _
+ y_ceng(3) * d( log(xg(-1)), 0, 1 ) _
+ y_ceng(4) * d( log(ceng(-1)), 0, 1 ) _
+ y_ceng(5) * d( log(veoa(-1)), 0, 1 ) _
+ y_ceng(6) * hgx(-1)/400
@ %def ceng
<<coefficient y{\_}ceng>>=
y_ceng 6 -0.1483451935619194,0.475653118183134,0.5437644321944857,-0.2301598753097478,0.4661713199430116,-0.2554289950108837
@ %def y_ceng
\subsection[c.6 EMP]{c.6 EMP: Petroleum imports, cw 2009\$}
<<variable EMP>>=
EMP = Petroleum imports, cw 2009$
@ %def EMP
<<equation emp>>=
emp: emp - emp_aerr = uemp*(ceng-xeng)
@ %def emp
\subsection[c.7 EMPN]{c.7 EMPN: Petroleum imports, current \$}
<<variable EMPN>>=
EMPN = Petroleum imports, current $
@ %def EMPN
<<equation empn>>=
empn: empn - empn_aerr = .01*pmp*emp
@ %def empn
\subsection[c.8 EMN]{c.8 EMN: Imports of goods and services, current \$}
<<variable EMN>>=
EMN = Imports of goods and services, current $
@ %def EMN
<<equation emn>>=
emn: emn - emn_aerr = emon + empn
@ %def emn
\subsection[c.9 EM]{c.9 EM: Imports of goods and services, cw 2009\$}
<<variable EM>>=
EM = Imports of goods and services, cw 2009$
@ %def EM
<<equation em>>=
em: log(em) - em_aerr = log(em(-1)) _
+ .5 * (emon/emn + emon(-1)/emn(-1)) * d(log(emo), 0, 1) _
+ .5 * (empn/emn + empn(-1)/emn(-1)) * d(log(emp), 0, 1)
@ %def em
\subsection[c.10 FCBN]{c.10 FCBN: US current account balance, current \$}
<<variable FCBN>>=
FCBN = US current account balance, current $
@ %def FCBN
<<equation fcbn>>=
fcbn: fcbn - fcbn_aerr = exn - emn + fynin + fcbrn
@ %def fcbn
\subsection[c.11 FCBRN]{c.11 FCBRN: US current account balance residual, current \$}
<<variable FCBRN>>=
FCBRN = US current account balance residual, current $
@ %def FCBRN
<<equation fcbrn>>=