Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Jun YU
March 2, 2015
Background Reading
1. Previous lecture notes on factor models in nance.
s1,t , s2,t , sK ,t
The dynamics of the three series are very similar with the autocorrelations
slowly decaying at an exponential rate. This suggests that a single factor
could potentially capture the autocorrelation in all three yields.
=0
st = vt
yt = st + ut
st = st 1 + vt
y t jt 1 = Et 1 [yt ]
with variance
2
V t jt 1 = E (yt y t jt 1)
s t jt 1 = Et 1 [ st ]
with variance
2
P t jt 1 = E (st s t jt 1)
s t j t = Et [ s t ]
with variance h i
2
P t jt = E st s t jt
For the 1-factor model the Kalman lter equations are summarized as
Prediction: s t jt 1= s t 1 jt 1
2
P t jt 1 = P t 1 jt 1 +1
Observation: y t jt 1= s t jt 1
2
V t jt 1 = P t jt 1 + 2
P t jt 1
Updating: s t jt = s t jt 1 + ( yt y t jt 1)
V t jt 1
2 P 2t jt 1
P t jt = P t jt 1
V t jt 1
s 1 j0 , P 1 j0 .
s 1 j0 = 0
Prediction: s 1 j0 = 0.1
1 1
(initialization) P 1 j0 = = = 2.7778
1 2 1 0.82
P 1 j0
Updating: s 1 j1 = s 1 j0 + (y1 y 1 j0 )
V 1 j0
0.5 2.7778
s 1 j1 = 0.1 + (2 0.05) = 3.9444
0.7045
2 P 21 j0
P 1 j1 = P 1 j0
V 1 j0
0.52 2.77782
P 1 j1 = 2.7778 = 0.0396
0.7045
Intuitively, the initial estimate of 0.1 for the factor at t = 1, results in an
underestimate of the observed variable, 0.05 < 2. By updating the
estimate of the factor to 3.9444 this yields a better estimate of y1 .
Jun YU () ECON671 Factor Models: Kalman Filters March 2, 2015 14 / 68
The Kalman Filter
The Univariate Model
Prediction: s 2 j1 = s 1 j1
s 2 j1 = 0.8 3.9444 = 3.1555
P 2 j1 = 2 P 1 j1 + 1
P 2 j1 = 0.82 0.0396 + 1 = 1.0253
Observation: y 2 j1 = s 2 j1
y 2 j1 = 0.5 3.1555 = 1.5778
V 2 j1 = 2 P 2 j1 + 2
V 2 j1 = 0.52 1.0253 + 0.12 = 0.2663
P 2 j1
Updating: s 2 j2 = s 2 j1 + (y2 y 2 j1 )
V 2 j1
0.5 1.0253
s 2 j2 = 3.1555 + (5 1.5778) = 9.7435
0.2663
2 P 22 j1
P 2 j2 = P 2 j1
V 2 j1
0.52 1.02532
P 2 j2 = 1.0253 = 0.03840
0.2663
or in matrix notation
2 3 2 3 2 3 2 3
y1,t 1 1,1 1,2 u1,t
4 y2,t 5 = 4 2 5 + 4 s1,t
2,1 2,2 5 + 4 u2,t 5
s2,t
y3,t 3 3,1 3,2 u3,t
s1,t 1,1 0 s1,t 1 v1,t
= +
s2,t 0 2,2 s2,t 1 v2,t
Jun YU () ECON671 Factor Models: Kalman Filters March 2, 2015 17 / 68
The Kalman Filter
The Multivariate Model
Observation: y t jt 1= Bst jt 1
0
V t jt 1 = BP t jt 1 B + R
The formulae for the multivariate version of the Kalman lter contain
the univariate formulae with N = K = 1.
Q=I
= fA, B, , R, Q g
yt s N (y t jt 1 , V t jt 1 )
One-step-ahead : s t jt 1 = Et 1 [st ]
Filtered : s t jt = Et [st ]
Smoothed : s t jT = ET [ s t ]
Using EViews
1. The one-step-ahead estimate of the factor s t jt 1 = Et 1 [ st ]
24
20
16
12
-4
-8
-12
1975 1980 1985 1990 1995 2000 2005
Source: kalman_exante.wf1
Jun YU () ECON671 Factor Models: Kalman Filters March 2, 2015 27 / 68
Estimating the Ex Ante Real Interest Rate
But it is the ex ante real interest rate that is important in nance and
economics as it provides a measure of the real return on an asset
between the present and the future.
rte = it et
R = EURO_1MTH INF
This is the ex post real interest rate given in the previous Figure.
60
Series: R
Sample 1971M01 2009M12
50 Observations 467
40
Mean 2.173661
Median 2.258335
Maximum 25.28643
30 Minimum -10.85508
Std. Dev . 4.333232
Skewness 0.376376
20
Kurtosis 4.984465
10 Jarque-Bera 87.65467
Probability 0.000000
0
-10 -5 0 5 10 15 20 25
Source: kalman_exante.wf1
Here the average real ex post interest rate is 2.174% p.a. over the
sample period.
Source: kalman_exante.wf1
rt = + st + ut , ut N 0, 2u [Signal equation]
st = st 1 + vt , vt N 0, 2v [State equation]
Source: kalman_exante.wf1
Source: kalman_exante.wf1
st = it et
rte = it et = st +
rte = b
b s t jt 1 +b
The estimate of the ex ante real interest rate (b rte ) and the ex post
real interest rate (rt ) are compared in the following Figure.
28
RE_HAT
24 R
20
16
12
-4
-8
-12
1975 1980 1985 1990 1995 2000 2005
Source: kalman_exante.wf1
30
20
10
-10
-20
INFE_HAT
INF
-30
1975 1980 1985 1990 1995 2000 2005
Source: kalman_exante.wf1
.06
.04
.02
.00
-.02
-.04
-.06
1980 1985 1990 1995 2000 2005 2010
Source: stochastic_volatility.wf1
6,000
Series: R
Sample 1/02/1979 2/13/2014
5,000 Observations 12826
4,000
Mean -5.89e-19
Median 1.60e-05
Maximum 0.046453
3,000 Minimum -0.039584
Std. Dev. 0.005238
Skewness -0.029699
2,000 Kurtosis 9.845047
1,000
Jarque-Bera 25041.80
Probability 0.000000
0
-0.0375 -0.0250 -0.0125 0.0000 0.0125 0.0250 0.0375
Source: stochastic_volatility.wf1
where yt = log rt2 , the natural logarithm of the squared exchange rate.
The variable yt is constructed using Genr in EViews.
To generate some starting values the following AR(1) model is
estimated
yt = 1 + 2 yt 1 + wt
where wt N 0, 2w .
Source: stochastic_volatility.wf1
Source: stochastic_volatility.wf1
where
Source: stochastic_volatility.wf1
b
st
bt = exp
2
b
s t jT
bt = exp
2
.05
.04
.03
.02
.01
.00
1980 1985 1990 1995 2000 2005 2010
Source: stochastic_volatility.wf1
7,000
Series: SIG_HAT
6,000
Sample 1/02/1979 2/13/2014
Observations 12827
5,000 Mean 0.003846
Median 0.002580
4,000 Maximum 0.043691
Minimum 4.56e-05
3,000 Std. Dev. 0.004388
Skew ness 1.779310
Kurtosis 8.778992
2,000
Jarque-Bera 24617.43
1,000 Probability 0.000000
0
0.00 0.01 0.02 0.03 0.04
Source: stochastic_volatility.wf1
Factor models are widely used in nance to model the term structure
of interest rates. An important example is Cox, Ingersoll and Ross
(1985) who derive a 1-factor model of the term structure of interest
rates where the unoserved factor is the instantaneous interest rate.
Consider the following one-factor model of the term structure of
interest rates
ri ,t = i + i st + ui ,t , i = 1, 2, ,9
st = st 1 + vt
ui ,t N 0, 2i , vt N (0, 1)
i , i , 2i = 0.1
= 0.9
Source: yields_us.wf1
Source: yields_us.wf1
ln L b
= 121.2888
60
S
2 RMSE
40
20
-20
-40
-60
2001 2002 2003 2004 2005 2006 2007 2008 2009 2010
Source: yields_us.wf1
The condence interval for the initial estimate of the factor is very
wide representing a lack of information at this point in time. The
condence interval quickly narrows showing that the estimates for
later points in time are more precise.
The factor is relatively at in the rst part of the period, then rises
reaching a peak around by the end of 2006. As the loadings of the
factor are relatively larger on the smaller maturities than the longer
maturities, this increase in the factor is associated with a narrowing of
the spreads.
From about mid-2007 the factor falls resulting in a widening of
spreads, which eventually stabilize from 2009 onwards.
yi , t j t 1 i + b
=b i s t jt 1
This gure further highlights how the estimated factor follows the
shorter maturities very closely, while the longer maturities tend to
exhibit additional dynamics suggesting the need for a second factor.
4 4 4
2
2 2
4 0 4
4
0 0
-2 2
2
0 -4 -2
0 -2
0
Std. Residuals Std. Residuals Std. Residuals
Actual -2 Actual -2 Actual
-4
Predicted Predicted Predicted
-4 -4
2002 2004 2006 2008 2010 2002 2004 2006 2008 2010 2002 2004 2006 2008 2010
5 5
4
4
4
4 4 3 4
2
3
2 2 2 2
0 1 2
0 0 0
Std. Residuals Std. Residuals Std. Residuals
-2 Actual -2 Actual -2 Actual
Predicted Predicted Predicted
-4 -4 -4
2002 2004 2006 2008 2010 2002 2004 2006 2008 2010 2002 2004 2006 2008 2010
Source: yields_us.wf1
An AR(2) Model of st
Suppose that the latent factor is an AR (2) process
st = 1 st 1 + 2 st 2 + vt
This equation can be written as a vector AR (1) model
st 1 2 st 1 vt
= +
st 1 1 0 st 2 0
The Kalman lter proceeds as before except now there are two
factors, st and st 1 , with
1 2
=
1 0
To accommodate the additional lag the signal equation becomes
yt = 0 st + ut
st 1
Jun YU () ECON671 Factor Models: Kalman Filters March 2, 2015 62 / 68
Maximum Likelihood Estimator
Using EViews
Consider estimating a one-factor model of the spread between the
one-year yield and the one-month yield
YIELD_Y 1t YIELD_M1t = + st + ut , ut N 0, 2
st = 1 st 1 + 2 st 2 + vt vt N (0, 1)
The EViews window to estimate the model is given below.
Source: yields_us.wf1
Note that the second factor s2, represents the lag of the rst factor
s1, and thus does not have a disturbance term.
Jun YU () ECON671 Factor Models: Kalman Filters March 2, 2015 63 / 68
Extensions
Dynamics
An AR(p) Model of st
Consider an AR (p ) model of st
st = 1 st 1 + 2 st 2 + + p st p + vt
The state equation is written as
2 3 2 32 3 2 3
st 1 2 p 1 p st 1 vt
6 st 1 7 6 1 0 0 0 76 st 7 6 0 7
6 7 6 76 2 7 6 7
6 st 2 7 6 0 1 0 0 76 st 7 6 0 7
6 7=6 76 3 7+6 7
6 .. 7 6 .. .. .. .. .. 76 .. 7 6 .. 7
4 . 5 4 . . . . . 54 . 5 4 . 5
st p +1 0 0 1 0 st p 0
In this case, the model is viewed as having p factors
f st , st 1, , st p +1 g
although it is really just the rst element of this set of factors that is
of interest.
Jun YU () ECON671 Factor Models: Kalman Filters March 2, 2015 64 / 68
Extensions
Dynamics
Idiosyncratic Dynamics
Consider the model
yi ,t = i st + i ui ,t , i = 1, 2, ,4
st = 1 st 1 + 2 st 2 + vt
ui ,t = i ui ,t 1 + wi ,t
where ui ,t s N (0, I ) and wi ,t s N (0, I ).
The state equation is now augmented to accommodate the dynamics
in the idiosyncratic terms.
2 3 2 32 3 2 3
st 1 2 0 0 0 0 st 1 vt
6 st 1 7 6 1 0 0 0 0 0 7 6 st 2 7 6 0 7
6 7 6 76 7 6 7
6 u1,t 7 6 0 0 1 0 0 0 7 6 u1,t 1 7 6 w1,t 7
6 7=6 76 7+6 7
6 u2,t 7 6 0 0 0 2 0 0 7 6 u2,t 1 7 6 w2,t 7
6 7 6 76 7 6 7
4 u3,t 5 4 0 0 0 0 3 0 5 4 u3,t 1 5 4 w3,t 5
u4,t 0 0 0 0 0 4 u4,t 1 w4,t
Jun YU () ECON671 Factor Models: Kalman Filters March 2, 2015 65 / 68
Extensions
Dynamics
R=0
yt = Bst
st = st 1 + vt , vt s N (0, I )