Friday, February 1, 2019

Time varying parameter estimation with Flexible Least Squares and the tvpuni add-in

Author and guest post by Eren Ocakverdi

Professional life of a researcher who follows or responsible from an emerging market can become so miserable when things suddenly change and the past experience does not hold anymore. As a practitioner you can get used to it over time, but it’s a whole different story when it comes to identifying empirical relationships between market indicators as part of your job.

History can be a really good gauge to understand how such indicators are linked to one another only if you look through a proper glass. Abrupt changes, structural breaks or transition periods may alter such relationships so much that they would be misidentified with those traditional methods where the underlying structure is assumed fixed over the full sample.


EViews already has nice built-in features or add-ins to deal with such cases. Here, I will add another one to this bundle: Meet the tvpuni add-in, which implements “Flexible Least Squares” approach of Kabala and Tesfatsion (1989). 
One way to look at the parameter stability is to allow coefficients to change over time. A well-known approach in this case is treating these parameters as random walk coefficients and estimate them within a state space framework via Kalman filter. However, estimation of such models can be troublesome in practice due to various reasons and may become a very frustrating experience if you have to deal with convergence problems .

Flexible least squares emerges as a useful alternative, since it makes fewer assumptions than Kalman filter and allows us to determine the degree of smoothness. Help file explains the use of this add-in, so I’ll proceed with demonstrating its abilities through an actual case study.

Turkey’s disinflation process since the aftermath of 2001 crisis was interrupted from time to time due to shocks and stresses originating from different sources. Raw materials constitute more than 70% of the total imports (or 20% of GDP) in Turkish economy making her especially vulnerable to developments in exchange rates and prices of imported goods (i.e. crude oil). Although Turkey has been an (explicit) inflation targeter since 2006, frequently overshooting the target has made it very difficult for central bank to anchor expectations and weakened its hand in fight against inflation persistence.

Following example considers an augmented version of Phillips curve for exploring the determinants of inflation dynamics.

'create a workfile
wfcreate m 2003 2018

'get the data (retrieve from Bloomberg or open :\tvpuni_data.wf1)
dbopen(type=bloom) index  'open database
copy index::"tucxue index" corecpi  'Core Consumer Price Index (2003=100)
copy index::"tues01eu index" infexp12  'Inflation expectations over the next 12 months
copy index::"trtfimvi index" imprice  'Foreign trade import unit value index (2010=100)
copy index::"tuiosa" ipi  'Industrial Production Index (SA, 2015=100)
copy index::"usdtry curncy" usdtry  'Exchange rate

‘dependent variable
series coreinf = @pcy(corecpi) 'core inflation (excl. unprocessed food, alcoholic beverages and tobacco)

‘generate some regressors
series impinf = @pcy(imprice*usdtry) 'inflationary pressure from import prices (converted to local currency)
hpf(power=4) log(ipi)*100 trend @ gap 'output gap proxy

'simple fixed parameter estimation
equation fixed.ls coreinf infexp12 coreinf(-1) gap impinf

Results suggest that backward indexation matters more than forward looking in price setting. Output gap and import prices both have expected signs. All the coefficients are significant at conventional alpha levels. Explanatory power of the model is more than satisfactory, but we are interested in the stability of this relationship.

'time varying parameter estimation with flexible least squares
fixed.tvpuni(method="1",lambda="100",savem)
'plot results

grbetam.line(m)



Results suggest that the coefficient of forward looking has risen, whereas the coefficient of backward indexation has fallen over time and they have become more-or-less equal. Fluctuation around zero makes the coefficient of output gap unreliable and difficult to interpret. Passthrough from import prices, on the other hand, seems to be on the rise since 2016.

Behavioral change in coefficients around 2008 should be an easy one as it can be attributed to global financial crisis. However, it may not be that straightforward to explain the dynamics after the end-2010. This era until the first half of 2018 denotes when Central Bank of Turkey implemented an unconventional monetary policy (i.e. an asymmetric and wide interest rate corridor). 

An approximating model of flexible least squares approach within a state space framework is possible and may be preferable depending on the case at hand. Although the results would not be the same due to different assumptions behind these frameworks, you can get smoothed estimates of coefficients along with their associated confidence bands.

'flexible least squares estimation with Kalman filter
fixed.tvpuni(method="3",lambda="100",savem,saves)

We can plot the results manipulating the output saved in to the workfile with a little bit effort:

Note that the confidence band around the coefficient of output gap reveals the insignificance of this parameter as suspected.

Add-in also allows you to migrate your original model to state space and to estimate each parameter as a random walk via Kalman filter.

'state space estimation with Kalman filter
fixed.tvpuni(method="4",savem,saves)

Again, we can compare estimated parameters if we organize our output: 
Results from all three approaches portray similar patterns and therefore yield similar inferences. 

References
Kalaba, R. and Tesfatsion, L., 1989. "Time Varying Linear Regression via Flexible Least Squares", Computers and Mathematics with Applications, Vol. 17, pp. 1215-1245

2 comments:

  1. Thank you for this guys, thanks Eren; brilliant!

    ReplyDelete
  2. This is so nice, is there a way to add confidence intervals to the time varying coefficients in method 1

    ReplyDelete