To visualise the formula: $$Y=C+I+G+NX$$

I downloaded the FED data and plotted it, only to discover the two curves progressively diverge (see chart below).

What am I missing?

thank you!

$Y$ = https://fred.stlouisfed.org/series/GDP

$C$ = https://fred.stlouisfed.org/series/PCE

$I$ = https://fred.stlouisfed.org/series/BOGZ1FA105050005Q

$G$ = https://fred.stlouisfed.org/series/W068RCQ027SBEA

$NX$ = https://fred.stlouisfed.org/series/BOPGSTB

enter image description here


1 Answer 1


It is because you are using wrong data, in fact the two series you plot never overlap save for some crossing points, and given you are using wrong datasets its actually weird why they follow each other so close at the beginning in the first place (although probably it is just optical illusion due to scaling).

If you are using Gross Domestic Product (GDP) dataset for Y the correct datasets for components of Y are:

C = Personal Consumption Expenditures (PCEC)

I = Gross Private Domestic Investment (GPDI)

G = Government Consumption Expenditures and Gross Investment (GCE)

NX = Net Exports of Goods and Services (NETEXP)

Once you use correct dataset you get perfect match like a glove (I forgot to add legend in ggplot, red is GDP and blue is C+I+G+NX), you see purple line due to perfect overlap:

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.