Post on 09-Apr-2022
Regime Switching
β’ We sometimes talk about bull and bear markets
β’ By bull market we mean a market where prices are increasing and where volatility is relatively low
β’ By bear market we mean a market where prices are decreasing and where volatility is relatively high
Regime Switching
β’ So if we would like to model log-returns under the assumption that the market switches between the bull and bear states we let
ππ‘ = πππ’ππ + πππ’ππππ‘, π π‘= ππ’πππππππ + πππππππ‘, π π‘= ππππ
β’ Here π π‘ denotes the state of the market at time π‘ and ππ‘ is i.i.d π 0,1
Regime Switching
β’ Typically we cannot tell what state the market is in but using some filtering techniques and assumptions on the switching mechanism we can estimate switching probabilities, drifts and volatilities
β’ We may assume that the switching between the states is Markovian, i.e. the probability of switching from one state to another depends only on which state the market is in a the time point of switching and not on in which states the market has been in or returns at previous time points
π π π‘|π π‘β1 = π π π‘|π π‘β1, π π‘β2, β¦ , ππ‘β1, ππ‘β2, β¦
Regime Switching
β’ If we denote the market states 0 and 1 we let
π00 = π π π‘ = 0|π π‘β1 = 0 π01 = π π π‘ = 1|π π‘β1 = 0 π10 = π π π‘ = 0|π π‘β1 = 1 π11 = π π π‘ = 1|π π‘β1 = 1
β’ Clearly π00 = 1 β π01 and π11 = 1 β π10
Estimation
β’ So given a series of observations π1, β¦ , ππ we want to estimate the parameters π = π00, π11, π0, π1, π0, π1
β’ Since we cannot tell which state we are in at a given time point it is not obvious how the estimations can be done but we may formally write the likelihood function
πΏ π = π π1|π π π2|π, π1 β―π ππ|π, π1, β¦ , ππβ1
where π is the density of a π ππ , ππ 2 random variable
Estimation
β’ So the contribution of ππ‘ to the log-likelihood is
logπ ππ‘|π, π1, β¦ , ππ‘β1
β’ Using conditional probabilities and the Markov property, we can write (exercise)
π π π‘ , π π‘β1, ππ‘|π, π1, β¦ , ππ‘β1= π π π‘β1|π, π1, β¦ , ππ‘β1 π π π‘|π π‘β1, π π ππ‘|π π‘ , π
Estimation
β’ Above π π π‘|π π‘β1, π is the switching probability and
π ππ‘|π π‘, π =1
2πππ π‘ππ₯π β
1
2
ππ‘βππ π‘ππ π‘
2
β’ The function π π π‘β1|π, π1, β¦ , ππ‘β1 is given by
π π π‘β1,π π‘β2=0,ππ‘β1|π,π1,β¦,ππ‘β2 +π π π‘β1,π π‘β2=1,ππ‘β1|π,π1,β¦,ππ‘β2
π ππ‘β1|π,π1,β¦,ππ‘β2
Estimation
β’ So we get
π ππ‘|π, π1, β¦ , ππ‘β1 = π π π‘ = π, π π‘β1 = π, ππ‘|π, π1, β¦ , ππ‘β1
2
π=1
2
π=1
β’ To start the recursion we may let
π π 1 = 0, π1|π =1
2
1
2ππ0ππ₯π β
1
2
π1 β π0π0
2
π π 1 = 1, π1|π =1
2
1
2ππ1ππ₯π β
1
2
π1 β π1π1
2
Estimation
β’ This gives
π π1|π = π π 1 = 0, π1|π + π π 1 = 1, π1|π
β’ and
π π 1 = 0|π, π1 =π π 1 = 0, π1|π
π π1|π
π π 1 = 1|π, π1 =π π 1 = 1, π1|π
π π1|π
Estimation
β’ Next we get
π π2|π, π1 = π π 1 = π, π 2 = π, π2|π, π1
2
π=1
2
π=1
β’ where
π π 1 = π, π 2 = π, π2|π, π1
= π π 1 = π|π, π1 πππ1
2πππππ₯π β
1
2
π2 β ππ
ππ
2
β’ And so forthβ¦
Estimation
β’ So, the maximization of the likelihood-function cannot be done manually but using standard routines like fminsearch or fmincon in matlab we can find our parameter estimates
β’ There is a matlab package by Marcelo Perlin called MS_Regress available online (for free) that does the parameter estimation and then someβ¦
For the ^N225
β’ By smoothed probabilities in the above plot we mean
π π π‘|π, π1, β¦ , ππ
β’ The parameter estimates are πππ’ππ,ππ’ππ = 0.99, πππππ,ππππ = 0.89, πππ’ππ = 0.0007, πππππ = β0.0086 πππ’ππ = 0.00015, πππππ = 0.0011
β’ As expected the bear volatility is higher than the bull
volatility
Non-parametric models
β’ What if we do not make any distribution assumptions?
β’ Assume that ππ‘ and π₯π‘ are two time series for which we want to explore their relationship
β’ Maybe it is possible to fit a model
ππ‘ = π π₯π‘ + ππ‘ where π is some smooth function to be estimated from the data
Non-parametric models
β’ If we had independent observerations π1, β¦ , ππ for a fixed π₯π‘ = π₯ the we could write
ππ‘ππ‘=1
π= π π₯ +
ππ‘ππ‘=1
π
β’ For a sufficiently large π the mean of the noise (LLN)
will be close to zero so in this case
π π₯ = ππ‘ππ‘=1
π
Non-parametric models
β’ In financial applications we will typically not have data as above. Rather we will have pairs of observations
π1, π₯1 , β¦ , ππ , π₯π
β’ But if the function π is sufficiently smooth then a
value of ππ‘ for which π₯π‘ β π₯ will still give a good approximation of π π₯
β’ For a value of ππ‘ for which π₯π‘ is not close to π₯ will give a less accurate approximation of π π₯
Non-parametric models
β’ So instead of a simple average, we use a weighted average
π π₯ =1
π π€π‘(π₯)ππ‘
π
π‘=1
where the weights π€π‘(π₯) are large for those ππ‘ with π₯π‘ close to π₯ and weights are small for ππ‘ with π₯π‘ not close to π₯
Non-parametric models β’ Above we assume that π€π‘ π₯ = ππ
π‘=1
β’ One may also treat 1
π as part of the weights and work
under the assumption π€π‘ π₯ = 1ππ‘=1
β’ A construction like the one at hand where we will let the weights depend on a choice of measure for the distance between π₯π‘ and π₯ and the size of the weights depends on the distance may be referred to as a local weighted average
Kernel regression
β’ One way of finding appropriate weights is to use kernels πΎ π₯ which are typically probability density functions
πΎ(π₯) β₯ 0 and πΎ π₯ ππ₯ = 1β
ββ
β’ For flexibility we will allow scaling of the kernel using a βbandwidthβ β
πΎβ π₯ =1
βπΎ π₯ β , πΎβ π₯ ππ₯ = 1
β
ββ
β’ The weights may be defined as
π€π‘ π₯ =πΎβ π₯ β π₯π‘
πΎβ π₯ β π₯π‘ππ‘=1
Nadaraya-Watson
β’ The N-W kernel estimator (N-W 1964) is given by
π π₯ = π€π‘(π₯)ππ‘
π
π‘=1
= πΎβ π₯ β π₯π‘ ππ‘ππ‘=1
πΎβ π₯ β π₯π‘ππ‘=1
β’ The choice of kernel is often (Gaussian)
πΎβ π₯ =1
β 2πππ₯π β
π₯2
2β2
or (Epanechnikov)
πΎβ π₯ =3
4β1 β
π₯2
β2π π₯ β€ β
What does the bandwidth do?
β’ If we use the Epanechnikov kernel we get
π π₯ = πΎβ π₯ β π₯π‘ ππ‘ππ‘=1
πΎβ π₯ β π₯π‘ππ‘=1
= 1 β
π₯ β π₯π‘2
β2π π₯ β π₯π‘ β€ β ππ‘
ππ‘=1
1 βπ₯ β π₯π‘
2
β2π π₯ β π₯π‘ β€ βπ
π‘=1
β’ If β β β
π π₯ β1
π ππ‘
π
π‘=1
and if β β 0
π π₯ β ππ‘ where ππ‘ is the observation for which π₯ β π₯π‘ is smallest within the sample
Bandwidth Selection
β’ Fan and Yao (2003) suggest
β = 1.06π πβ1/5
for the Gaussian Kernel and
β = 2.34π πβ1/5
for the Epanechnikov kernel where π is the sample standard deviation of π₯π‘ which is assumed stationary
Cross Validation
β’ Let
π β,π π₯π =1
π β 1 π€π‘ π₯π π¦π‘π‘β π
which is an estimate of π¦π where the weights sum to π β 1. β’ Also let
πΆπ β =1
π π¦π βπ β,π π₯π
2π π₯π
π
π=1
where π β is anonnegative weight function satisfying π π₯π = πππ=1
Cross Validation
β’ The function πΆπ β is called the cross-validation function since it validates the ability of the smoother π to predict π¦π‘
β’ The weight function π may be chosen to downweight certain observations if necessary
but π π₯π = 1 is often sufficient
Cross Validation
β’ It is an exercise to show that
πΆπ β =1
π π¦π βπ β,π π₯π
2π
π=1
=1
π π¦π βπ π₯π
2/ 1 β
πΎβ 0
πΎβ π₯π β π₯πππ=1
2π
π=1
N-W Volatility Estimation
β’ Assume that ππ‘ is our log-return series that has been centered at zero so that
πΈ π2π‘ = π2π‘
β’ We also assume that π2π‘ = π2π‘ + ππ‘ where ππ‘ is WN
N-W Volatility Estimation
β’ We may then use the NβW kernel estimator
π 2π‘ = πΎβ π‘ β π π2ππ‘β1π=1
πΎβ π‘ β ππ‘β1π=1
β’ Below we use Gaussian kernels for OMXS30 data
OMXS30 N-W volatility devolatized returns
The Ljung-Box null hypothesis of no autocorrelations cannot be rejected at 5% level p=0.4433
Another application
β’ Remember the ARIMA example for the Swedish GDP
β’ What if we try to use N-W to model log GDP ππ‘ as
ππ‘ = π ππ‘β1 + ππ‘
where ππ‘ is WN