Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Applied Time Series Analysis

Programming assignment No. 1


Tasks:

1) Download the time series for quarterly seasonally adjusted German real GDP from the FRED database of the St. Louis Fed and save it as a *.csv file (https://fred.stlouisfed. org/series/CLVMNACSCAB1GQDE).  Load the data into Python and provide a time series plot of the raw series.

2) Write a function that performs some standard transformations (i.e. log, first differences of logs, first differences, seasonal differences, seasonal differences of logs) on a user-specified time series. Using the GDP data from 1), create plots for the quarterly and yearly growth rates of real GDP.

3) Write a function that computes for any time series input the sample autocorrelations and sample partial autocorrelation up to some user-specified lag h. Program a plot of the sample autocorrelations and sample partial autocorrelation for the quarterly and the yearly growth rate of German real GDP. Compare the four plots and explain.

4) Create a function to implement the Hodrick-Prescott(HP)-filter for the log of real German GDP (Hint: Results from problem set 1 may be useful). Provide a plot of the cyclical com- ponent from the HP-filter.

5) Create a function that generates artificial data of an MA(1) process using the data generating


process

yt  = εt + θεt − 1                                                                                                                                                (1)

for t = 2,...,T, where εt  is a normally distributed white noise process with mean 0 and

variance σ2  = 1. The function should take as an input the parameter θ, the time series length T and should return a vector of observations on yt .

Generate two time series for θ = 0.3 and θ = −0.5 with T = 500 observations according to equation (1) and compute the sample autocorrelation and sample partial autocorrelation functions for both time series. Compare your results with the expected patterns of the theo- retical ACFs and PACFs of the processes.