• Home
  • Blog
  • How to create a graph and calculate the standard deviation for GDP, consumption, and investment for each of the time periods present in the excel file sheet attached.

How to create a graph and calculate the standard deviation for GDP, consumption, and investment for each of the time periods present in the excel file sheet attached.

0 comments

The purpose is to calculate the co-movement and volatility of consumption and investment relative to GDP, all measured in real terms. You will use table attached starting in 1960:Q1 to the latest available year at a quarterly frequency. The smoothing parameter λ (lambda) for quarterly data is 1,600.

Filter and report the correlation and volatility of the cyclical components of GDP, consumption, and investment over time.

To create the graph follow these steps:

  1. Use the quarterly data that is attached for GDP, consumption, and investment for the period 1960:Q1 to latest available.
  2. Use the HP-filter to calculate the trend of the three variables for the whole period, and then for the periods 1960-83; 1984-2007; and 2008 to latest available. Use a value of 1,600 for lambda.
  3. De-trend the original series and plot the three variables in the SAME graph for the entire sample period; then calculate the standard deviation of the cyclical component of GDP, consumption, and investment for each of the periods and present in a table.

Instructions for number 2 above:

  1. Download the excel add-in for the HP-filter.

http://ideas.repec.org/c/dge/qmrbcd/165.html (Links to an external site.)

  1. Make sure that the HPFilter.xla file is in the same directory as where you are going to save your excel file. Double click on HPFilter.xla to launch it in Excel and make sure to enable macros. This should enable the HP-Filter function. You will always have to first start the macro every time you use the workfile (in that order).
  2. Transpose the variables into columns and then take the natural log of each of the variables [the Excel function is =ln( )].
  3. HP-filter the natural log of each variable, the function in Excel is: HP(timeseries to be filtered, value for lambda). This is an array formula (columns).

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}