' Program: Skew.prg (FOR TABLE 5 IN THE ARTICLE)
' Program that generates tables where Skewness 
' is dependent and OF is independent variable.

' Set path
' Program is supposed to reside in top-directory of UIP-project
%path = @runpath
cd %path


' Currencies

smpl @first 2007m04

for !i = 1 to 1 ' drop GBP
' Create macro-variable to identify currency
%Ccy = names(1,!i)
'maturites
for !j = 1 to 4
' Identify maturity
%Htext = names(3,!j)
scalar L = @val(%htext)
equation tempeq.gmm(b=a)  (skew{%ccy}{%htext}) c @MOVSUM((tmpOFN{%ccy}(-L)/@STDEV(tmpOFN{%ccy})),L)/100 tmpFD{%ccy}{%Htext}(-L) iv{%ccy}{%Htext}(-L)/100 @ c @MOVSUM((tmpOFN{%ccy}(-L)/@STDEV(tmpOFN{%ccy})),L)/100 tmpFD{%ccy}{%Htext}(-L) iv{%ccy}{%Htext}(-L)/100
table skew1
skew1(1,2*!i+!i-0) = %Ccy
skew1(2,2*!i+!i-1) = "tmpOFN"
skew1(2,2*!i+!i-0) = "tmpFD"
skew1(2,2*!i+!i+1) = "IV"
skew1(2*!j+1,1) = %Htext
skew1(2*!j+1,2*!i+!i-1) =  tempeq.@coefs(2)
skew1(2*!j+2,2*!i+!i-1) = tempeq.@tstats(2)
skew1(2*!j+1,2*!i+!i+0) = tempeq.@coefs(3)
skew1(2*!j+2,2*!i+!i+0) = tempeq.@tstats(3)
skew1(2*!j+1,2*!i+!i+1) = tempeq.@coefs(4)
skew1(2*!j+2,2*!i+!i+1) = tempeq.@tstats(4)
'delete tempeq
next
next
show skew1