• Non ci sono risultati.

Markov Switching Model Analysis of Implied Volatility for Market Indexes with Applications to S&P 500 and DAX

N/A
N/A
Protected

Academic year: 2021

Condividi "Markov Switching Model Analysis of Implied Volatility for Market Indexes with Applications to S&P 500 and DAX"

Copied!
18
0
0

Testo completo

(1)

Research Article

Markov Switching Model Analysis of Implied Volatility for

Market Indexes with Applications to S&P 500 and DAX

Luca Di Persio

1

and Samuele Vettori

2

1Department of Computer Science, University of Verona, Strada le Grazie 15, 37134 Verona, Italy 2Department of Mathematics, University of Trento, Via Sommarive 14, 38123 Trento, Italy

Correspondence should be addressed to Luca Di Persio; dipersioluca@gmail.com

Received 31 May 2014; Revised 26 November 2014; Accepted 26 November 2014; Published 18 December 2014 Academic Editor: Niansheng Tang

Copyright ยฉ 2014 L. Di Persio and S. Vettori. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

We adopt a regime switching approach to study concrete financial time series with particular emphasis on their volatility characteristics considered in a space-time setting. In particular the volatility parameter is treated as an unobserved state variable whose value in time is given as the outcome of an unobserved, discrete-time and discrete-state, stochastic process represented by a suitable Markov chain. We will take into account two different approaches for inference on Markov switching models, namely, the classical approach based on the maximum likelihood techniques and the Bayesian inference method realized through a Gibbs sampling procedure. Then the classical approach shall be tested on data taken from the Standard & Poorโ€™s 500 and the Deutsche

Aktien Index series of returns in different time periods. Computations are given for a four-state switching model and obtained

numerical results are put beside by explanatory graphs which report the outcomes obtained exploiting both smoothing and filtering algorithms used in the estimation/calibration procedures we proposed to infer on the switching model parameters.

1. Introduction

Many financial time series are characterized by abrupt changes in their behaviour, a phenomena that can be implied by a number of both endogeneous and exogeneous facts, often far from being forecasted. Examples of such changing factors can be represented, for example, by large financial crises, government policy and political instabilities, natural disasters, and speculative initiatives.

Such phenomena have been frequently observed during last decade especially because of the worldwide financial cri-sis which originated during the first years of 2000 and is still running. Indeed such a crisis, often referred to as the Global

Financial Crisis, has caused a big lack of liquidity for banks,

both in USA, Europe, and many countries all over the world, resulting, for example, in a collapse of many financial insti-tutions, a generalized downfall in stock markets, a decline consumer wealth, and an impressive growth of the Eurpean sovereign debt. The reasons behind these phenomena are rather complicated, particularly because of the high num-ber of interconnected point of interests, each of which is

driven by specific influences often linked between each other. Nevertheless there are mathematical techniques which can be used to point out some general characteristics able to synthe-size some relevant informations and to give an effective help in forecasting future behaviour of certain macroquantities of particular interest.

Although linear time series techniques, for example, the autoregressive (AR) model, the moving average (MA) model, and their combination (ARMA), have been success-fully applied in a large number of financial applications, by their own nature they are unable to describe nonlinear dynamic patterns as in the case, for example, of asymmetry and volatility clustering. In order to overcome latter issue various approaches have been developed. Between them and with financial applications in mind, we recall the autore-gressive conditional heteroskedasticity (ARCH) model of Engle, together with its generalised version (GARCH), and the regime switching (RS) model which involves multiple equations, each characterizing the behaviors of quantities of interest in different regimes, and a mechanism allowing the switch between them. Concerning the switching methods

Volume 2014, Article ID 753852, 17 pages http://dx.doi.org/10.1155/2014/753852

(2)

that can be considered in the RS framework, we would like to cite the threshold autoregressive (TAR) model proposed by Tong in [1], in which regime switching is controlled by a fixed threshold, the autoregressive conditional root (ACR) model of Bec et al. (see [2]) where the regime switching between stationary and nonstationary state is controlled by a binary random variable, and its extension, namely, the functional

coefficient autoregressive conditional root (FCACR) model,

considered by Zhou and Chen in [3]. In particular in this work we aim at using the RS approach to model aforemen-tioned types of unexpected changes by their dependence on an unobserved variable typically defined as the regime or

state. A customary way to formalize such an approach is given

through the following state-space representation:

๐‘ฆ๐‘ก= ๐‘“ (๐‘†๐‘ก, ๐œƒ๐œ“) , ๐‘ก = 1, . . . , ๐‘›, ๐‘› โˆˆ N+, ๐‘†๐‘กโˆˆ ฮฉ, (1) where๐œƒ is the vector of problem parameters, ๐œ“ is the infor-mation set, the state setฮฉ, with |ฮฉ| = ๐‘€ โˆˆ N+, is the (finite) set of possible values which can be taken by the the state process๐‘† at time ๐‘ก, that is, ๐‘†๐‘ก โˆˆ ฮฉ, and ๐‘“ is a suitable func-tion determining the value of the dependent variable๐‘ฆ at any given time๐‘ก โˆˆ {1, . . . , ๐‘›}.

The simplest type of structure considers two regimes; that is, ฮฉ = {1, 2} and at most one switch in the time series: in other words, the first ๐‘š (unknown) observations relate regime 1, while the remaining๐‘› โˆ’ ๐‘š data concern regime 2. Such an approach can be generalized allowing the system to switch back and forth between the two regimes, with a certain probability. The latter is the case considered by Quandt in his paper published in 1962, where it is assumed to be theo-retically possible for the system to switch between regimes every time that a new observation is generated. Note that previous hypothesis is not realistic in an economic context, since it contradicts the volatility clustering property, typical of financial time series.

The best way to represent the volatility clusters phe-nomenon consists in assuming that the state variable follows a Markov chain and claiming that the probability of having a switch in the next time is much lower than the probability of remaining in the same economic regime. The Markovian switching mechanism was first considered by Goldfeld and Quandt in [4] and then extended by Hamilton to the case of structural changes in the parameters of an autoregres-sive process (see [5]). When the unobserved state variable that controls the switching mechanism follows a first-order Markov chain, the RS model is called Markov Switching Model (MSM). In particular the Markovian property of such a model implies that, given๐‘ก โˆˆ {2, . . . , ๐‘›}, the value ๐‘†๐‘กof the state variable depends only on๐‘†๐‘กโˆ’1, a property that turns out to be useful to obtain a good representation of financial data, where abrupt changes occur occasionally.

After Hamiltonโ€™s papers, Markov switching models have been widely applied, together with a number of alternative versions, to analyze different type of both economic and financial time series, for example, stock options behaviors, energy markets trends, and interest rates series. In what

follows we shall often refer to the following, actually rather general, form for an MSM:

๐‘ฆ๐‘ก= ๐‘“ (๐‘†๐‘ก, ๐œƒ)

๐‘†๐‘กโˆˆ {1, 2, . . . , ๐‘€} with probabilities

๐‘๐‘–๐‘—:= P (๐‘†๐‘ก= ๐‘— | ๐‘†๐‘กโˆ’1= ๐‘–) , ๐‘–, ๐‘— = 1, 2, . . . , ๐‘€, ๐‘ก = 2, . . . , ๐‘›, (2) where the terms ๐‘๐‘–๐‘— are nothing but the transition prob-abilities, from state ๐‘– at time ๐‘ก โˆ’ 1 to state ๐‘— at time ๐‘ก, which determine the stochastic dynamic of the process๐‘† = {๐‘†๐‘ก}๐‘ก=1,...,๐‘›.

In Section 2 we recall the classical approach to MSM following [5] and with respect to both serially uncorrelated and correlated data. Then, in Section 3, we first introduce basic facts related to the Bayesian inference; then we recall the Gibbs sampling technique and related Monte Carlo approximation method which is later used to infer on the MSM parameters. Section 4 is devoted to a goodness of fit (of obtained estimates for parameters of interest) analysis, while inSection 5we describe our forecasting MSM-based procedure which is then used inSection 6to analyse both the

Standard & Poorโ€™s 500 and the Deutsche Aktien indexes.

2. The Classical Approach

In this section we shall use the classical approach (see, for example, [5]) to develop procedures which allow us to make inference on unobserved variables and parameters characterizing MSM. The main idea behind such an approach is splitin two steps: first we estimate the modelโ€™s unknown parameters by a maximum likelihood method; secondly we infer the unobserved switching variable values conditional on the parameter estimates. Along latter lines, we shall analyze two different MSM settings, namely, the case in which data are serially uncorrelated, and the case when they are

autocorrelated.

2.1. Serially Uncorrelated Data. Let us suppose that ๐‘† =

{๐‘†๐‘ก}๐‘กโˆˆ{1,...,๐‘‡}, ๐‘‡ โˆˆ N+, is a discrete time stochastic process represented by a first-order Markov chain taking value in some setฮฉ = {1, . . . , ๐‘€}, with transition probabilities:

๐‘๐‘–๐‘—:= P (๐‘†๐‘ก+1= ๐‘— | ๐‘†๐‘ก= ๐‘–, ๐‘†๐‘กโˆ’1= ๐‘–๐‘กโˆ’1, . . . , ๐‘†0= ๐‘–0) = P (๐‘†๐‘ก+1= ๐‘— | ๐‘†๐‘ก= ๐‘–) , โˆ€๐‘ก โˆˆ {2, . . . , ๐‘‡} . (3) Then the state-space model we want to study is given by

๐‘ฆ๐‘ก= ๐œ‡๐‘†๐‘ก+ ๐œ–๐‘ก, ๐‘ก = 1, 2, . . . , ๐‘‡, {๐œ–๐‘ก}๐‘กโˆˆ{1,...,๐‘‡} are i.i.d. N (0, ๐œŽ2๐‘†๐‘ก) , ๐œ‡๐‘†๐‘ก= ๐œ‡1๐‘†1,๐‘ก+ โ‹… โ‹… โ‹… + ๐œ‡๐‘€๐‘†๐‘€,๐‘ก, ๐œŽ๐‘†๐‘ก= ๐œŽ1๐‘†1,๐‘ก+ โ‹… โ‹… โ‹… + ๐œŽ๐‘€๐‘†๐‘€,๐‘ก, ๐‘†๐‘กโˆˆ {1, . . . , ๐‘€} with probabilities ๐‘๐‘–๐‘—, (4)

(3)

where the variables๐‘†๐‘˜,๐‘ก,(๐‘˜, ๐‘ก) โˆˆ {1, . . . , ๐‘€} ร— {1, . . . , ๐‘‡} are introduced in order to have a slightly compact equation for ๐œ‡๐‘†๐‘กand๐œŽ๐‘†๐‘ก: in particular,๐‘†๐‘˜,๐‘ก = 1 if ๐‘†๐‘ก = ๐‘˜, otherwise ๐‘†๐‘˜,๐‘ก = 0, which implies that under regime ๐‘˜, for ๐‘˜ โˆˆ {1, . . . , ๐‘€}, parameters of mean and variance are given by๐œ‡๐‘˜and๐œŽ๐‘˜.

Let us underline that in (4) the ๐‘ฆ๐‘ก are our observed data, for example, historical returns of a stock or some index time series, and we suppose that they are locally distributed as Gaussian random variable in the sense that occasionally jumps could occur for both the mean๐œ‡๐‘†๐‘ก and the variance ๐œŽ2๐‘†๐‘ก. In particular, we assume that ๐œŽ1 < ๐œŽ2 < โ‹… โ‹… โ‹… < ๐œŽ๐‘€ and we want to estimate these ๐‘€ unobserved values for standard deviation, as well as the๐‘€ values for the switching mean. Note that we could also take๐œ‡ as a constant, obtaining the so called switching variance problem or๐œŽ as a constant, having a switching mean problem. The first one is in general more interesting in the analysis of financial time series, since variance is usually interpreted as an indicator for the marketโ€™s volatility.

Given the model described by(4), the conditional density of ๐‘ฆ๐‘ก given ๐‘†๐‘ก is Gaussian with mean ๐œ‡๐‘†๐‘ก and standard deviation๐œŽ๐‘†๐‘ก; namely, its related probability density function reads as follow: ๐‘“๐‘ฆ๐‘ก|๐‘†๐‘ก(๐‘ฅ) = 1 โˆš2๐œ‹๐œŽ2 ๐‘†๐‘ก ๐‘’โˆ’(๐‘ฅโˆ’๐œ‡๐‘†๐‘ก)2/2๐œŽ๐‘†๐‘ก2, ๐‘ฅ โˆˆ R, (5) and we are left with the problem of estimating both the expec-tations ๐œ‡1, . . . , ๐œ‡๐‘€ and the standard deviations ๐œŽ1, . . . , ๐œŽ๐‘€ parameters; a task that is standard to solve by maximizing the associated log-likelihood function lnL defined as follows:

lnL :=

๐‘‡

โˆ‘

๐‘ก=1

ln(๐‘“๐‘ฆ๐‘ก|๐‘†๐‘ก) . (6) A different and more realistic scenario is the one character-ized by unobserved values for๐‘†๐‘ก. In such a case, it could be possible to consider the MSM-inference problem as a two-step procedure consisting in

(i) estimating the parameters of the model by maximiz-ing the log-likelihood function,

(ii) making inferences on the state variable ๐‘†๐‘ก, ๐‘ก = 1, . . . , ๐‘‡ conditional on the estimates obtained at previous point.

Depending on the amount of information we can use inferencing on๐‘†๐‘ก, we have

(i) filtered probabilities that refer to inferences about๐‘†๐‘ก conditional on information up to time๐‘ก, namely, with respect to๐œ“๐‘ก,

(ii) smoothed probabilities that refer to inferences about๐‘†๐‘ก conditional to the whole sample (history),๐œ“๐‘‡. In what follows we describe a step-by-step algorithm which allows us to resolve the filtering problem for a sample of serially uncorrelated data. In particular we slightly generalize the approach given in [6], assuming that the state variable๐‘†๐‘ก

belongs to a 4-state space setฮฉ := {1, 2, 3, 4}, at every time ๐‘ก = 1, . . . , ๐‘‡. Despite 2-state (expansion/contraction) and 3-state (low/medium/high volatility regime) models being the usual choices, we decided to consider 4-state MSM in order to refine the analysis with respect to volatility levels around the mean. A finer analysis can be also performed, even if one has to take into account the related nonlinear computational growth. We first define the log-likelihood function at time๐‘ก as

๐‘™ (๐œƒ, ๐œ“๐‘ก) = ๐‘™ (๐œ‡1, . . . , ๐œ‡๐‘€, ๐œŽ1, . . . , ๐œŽ๐‘€, ๐œ“๐‘ก) , (7) where๐œƒ := (๐œ‡1, . . . , ๐œ‡๐‘€, ๐œŽ1, . . . , ๐œŽ๐‘€) is the vector of parame-ters that we want to estimate. Let us note that the๐œƒ is updated at every iteration, since we maximize with respect to the function๐‘™(๐œƒ, ๐œ“๐‘ก) at every stage of our step-by-step procedure. In particular the calibrating procedure reads as follows.

Inputs.

(i) Put๐‘™(๐œƒ) := ๐‘™(๐œƒ, ๐œ“0) = 0.

(ii) Compute the transition probabilities of the homoge-neous Markov chain underlying the state variable; that is,

๐‘๐‘–๐‘—= P (๐‘†๐‘ก= ๐‘— | ๐‘†๐‘กโˆ’1= ๐‘–) , ๐‘–, ๐‘— โˆˆ ฮฉ. (8)

Since in the applications we can only count on return time series, we first have to calibrate with respect to the transition probabilities๐‘๐‘–๐‘—:

(1) choose 4 values ๐œŽ21 < ๐œŽ22 < ๐œŽ23 < ๐œŽ42 (e.g., ๐œŽ1 = 0.1, ๐œŽ2 = 0.2, ๐œŽ3 = 0.3, and ๐œŽ4 = 0.4)

and a positive, arbitrary small, constant๐›ฟ > 0, for example,๐›ฟ = 0.01,

(2) compute for every๐‘— = 1, 2, 3, 4 and for every ๐‘ก = 1, . . . , ๐‘‡ the values ๐‘๐‘— := ฮฆ (๐‘ฆ๐‘ก+ ๐›ฟ) โˆ’ ฮฆ (๐‘ฆ๐‘กโˆ’ ๐›ฟ) = โˆซ๐‘ฆ๐‘ก+๐›ฟ ๐‘ฆ๐‘กโˆ’๐›ฟ 1 โˆš2๐œ‹๐œŽ2 ๐‘— exp [ [ (๐‘ฅ โˆ’ ๐œ‡๐‘—)2 2๐œŽ2 ๐‘— ] ] , (9)

(3) simulate a value in{1, 2, 3, 4} for ๐‘†๐‘กat each time from the discrete probability vector

( ๐‘1 โˆ‘4๐‘—=1๐‘๐‘—, ๐‘2 โˆ‘4๐‘—=1๐‘๐‘—, ๐‘3 โˆ‘4๐‘—=1๐‘๐‘—, ๐‘4 โˆ‘4๐‘—=1๐‘๐‘—) , (10) (4) set the transition probabilities๐‘๐‘–๐‘—just by count-ing the number of transition from state๐‘– to state ๐‘—, for ๐‘–, ๐‘— = 1, . . . , 4, in order to obtain the following transition matrix:

๐‘ƒโˆ— = ( ๐‘11 ๐‘12 ๐‘13 ๐‘14 ๐‘21 ๐‘22 ๐‘23 ๐‘24 ๐‘31 ๐‘32 ๐‘33 ๐‘34 ๐‘41 ๐‘42 ๐‘43 ๐‘44 ) . (11)

(4)

(iii) Compute the steady-state probabilities

๐œ‹ (0) = (P (๐‘†0= 1 | ๐œ“0) , . . . , P (๐‘†0= 4 | ๐œ“0)) . (12)

Let us note that, by definition, if๐œ‹(๐‘ก) is a 4 ร— 1 vector of steady-state probabilities, then๐œ‹(๐‘ก + 1) = ๐œ‹(๐‘ก) for every ๐‘ก = 1, . . . , ๐‘‡; moreover ๐œ‹(๐‘ก + 1) = ๐‘ƒโˆ—๐œ‹(๐‘ก), and (see for example, [6, pag. 71]) we also have that ๐œ‹(๐‘ก) = (๐ด๐‘‡๐ด)โˆ’1๐ด๐‘‡[04

1], where 04is a4 ร— 1 matrix of

zeros and๐ด = (Id4โˆ’๐‘ƒโˆ—

14 ), Id4is the four dimensional

identity matrix, while14 = (1, 1, 1, 1), that is, the vector of steady-state probabilities is the last column of the matrix(๐ด๐‘‡๐ด)โˆ’1๐ด๐‘‡.

Next we perform the following steps, for๐‘ก = 1, . . . , ๐‘‡.

Step 1. The probability of๐‘†๐‘กconditional to information set at

time๐‘ก โˆ’ 1 is given by P (๐‘†๐‘ก= ๐‘— | ๐œ“๐‘กโˆ’1) =โˆ‘4

๐‘–=1

๐‘๐‘–๐‘—P (๐‘†๐‘กโˆ’1= ๐‘– | ๐œ“๐‘กโˆ’1) , ๐‘— = 1, . . . , 4. (13)

Step 2. Compute the joint density of๐‘ฆ๐‘กand๐‘†๐‘กconditional to

the information set๐œ“๐‘กโˆ’1

๐‘“ (๐‘ฆ๐‘ก, ๐‘†๐‘ก= ๐‘— | ๐œ“๐‘กโˆ’1) = ๐‘“ (๐‘ฆ๐‘ก| ๐‘†๐‘ก= ๐‘—, ๐œ“๐‘กโˆ’1)

ร— P (๐‘†๐‘ก= ๐‘— | ๐œ“๐‘กโˆ’1) , ๐‘— = 1, . . . , 4. (14) The marginal density of๐‘ฆ๐‘กis given by the sum of the joint density over all values of๐‘†๐‘ก

๐‘“ (๐‘ฆ๐‘ก| ๐œ“๐‘กโˆ’1) =โˆ‘4

๐‘–=1

๐‘“ (๐‘ฆ๐‘ก| ๐‘†๐‘ก= ๐‘–, ๐œ“๐‘กโˆ’1) P (๐‘†๐‘ก= ๐‘– | ๐œ“๐‘กโˆ’1) . (15)

Step 3. Update the log-likelihood function at time๐‘ก in the

following way:

๐‘™ (๐œƒ, ๐œ“๐‘ก) = ๐‘™ (๐œƒ, ๐œ“๐‘กโˆ’1) + ln (๐‘“ (๐‘ฆ๐‘ก| ๐œ“๐‘กโˆ’1)) , (16) and maximize ๐‘™(๐œƒ, ๐œ“๐‘ก) with respect to ๐œƒ = (๐œ‡1, . . . , ๐œ‡4, ๐œŽ1, . . . , ๐œŽ4), under the condition ๐œŽ1 < ๐œŽ2 < ๐œŽ3 < ๐œŽ4, to find the maximum likelihood estimator ฬ‚๐œƒ for the next time period.

Step 4. Once๐‘ฆ๐‘กis observed at the end of the๐‘กth iteration, we

can update the probability term: P (๐‘†๐‘ก= ๐‘— | ๐œ“๐‘ก)

= ๐‘“ (๐‘ฆ๐‘ก๐‘†๐‘ก= ๐‘—, ๐œ“๐‘กโˆ’1) P (๐‘†๐‘ก= ๐‘—๐œ“๐‘กโˆ’1) โˆ‘4๐‘–=1๐‘“ (๐‘ฆ๐‘ก| ๐‘†๐‘ก= ๐‘–, ๐œ“๐‘กโˆ’1) P (๐‘†๐‘ก= ๐‘– | ๐œ“๐‘กโˆ’1),

๐‘— = 1, . . . , 4,

(17)

where both๐œ“๐‘ก = {๐œ“๐‘กโˆ’1, ๐‘ฆ๐‘ก} and ๐‘“(๐‘ฆ๐‘ก | ๐‘†๐‘ก = ๐‘–, ๐œ“๐‘กโˆ’1) are com-puted with respect to the estimator ฬ‚๐œƒ = (ฬ‚๐œ‡1, . . . , ฬ‚๐œ‡4, ฬ‚๐œŽ1, . . . , ฬ‚๐œŽ4).

2.2. Serially Correlated Data. In some cases it is possible to

argue and mathematically test by, for example, the Durbin-Watson statistics or Breusch-Godfrey test, for the presence of a serial correlation (or autocorrelation) between data belong-ing to a certain time series of interest. Such a characteristic is often analyzed in signal processing scenario, but examples can be also found in economic, meteorological, or sociolog-ical data sets, especially in connection with autocorrelation of errors in related forecasting procedure. In particular if we suppose that the observed variable๐‘ฆ๐‘ก linearly depends on its previous value, then we obtain a first-order autoregressive

pattern and the following state-space model applies:

๐‘ฆ๐‘กโˆ’ ๐œ‡๐‘†๐‘ก= ๐œ™ (๐‘ฆ๐‘กโˆ’1โˆ’ ๐œ‡๐‘†๐‘กโˆ’1) + ๐œ–๐‘ก, ๐‘ก = 1, 2, . . . , ๐‘‡, {๐œ–๐‘ก}๐‘กโˆˆ{1,...,๐‘‡} are i.i.d. N (0, ๐œŽ2๐‘†๐‘ก) , ๐œ‡๐‘†๐‘ก= ๐œ‡1S1,๐‘ก+ โ‹… โ‹… โ‹… + ๐œ‡๐‘€๐‘†๐‘€,๐‘ก, ๐œŽ๐‘†๐‘ก= ๐œŽ1๐‘†1,๐‘ก+ โ‹… โ‹… โ‹… + ๐œŽ๐‘€๐‘†๐‘€,๐‘ก, ๐‘†๐‘กโˆˆ {1, . . . , ๐‘€} with probabilities ๐‘๐‘–๐‘—, (18) where๐‘๐‘–๐‘— := P(๐‘†๐‘ก = ๐‘— | ๐‘†๐‘กโˆ’1 = ๐‘–), ๐‘–, ๐‘— = 1, . . . , ๐‘€ and ๐‘†๐‘˜,๐‘ก, and (๐‘˜, ๐‘ก) โˆˆ {1, . . . , ๐‘€} ร— {1, . . . , ๐‘‡} are the same variables introduced in the previous section; that is,๐‘†๐‘˜,๐‘ก = 1 if ๐‘†๐‘ก= ๐‘˜, otherwise๐‘†๐‘˜,๐‘ก= 0.

In this situation, if the state๐‘†๐‘ก is known for every๐‘ก = 1, . . . , ๐‘‡, we need ๐‘†๐‘กand ๐‘†๐‘กโˆ’1 to compute the density of ๐‘ฆ๐‘ก conditional to past information๐œ“๐‘กโˆ’1, indeed we have

lnL := ๐‘‡ โˆ‘ ๐‘ก=1 ln(๐‘“๐‘ฆ๐‘ก|๐œ“๐‘กโˆ’1,๐‘†๐‘ก,๐‘†๐‘กโˆ’1) , (19) where ๐‘“๐‘ฆ๐‘ก|๐œ“๐‘กโˆ’1,๐‘†๐‘ก,๐‘†๐‘กโˆ’1(๐‘ฅ) = 1 โˆš2๐œ‹๐œŽ2 ๐‘†๐‘ก ๐‘’โˆ’(๐‘ฅโˆ’๐œ‡๐‘†๐‘กโˆ’๐œ™(๐‘ฆ๐‘กโˆ’1โˆ’๐œ‡๐‘†๐‘กโˆ’1))2/2๐œŽ๐‘†๐‘ก2, ๐‘ฅ โˆˆ R. (20) If ๐‘†๐‘ก are unobserved (and as before we assume that the state variable can take the four values{1, 2, 3, 4}), we apply the following algorithm in order to resolve the filtering problem for a sample of serially correlated data.

Inputs.

(i) Put๐‘™(๐œƒ) := ๐‘™(๐œƒ, ๐œ“0) = 0.

(ii) Compute the transition probabilities

๐‘๐‘–๐‘—= P (๐‘†๐‘ก= ๐‘— | ๐‘†๐‘กโˆ’1= ๐‘–) , ๐‘–, ๐‘— = 1, 2, 3, 4. (21)

We apply the same trick as before, but firstly we have to estimate the parameter๐œ™: in order to obtain this value we can use the least square methods (see for example, [7]) that is,

ฬ‚๐œ™ := โˆ‘๐‘‡๐‘ก=1๐‘ฆ๐‘ก๐‘ฆ๐‘ก+1

โˆ‘๐‘‡๐‘ก=1๐‘ฆ2 ๐‘ก

(5)

Then we compute๐‘ง๐‘ก:= ๐‘ฆ๐‘กโˆ’๐œ™๐‘ฆ๐‘กโˆ’1for every๐‘ก = 1, . . . , ๐‘‡ and consider the values๐‘๐‘— := ฮฆ(๐‘ง๐‘ก+ ๐›ฟ) โˆ’ ฮฆ(๐‘ง๐‘กโˆ’ ๐›ฟ) (we apply the Normal distribution function to๐‘ง๐‘ก+ ๐›ฟ instead of๐‘ฆ๐‘ก+ ๐›ฟ, as done before).

(iii) Compute the steady-state probabilities

๐œ‹ (0) = (P (๐‘†0= 1 | ๐œ“0) , . . . , P (๐‘†0= 4 | ๐œ“0)) , (23)

taking the last column of the matrix(๐ด๐‘‡๐ด)โˆ’1๐ด๐‘‡(see procedure inSection 2.1for details).

Next perform the following steps for๐‘ก = 1, . . . , ๐‘‡.

Step 1. Compute the probabilities of๐‘†๐‘กconditional to

infor-mation set at time๐‘ก โˆ’ 1, for ๐‘— = 1, . . . , 4 P (๐‘†๐‘ก= ๐‘— | ๐œ“๐‘กโˆ’1) =โˆ‘4 ๐‘–=1 P (๐‘†๐‘ก= ๐‘—, ๐‘†๐‘กโˆ’1= ๐‘– | ๐œ“๐‘กโˆ’1) =โˆ‘4 ๐‘–=1๐‘๐‘–๐‘—P (๐‘†๐‘กโˆ’1 = ๐‘– | ๐œ“๐‘กโˆ’1) . (24)

Step 2. Compute the joint density of๐‘ฆ๐‘ก, ๐‘†๐‘ก, and ๐‘†๐‘กโˆ’1 given

๐œ“๐‘กโˆ’1:

๐‘“ (๐‘ฆ๐‘ก, ๐‘†๐‘ก, ๐‘†๐‘กโˆ’1| ๐œ“๐‘กโˆ’1) = ๐‘“ (๐‘ฆ๐‘ก| ๐‘†๐‘ก= ๐‘—, ๐‘†๐‘กโˆ’1= ๐‘–, ๐œ“๐‘กโˆ’1) ร— P (๐‘†๐‘ก= ๐‘—, ๐‘†๐‘กโˆ’1= ๐‘– | ๐œ“๐‘กโˆ’1) , (25) where ๐‘“(๐‘ฆ๐‘ก | ๐‘†๐‘ก = ๐‘—, ๐‘†๐‘กโˆ’1 = ๐‘–, ๐œ“๐‘กโˆ’1) is given by (20)and P(๐‘†๐‘ก= ๐‘—, ๐‘†๐‘กโˆ’1 = ๐‘– | ๐œ“๐‘กโˆ’1) is computed inStep 1. The marginal density of๐‘ฆ๐‘กconditional on๐œ“๐‘กโˆ’1is obtained by summing over all values of๐‘†๐‘กand๐‘†๐‘กโˆ’1:

๐‘“ (๐‘ฆ๐‘ก| ๐œ“๐‘กโˆ’1) = โˆ‘4 ๐‘—=1 4 โˆ‘ ๐‘–=1 ๐‘“ (๐‘ฆ๐‘ก| ๐‘†๐‘ก= ๐‘—, ๐‘†๐‘กโˆ’1= ๐‘–, ๐œ“๐‘กโˆ’1) ร— P (๐‘†๐‘ก= ๐‘—, ๐‘†๐‘กโˆ’1= ๐‘– | ๐œ“๐‘กโˆ’1) . (26)

Step 3. The log-likelihood function at time๐‘ก is again

๐‘™ (๐œƒ, ๐œ“๐‘ก) = ๐‘™ (๐œƒ, ๐œ“๐‘กโˆ’1) + ln (๐‘“ (๐‘ฆ๐‘ก| ๐œ“๐‘กโˆ’1)) , (27) and it can be maximized with respect to ๐œƒ = (๐œ‡1, . . . , ๐œ‡4, ๐œŽ1, . . . , ๐œŽ4), under condition ๐œŽ1 < ๐œŽ2 < ๐œŽ3 < ๐œŽ4, giving the maximum likelihood estimator ฬ‚๐œƒ for the next time period.

Step 4. Update the joint probabilities of๐‘†๐‘กand ๐‘†๐‘กโˆ’1

condi-tional to the new information set ๐œ“๐‘ก, using the estimator ฬ‚๐œƒ computed in Step 3 by maximizing the log-likelihood function๐‘™(๐œƒ, ๐œ“๐‘ก):

P (๐‘†๐‘ก= ๐‘—, ๐‘†๐‘กโˆ’1= ๐‘– | ๐œ“๐‘ก)

= ๐‘“ (๐‘ฆ๐‘ก, ๐‘†๐‘ก= ๐‘—, ๐‘†๐‘กโˆ’1= ๐‘– | ๐œ“๐‘กโˆ’1)

๐‘“ (๐‘ฆ๐‘ก| ๐œ“๐‘กโˆ’1) , ๐‘–, ๐‘— = 1, . . . , 4. (28)

Then compute the updated probabilities of๐‘†๐‘กgiven๐œ“๐‘กby summing the joint probabilities over๐‘†๐‘กโˆ’1as follows:

P (๐‘†๐‘ก= ๐‘— | ๐œ“๐‘ก) = 4 โˆ‘ ๐‘–=1 P (๐‘†๐‘ก= ๐‘—, ๐‘†๐‘กโˆ’1= ๐‘– | ๐œ“๐‘ก) , โˆ€๐‘— = 1, . . . , 4. (29)

The Smoothing Algorithm. Once we have run this procedure,

we are provided with the filtered probabilities, that is, the valuesP(๐‘†๐‘ก= ๐‘— | ๐œ“๐‘ก) for ๐‘— = 1, . . . , 4 and for each ๐‘ก = 1, . . . , ๐‘‡ (in addition to the estimator ฬ‚๐œƒ).

Sometimes it is required to estimate probabilities of ๐‘†๐‘ก given the whole sample information; that is,

P (๐‘†๐‘ก= ๐‘— | ๐œ“๐‘‡) = P (๐‘†๐‘ก= ๐‘— | ๐‘ฆ1, . . . , ๐‘ฆ๐‘‡) , โˆ€๐‘— = 1, . . . , 4, (30) which are called smoothed probabilities. We are going to show how these new probabilities can be computed from previous procedure (the same algorithm, although with some obvious changes, can be still used starting from procedure in Section

2.1).

Since the last iteration of the algorithm gives us the probabilitiesP(๐‘†๐‘‡ = ๐‘— | ๐œ“๐‘‡) for ๐‘— = 1, . . . , 4, we can start from these values and use the following procedure by doing the two steps for every๐‘ก = ๐‘‡ โˆ’ 1, ๐‘‡ โˆ’ 2, . . . , 2, 1.

Step 1. For๐‘–, ๐‘— = 1, . . . , 4, compute

P (๐‘†๐‘ก= ๐‘–, ๐‘†๐‘ก+1= ๐‘— | ๐œ“๐‘‡) = P (๐‘†๐‘ก+1= ๐‘— | ๐œ“๐‘‡) P (๐‘†๐‘ก= ๐‘– | ๐‘†๐‘ก+1= ๐‘—, ๐œ“๐‘‡) = P (๐‘†๐‘ก+1= ๐‘— | ๐œ“๐‘‡) P (๐‘†๐‘ก= ๐‘– | ๐‘†๐‘ก+1= ๐‘—, ๐œ“๐‘ก) = P (๐‘†๐‘ก+1= ๐‘— | ๐œ“๐‘‡)P (๐‘†๐‘ก= ๐‘–, ๐‘†๐‘ก+1= ๐‘— | ๐œ“๐‘ก) P (๐‘†๐‘ก+1= ๐‘— | ๐œ“๐‘ก) . (โˆ—)

Remark 1. Note that equality(โˆ—), that is,

P (๐‘†๐‘ก= ๐‘– | ๐‘†๐‘ก+1= ๐‘—, ๐œ“๐‘‡) = P (๐‘†๐‘ก= ๐‘– | ๐‘†๐‘ก+1= ๐‘—, ๐œ“๐‘ก) , (31) holds only under a particular condition; namely,

๐‘“ (โ„Ž๐‘ก+1,๐‘‡| ๐‘†๐‘ก+1= ๐‘—, ๐‘†๐‘ก= ๐‘–, ๐œ“๐‘ก) = ๐‘“ (โ„Ž๐‘ก+1,๐‘‡| ๐‘†๐‘ก+1= ๐‘—, ๐œ“๐‘ก) , (32) whereโ„Ž๐‘ก+1,๐‘‡ := (๐‘ฆ๐‘ก+1, . . . , ๐‘ฆ๐‘‡)๓ธ€ (see [6] for the proof). Equa-tion(32)suggests that if๐‘†๐‘ก+1 were known, then๐‘ฆ๐‘ก+1 would contain no information about๐‘†๐‘ก beyond that contained in ๐‘†๐‘ก+1 and ๐œ“๐‘กand does not hold for every state-space model with regime switching (see, for example, [6, Ch. 5]) in which case the smoothing algorithm involves an approximation.

Step 2. For๐‘– = 1, . . . , 4 compute

P (๐‘†๐‘ก= ๐‘– | ๐œ“๐‘‡) =โˆ‘4

๐‘—=1

P (๐‘†๐‘ก= ๐‘–, ๐‘†๐‘ก+1= ๐‘— | ๐œ“๐‘‡) . (33)

3. The Gibbs Sampling Approach

3.1. An Introduction to Bayesian Inference. Under the general

title Bayesian inference we can collect a large number of different concrete procedures; nevertheless they are all based on smart use of the Bayesโ€™ rule which is used to update the probability estimate for a hypothesis as additional evidence is learned (see, for example, [8, 9]). In particular, within

(6)

the Bayesian framework, the parameters, for example, let us collect them in a vector called๐œƒ, which characterize a certain statistic model and are treated as random variables with their own probability distributions; let us say๐‘“(๐œƒ), which plays the role of a prior distribution since it is defined before taking into account the sample data ฬƒ๐‘ฆ. Therefore, exploiting the Bayesโ€™ theorem and denoting by๐‘“( ฬƒ๐‘ฆ | ๐œƒ) the likelihood of ฬƒ๐‘ฆ of the interested statistic model, we have that

๐‘“ (๐œƒ | ฬƒ๐‘ฆ) = ๐‘“ ( ฬƒ๐‘ฆ | ๐œƒ) ๐‘“ (๐œƒ)

๐‘“ ( ฬƒ๐‘ฆ) , (34)

where ๐‘“(๐œƒ | ฬƒ๐‘ฆ) is the joint posterior distribution of the parameters. The denominator ๐‘“( ฬƒ๐‘ฆ) defines the marginal likelihood of ฬƒ๐‘ฆ and can be taken as a constant, obtaining the proportion

๐‘“ (๐œƒ | ฬƒ๐‘ฆ) โˆ ๐‘“ ( ฬƒ๐‘ฆ | ๐œƒ) ๐‘“ (๐œƒ) . (35) It is straightforward to note that the most critical part of the Bayesian inference procedure relies in the choice of a suitable prior distribution, since it has to agree with parameters constraints. An effective answer to latter issue is given by the so called conjugate prior distribution, namely the distribution obtained when the conjugate prior is combined with the likelihood function. Let us note that the posterior distribution ๐‘“(๐œƒ | ฬƒ๐‘ฆ) is in the same family as the prior distribution.

As an example, if the likelihood function is Gaussian, it can be shown that the conjugate prior for the mean๐œ‡ is the Gaussian distribution, whereas the conjugate prior for the variance is the inverted Gamma distribution (see, for example, [9,10]).

3.2. Gibbs Sampling. A general problem in Statistics concerns

the question of how a sequence of observations which cannot be directly sampled, can be simulated, for example, by mean of some multivariate probability distribution, with a prefixed precision degree of accuracy. Such kind of problems can be successfully attacked by Monte Carlo Markov Chain (MCMC) simulation methods, see, for example, [11โ€“13], and in particular using the so called Gibbs Sampling technique which allows to approximate joint and marginal distributions by sampling from conditional distributions, see, for example, [14โ€“16].

Let us suppose that we have the joint density of๐‘˜ random variables, for example,๐‘“ = ๐‘“(๐‘ง1, ๐‘ง2, . . . , ๐‘ง๐‘˜), fix ๐‘ก โˆˆ {1, . . . , ๐‘˜} and that we are interested in in obtaining characteristics of the๐‘ง๐‘ก-marginal, namely

๐‘“ (๐‘ง๐‘ก) = โˆซ โ‹… โ‹… โ‹… โˆซ ๐‘“ (๐‘ง1, ๐‘ง2, . . . , ๐‘ง๐‘˜) ๐‘‘๐‘ง1โ‹… โ‹… โ‹… ๐‘‘๐‘ง๐‘กโˆ’1๐‘‘๐‘ง๐‘ก+1โ‹… โ‹… โ‹… ๐‘‘๐‘ง๐‘˜, (36) such as the related mean and/or variance. In those cases when the joint density is not given, or the above integral turns out to be difficult to treat, for example, an explicit solution does not exist, but we know the complete set of conditional densities, denoted by ๐‘“(๐‘งt | ๐‘ง๐‘— ฬธ=๐‘ก), ๐‘ก = 1, 2, . . . , ๐‘˜, with

๐‘ง๐‘— ฬธ=๐‘ก = {๐‘ง1, . . . , ๐‘ง๐‘กโˆ’1, ๐‘ง๐‘ก+1, . . . , ๐‘ง๐‘˜}, then the Gibbs Sampling method allows us to generate a sample๐‘ง๐‘—1, ๐‘ง๐‘—2, . . . , ๐‘ง๐‘—๐‘˜from the

joint density๐‘“(๐‘ง1, ๐‘ง2, . . . , ๐‘ง๐‘˜) without requiring that we know either the joint density or the marginal densities. With the following procedure we recall the basic ideas on which the Gibbs Sampling approach is based given an arbitrary starting set of values(๐‘ง02, . . . , ๐‘ง๐‘˜0).

Step 1. Draw๐‘ง11from๐‘“(๐‘ง1| ๐‘ง20, . . . , ๐‘ง0๐‘˜).

Step 2. Draw๐‘ง12from๐‘“(๐‘ง2| ๐‘ง11, ๐‘ง30, . . . , ๐‘ง0๐‘˜).

Step 3. Draw๐‘ง31from๐‘“(๐‘ง3| ๐‘ง11, ๐‘ง21, ๐‘ง40, . . . , ๐‘ง๐‘˜0).

...

Step k. Finally draw๐‘ง1๐‘˜from๐‘“(๐‘ง๐‘˜ | ๐‘ง11, . . . , ๐‘ง๐‘˜โˆ’11 ) to complete

the first iteration.

The steps from1through๐‘˜ can be iterated ๐ฝ times to get (๐‘ง1๐‘—, ๐‘ง๐‘—2, . . . , ๐‘ง๐‘˜๐‘—), ๐‘— = 1, 2, . . . , ๐ฝ.

In [17] S. Geman and D. Geman showed that both the joint and marginal distributions of generated(๐‘ง1๐‘—, ๐‘ง๐‘—2, . . . , ๐‘ง๐‘˜๐‘—), converge, at an exponential rate, to the joint and marginal distributions of ๐‘ง1, ๐‘ง2, . . . , ๐‘ง๐‘˜, as ๐ฝ โ†’ โˆž. Thus the joint and marginal distributions of๐‘ง1, ๐‘ง2, . . . , ๐‘ง๐‘˜ can be approxi-mated by the empirical distributions of๐‘€ simulated values (๐‘ง1๐‘—, ๐‘ง๐‘—2, . . . , ๐‘ง๐‘˜๐‘—), ๐‘— = ๐ฟ + 1, . . . , ๐ฟ + ๐‘€, where ๐ฟ is large enough to assure the convergence of the Gibbs sampler. Moreover๐‘€ can be chosen to reach the required precision with respect to the empirical distribution of interest.

In the MSM framework we do not have conditional distributions๐‘“(๐‘ง๐‘ก| ๐‘ง๐‘— ฬธ=๐‘ก), ๐‘ก = 1, 2, . . . , ๐‘˜, and we are left with the problem of estimate parameters๐‘ง๐‘–,๐‘– = 1, . . . , ๐‘˜. Latter problem can be solved exploiting Bayesian inference results, as we shall state in the next section.

3.3. Gibbs Sampling for Markov Switching Models. A major

problem when dealing with inferences from Markov switch-ing models relies in the fact that some parameters of the model are dependent on an unobserved variable, let us say ๐‘†๐‘ก. We saw that in the classical framework, inference on Markov switching models consists first in estimating the modelโ€™s unknown parameters via maximum likelihood, then inference on the unobserved Markov switching variable ฬƒ๐‘†๐‘‡= (๐‘†1, ๐‘†2, . . . , ๐‘†๐‘‡), conditional on the parameter estimates, has to be perfomed.

In the Bayesian analysis, both the parameters of the model and the switching variables๐‘†๐‘ก, ๐‘ก = 1, . . . , ๐‘‡ are treated as ran-dom variables. Thus, inference on ฬƒ๐‘†๐‘‡is based on a joint dis-tribution, no more on a conditional one. By employing Gibbs sampling techniques, Albert and Chib (see [14]) provided an easy to implement algorithm for the Bayesian analysis of Markov switching models. In particular in their work the parameters of the model and๐‘†๐‘ก,๐‘ก = 1, . . . , ๐‘‡ are treated as missing data, and they are generated from appropriate con-ditional distributions using Gibbs sampling method. As an example, let us consider the following simple model with two-state Markov switching mean and variance:

(7)

{๐œ–๐‘ก}๐‘กโˆˆ{1,...,๐‘‡} are i.i.d. N (0, ๐œŽ๐‘†2๐‘ก) , ๐œ‡๐‘†๐‘ก= ๐œ‡0+ ๐œ‡1๐‘†๐‘ก,

๐œŽ๐‘†๐‘ก= ๐œŽ02(1 โˆ’ ๐‘†๐‘ก) + ๐œŽ12๐‘†๐‘ก= ๐œŽ20(1 + โ„Ž1๐‘†๐‘ก) , โ„Ž1> 0, (37) where๐‘†๐‘กโˆˆ {0, 1} with transition probabilities ๐‘ := P(๐‘†๐‘ก= 0 | ๐‘†๐‘กโˆ’1 = 0), ๐‘ž := P(๐‘†๐‘ก = 1 | ๐‘†๐‘กโˆ’1 = 1). The Bayesian method consider both๐‘†๐‘ก,๐‘ก = 1, . . . , ๐‘‡ and the modelโ€™s unknown para-meters๐œ‡0,๐œ‡1,๐œŽ0,๐œŽ1,๐‘ and ๐‘ž, as random variables. In order to make inference about these๐‘‡ + 6 variables, we need to derive the joint posterior density๐‘“(ฬƒ๐‘†๐‘‡, ๐œ‡0, ๐œ‡1, ๐œŽ20, ๐œŽ21, ๐‘, ๐‘ž | ๐œ“๐‘‡), where ๐œ“๐‘‡ := (๐‘ฆ1, ๐‘ฆ2, . . . , ๐‘ฆ๐‘‡) and ฬƒ๐‘†๐‘‡ = (๐‘†1, ๐‘†2, . . . , ๐‘†๐‘‡). Namely the realization of the Gibbs sampling relies on the derivation of the distributions of each of the above๐‘‡ + 6 variables, conditional on all the other variables. Therefore we can approximate the joint posterior density written above by running the following procedure๐ฟ + ๐‘€ times, where ๐ฟ is an integer large enough to guarantee the desired convergence. Hence we have the following scheme.

Step 1. We can derive the distribution of๐‘†๐‘ก,๐‘ก = 1, . . . , ๐‘‡

con-ditional on the other parameters in two different ways. (1) Single-move gibbs sampling: generate each ๐‘†๐‘ก from

๐‘“(๐‘†๐‘ก | ฬƒ๐‘† ฬธ=๐‘ก, ๐œ‡0, ๐œ‡1, ๐œŽ2

0, ๐œŽ12, ๐‘, ๐‘ž, ๐œ“๐‘‡), ๐‘ก = 1, . . . , ๐‘‡, where

ฬƒ๐‘†ฬธ=๐‘ก= (๐‘†1, . . . , ๐‘†๐‘กโˆ’1, ๐‘†๐‘ก+1, . . . , ๐‘†๐‘‡).

(2) Multi-move gibbs sampling: generate the whole block ฬƒ๐‘†๐‘‡from๐‘“(ฬƒ๐‘†๐‘‡| ๐œ‡0, ๐œ‡1, ๐œŽ02, ๐œŽ12, ๐‘, ๐‘ž, ๐œ“๐‘‡).

Step 2. Generate the transition probabilities๐‘ and ๐‘ž from

๐‘“(๐‘, ๐‘ž | ฬƒ๐‘†๐‘‡). Note that this distribution is conditioned only on ฬƒ๐‘†๐‘‡because we assume that๐‘ and ๐‘ž are independent of both the other parameters of the model and the data,๐œ“๐‘‡.

If we choose the Beta distribution as prior distribution for both๐‘ and ๐‘ž, we have that posterior distribution ๐‘“(๐‘, ๐‘ž | ฬƒ๐‘†๐‘‡) = ๐‘“(๐‘, ๐‘ž)๐ฟ(๐‘, ๐‘ž | ฬƒ๐‘†๐‘‡) is again a Beta distribution. So,

Beta distribution is a conjugate prior for the likelihood of transition probabilities.

Step 3. Generate๐œ‡0 and๐œ‡1 from๐‘“(๐œ‡0, ๐œ‡1 | ฬƒ๐‘†๐‘‡, ๐œŽ02, ๐œŽ12, ๐‘, ๐‘ž,

๐œ“๐‘‡). In this case the conjugate prior is the Normal distribution.

Step 4. Generate๐œŽ20 and๐œŽ12 from๐‘“(๐œŽ02, ๐œŽ21 | ฬƒ๐‘†๐‘‡, ๐œ‡0, ๐œ‡1, ๐‘, ๐‘ž,

๐œ“๐‘‡). From definition of the model we have that ๐œŽ2

1 = ๐œŽ20(1 +

โ„Ž1): we can first generate ๐œŽ2

0 conditional on โ„Ž1, and then

generateโ„Ž1 = 1 + โ„Ž1conditional on๐œŽ02. We use in both cases the Inverted Gamma distribution as conjugate prior for the parameters.

For a more detailed description of these steps (see [6, pp. 211โ€“218]). Here we examine only the so called

Multi-move Gibbs sampling, originally motivated by Carter and

Kohn (see [15]) in the context of state space models and then implemented in [6] for a MSM. For the sake of simplicity,

let us suppress the conditioning on modelโ€™s parameters and denote

๐‘“ (ฬƒ๐‘†๐‘‡| ๐œ“๐‘‡) := ๐‘“ (ฬƒ๐‘†๐‘‡| ๐œ‡0, ๐œ‡1, ๐œŽ02, ๐œŽ12, ๐‘, ๐‘ž, ๐œ“๐‘‡) . (38) Using the Markov property of{๐‘†๐‘ก}๐‘กโˆˆ{1,...,๐‘‡} it can be seen that

๐‘“ (ฬƒ๐‘†๐‘‡| ๐œ“๐‘‡) = ๐‘“ (๐‘†๐‘‡| ๐œ“๐‘‡)๐‘‡โˆ’1โˆ

๐‘ก=1

๐‘“ (๐‘†๐‘ก| ๐‘†๐‘ก+1, ๐œ“๐‘ก) , (39) where ๐‘“(๐‘†๐‘‡ | ๐œ“๐‘‡) = P(๐‘†๐‘‡ | ๐œ“๐‘‡) is provided by the last iteration of filtering algorithm (see Sections2.1and2.2). Note that(39)suggests that we can first generate๐‘†๐‘‡conditional on ๐œ“๐‘‡and then, for๐‘ก = ๐‘‡ โˆ’ 1, ๐‘‡ โˆ’ 2, . . . , 1, we can generate ๐‘†๐‘ก

conditional on๐œ“๐‘กand๐‘†๐‘ก+1, namely we can run the following steps.

Step 1. Run the basic filter procedure to get๐‘“(๐‘†๐‘ก | ๐œ“๐‘ก), ๐‘ก =

1, 2, . . . , ๐‘‡ and save them; the last iteration of the filter gives us the probability distribution๐‘“(๐‘†๐‘‡ | ๐œ“๐‘‡), from which ๐‘†๐‘‡is generated.

Step 2. Note that

๐‘“ (๐‘†๐‘ก| ๐‘†๐‘ก+1, ๐œ“๐‘ก) = ๐‘“ (๐‘†๐‘ก, ๐‘†๐‘ก+1| ๐œ“๐‘ก) ๐‘“ (๐‘†๐‘ก+1| ๐œ“๐‘ก) = ๐‘“ (๐‘†๐‘ก+1| ๐‘†๐‘ก, ๐œ“๐‘ก) ๐‘“ (๐‘†๐‘ก| ๐œ“๐‘ก) ๐‘“ (๐‘†๐‘ก+1| ๐œ“๐‘ก) = ๐‘“ (๐‘†๐‘ก+1| ๐‘†๐‘ก) ๐‘“ (๐‘†๐‘ก| ๐œ“๐‘ก) ๐‘“ (๐‘†๐‘ก+1| ๐œ“๐‘ก) โˆ ๐‘“ (๐‘†๐‘ก+1| ๐‘†๐‘ก) ๐‘“ (๐‘†๐‘ก| ๐œ“๐‘ก) , (40) where๐‘“(๐‘†๐‘ก+1| ๐‘†๐‘ก) is the transition probability and ๐‘“(๐‘†๐‘ก| ๐œ“๐‘ก) has been saved from Step 1. So we can generate ๐‘†๐‘ก in the following way, first calculate

P (๐‘†๐‘ก= 1 | ๐‘†๐‘ก+1, ๐œ“๐‘ก)

= ๐‘“ (๐‘†๐‘ก+1| ๐‘†๐‘ก= 1) ๐‘“ (๐‘†๐‘ก= 1 | ๐œ“๐‘ก) โˆ‘1๐‘—=0๐‘“ (๐‘†๐‘ก+1| ๐‘†๐‘ก= ๐‘—) ๐‘“ (๐‘†๐‘ก= ๐‘— | ๐œ“๐‘ก),

(41)

and then generate๐‘†๐‘กusing a uniform distribution. For exam-ple, we generate a random number from a uniform distri-bution between 0 and 1; if this number is less than or equal to the calculated value ofP(๐‘†๐‘ก = 1 | ๐‘†๐‘ก+1, ๐œ“๐‘ก), we set ๐‘†๐‘ก = 1, otherwise,๐‘†๐‘กis set equal to 0.

In view of applications, let us now consider the following

four state MSM:

๐‘ฆ๐‘กโˆผ N (0, ๐œŽ๐‘†2๐‘ก) , ๐‘ก = 1, 2, . . . , ๐‘‡,

๐œŽ๐‘†๐‘ก= ๐œŽ1๐‘†1,๐‘ก+ ๐œŽ2๐‘†2,๐‘ก+ ๐œŽ3๐‘†3,๐‘ก+ ๐œŽ4๐‘†4,๐‘ก,

๐‘†๐‘กโˆˆ {1, 2, 3, 4} with transition probabilities ๐‘๐‘–๐‘—:= P (๐‘†๐‘ก= ๐‘— | ๐‘†๐‘กโˆ’1= ๐‘–) , ๐‘–, ๐‘— = 1, 2, 3, 4,

(42)

where๐‘†๐‘˜,๐‘ก = 1 if ๐‘†๐‘ก = ๐‘˜, otherwise ๐‘†๐‘˜,๐‘ก = 0. Note that this is a particular case of the model analysed inSection 2.1, where

(8)

๐œ‡๐‘ก = 0 โˆ€๐‘ก, hence we can perform the procedure referred to serially uncorrelated data taking๐œ‡๐‘†๐‘ก= ๐œ‡ = 0 to start the Gibbs sampling algorithm, therefore we have

Step 1. Generate ฬƒ๐‘†๐‘‡ := (๐‘†1, ๐‘†2, . . . , ๐‘†๐‘‡) conditional on ฬƒ๐œŽ2 :=

(๐œŽ2

1, ๐œŽ22, ๐œŽ32, ๐œŽ42),

ฬƒ๐‘ := (๐‘11, ๐‘12, ๐‘13, ๐‘21, ๐‘22, ๐‘23, ๐‘31, ๐‘32, ๐‘33, ๐‘41, ๐‘42, ๐‘43) ,

๐œ“๐‘‡:= (๐‘ฆ1, ๐‘ฆ2, . . . , ๐‘ฆ๐‘‡) .

(43) For this purpose, we employ the Multi-move Gibbs sam-pling algorithm:

(1) run procedure inSection 2.1with๐œ‡๐‘†๐‘ก = 0 in order to get, from last iteration,๐‘“(๐‘†๐‘‡| ๐œ“๐‘‡) = P(๐‘†๐‘‡| ๐œ“๐‘‡), (2) recalling that๐‘“(๐‘†๐‘ก| ๐‘†๐‘ก+1, ๐œ“๐‘ก) โˆ ๐‘“(๐‘†๐‘ก+1| ๐‘†๐‘ก)๐‘“(๐‘†๐‘ก| ๐œ“๐‘ก)

for๐‘ก = ๐‘‡โˆ’1, . . . , 1, we can generate ๐‘†๐‘กfrom the vector of probabilities (P (๐‘†๐‘ก= 1 | ๐‘†๐‘ก+1, ๐œ“๐‘ก) , P (๐‘†๐‘ก= 2 | ๐‘†๐‘ก+1, ๐œ“๐‘ก) , P (๐‘†๐‘ก= 3 | ๐‘†๐‘ก+1, ๐œ“๐‘ก) , P (๐‘†๐‘ก= 4 | ๐‘†๐‘ก+1, ๐œ“๐‘ก)) , (44) where, for๐‘– = 1, . . . , 4, P (๐‘†๐‘ก= ๐‘–๐‘†๐‘ก+1, ๐œ“๐‘ก) = ๐‘“ (๐‘†๐‘ก+1๐‘†๐‘ก= 1) ๐‘“ (๐‘†๐‘ก= ๐‘–๐œ“๐‘ก) โˆ‘3๐‘—=1๐‘“ (๐‘†๐‘ก+1๐‘†๐‘ก= ๐‘—) ๐‘“ (๐‘†๐‘ก= ๐‘—๐œ“๐‘ก). (45)

Step 2. Generateฬƒ๐œŽ2, conditional on ฬƒ๐‘†๐‘‡and the data๐œ“๐‘‡.

We want to impose the constraint๐œŽ12 < ๐œŽ22< ๐œŽ23 < ๐œŽ42, so we redefine๐œŽ๐‘†2๐‘กin this way:

๐œŽ2๐‘†๐‘ก= ๐œŽ21(1 + ๐‘†2,๐‘กโ„Ž2) (1 + ๐‘†3,๐‘กโ„Ž2) (1 + ๐‘†3,๐‘กโ„Ž3) ร— (1 + ๐‘†4,๐‘กโ„Ž2) (1 + ๐‘†4,๐‘กโ„Ž3) (1 + ๐‘†4,๐‘กโ„Ž4) ,

(46)

whereโ„Ž๐‘— > 0 for ๐‘— = 1, . . . , 4, so that ๐œŽ22 := ๐œŽ12(1 + โ„Ž2), ๐œŽ32 := ๐œŽ2

1(1+โ„Ž2)(1+โ„Ž3) and ๐œŽ24 := ๐œŽ21(1+โ„Ž2)(1+โ„Ž3)(1+โ„Ž4). With this

specification, we first generate๐œŽ21, then generateโ„Ž2 = 1 + โ„Ž2, โ„Ž3 = 1 + โ„Ž3 andโ„Ž4 = 1 + โ„Ž4 to obtain๐œŽ22,๐œŽ32and๐œŽ24 indi-rectly.

Generating๐œŽ12, Conditional onโ„Ž2,โ„Ž3 andโ„Ž4. Define for๐‘ก =

1, . . . , ๐‘‡

๐‘Œ๐‘ก1:= ๐‘ฆ๐‘ก

โˆš(1 + ๐‘†2,๐‘กโ„Ž2) (1 + ๐‘†3,๐‘กโ„Ž2) (1 + ๐‘†3,๐‘กโ„Ž3) (1 + ๐‘†4,๐‘กโ„Ž2) (1 + ๐‘†4,๐‘กโ„Ž3) (1 + ๐‘†4,๐‘กโ„Ž4) (47)

and take๐‘Œ1๐‘ก โˆผ N(0, ๐œŽ21), in(42). By choosing an inverted

Gamma prior distribution, that is,๐‘“(๐œŽ12 | โ„Ž2, โ„Ž3, โ„Ž4) โˆผ IG(]1/

2, ๐›ฟ1/2) where ]1, ๐›ฟ1are the known prior hyperparameters, it can be shown that the conditional posterior distribution from which we generate๐œŽ12is given by:

๐œŽ12| ๐œ“๐‘‡, ฬƒ๐‘†๐‘‡, โ„Ž2, โ„Ž3, โ„Ž4โˆผ IG (]1+ ๐‘‡

2 ,

๐›ฟ1+ โˆ‘๐‘‡๐‘ก=1๐‘Œ1 ๐‘ก

2 ) . (48)

Generatingโ„Ž2 Conditional on๐œŽ21,โ„Ž3 andโ„Ž4. Note that the

likelihood function ofโ„Ž2depends only on the values of๐‘ฆ๐‘กfor which๐‘†๐‘ก โˆˆ {2, 3, 4}. Therefore, take ๐‘ฆ๐‘ก(1) := {๐‘ฆ๐‘ก | ๐‘†๐‘ก โˆˆ {2, 3, 4}, ๐‘ก = 1, . . . , ๐‘‡} and denote with ๐‘‡2the size of this sample. Then define

๐‘Œ๐‘ก2:= ๐‘ฆ๐‘ก(1)

โˆš๐œŽ2

1(1 + ๐‘†3,๐‘กโ„Ž3) (1 + ๐‘†4,๐‘กโ„Ž3) (1 + ๐‘†4,๐‘กโ„Ž4)

, (49) hence, for the observation in which๐‘†๐‘ก = 2, 3 or 4, we have ๐‘Œ2๐‘กโˆผ N(0, โ„Ž2). If we choose an inverted Gamma distribution

with parameters]2, ๐›ฟ2 for the prior, we obtainโ„Ž2 = 1 + โ„Ž2 from the following posterior distribution:

โ„Ž2| ๐œ“๐‘‡, ฬƒ๐‘†๐‘‡, ๐œŽ12, โ„Ž3, โ„Ž4โˆผ IG (]2+ ๐‘‡2

2 ,

๐›ฟ2+ โˆ‘๐‘‡2

๐‘ก=1๐‘Œ๐‘ก2

2 ) . (50)

In caseโ„Ž2> 1 put โ„Ž2= โ„Ž2โˆ’1 and ๐œŽ22:= ๐œŽ21(1+โ„Ž2). Otherwise reiterate this step.

Generatingโ„Ž3 Conditional on๐œŽ21,โ„Ž2 andโ„Ž4. Operate in a

similar way as above. In particular if we define๐‘ฆ๐‘ก(2) := {๐‘ฆ๐‘ก | ๐‘†๐‘กโˆˆ {3, 4}, ๐‘ก = 1, . . . , ๐‘‡} we will obtain ๐‘Œ๐‘ก3:= ๐‘ฆ๐‘ก(2) โˆš๐œŽ2 1(1 + ๐‘†3,๐‘กโ„Ž2) (1 + ๐‘†4,๐‘กโ„Ž2) (1 + ๐‘†4,๐‘กโ„Ž4) โˆผ N (0, โ„Ž3) . (51)

Generatingโ„Ž4 Conditional on๐œŽ21,โ„Ž2 andโ„Ž3. Operate in a

similar way as above. In particular if we define๐‘ฆ๐‘ก(3) := {๐‘ฆ๐‘ก | ๐‘†๐‘ก= 4, ๐‘ก = 1, . . . , ๐‘‡} we will have

๐‘Œ๐‘ก4:= ๐‘ฆ๐‘ก(3)

โˆš๐œŽ2

1(1 + ๐‘†4,๐‘กโ„Ž2) (1 + ๐‘†4,๐‘กโ„Ž3)

โˆผ N (0, โ„Ž4) . (52)

Step 3. Generateฬƒ๐‘ conditional on ฬƒ๐‘†๐‘‡. In order to generate the

transition probabilities we exploit the properties of the prior

Beta distribution. Let us first define

๐‘๐‘–๐‘–:= P (๐‘†๐‘ก ฬธ= ๐‘– | ๐‘†๐‘กโˆ’1= ๐‘–) = 1 โˆ’ ๐‘๐‘–๐‘–, ๐‘– = 1, 2, 3, 4; ๐‘๐‘–๐‘—:= P (๐‘†๐‘ก= ๐‘— | ๐‘†๐‘กโˆ’1= ๐‘–, ๐‘†๐‘ก ฬธ= ๐‘–) , ๐‘– ฬธ= ๐‘—. (53)

(9)

Hence we have that

๐‘๐‘–๐‘—:= P (๐‘†๐‘ก= ๐‘— | ๐‘†๐‘กโˆ’1= ๐‘–)

= P (๐‘†๐‘ก= ๐‘— | ๐‘†๐‘กโˆ’1= ๐‘–, ๐‘†๐‘ก ฬธ= ๐‘–) P (๐‘†๐‘ก ฬธ= ๐‘– | ๐‘†๐‘กโˆ’1= ๐‘–) = ๐‘๐‘–๐‘—(1 โˆ’ ๐‘๐‘–๐‘–) โˆ€๐‘– ฬธ= ๐‘—.

(54)

Given ฬƒ๐‘†๐‘‡, let๐‘›๐‘–๐‘—,๐‘–, ๐‘— = 1, 2, 3, 4 be the total number of tran-sitions from state๐‘†๐‘กโˆ’1= ๐‘– to ๐‘†๐‘ก= ๐‘—, ๐‘ก = 2, 3, . . . , ๐‘‡ and ๐‘›๐‘–๐‘—the number of transitions from state๐‘†๐‘กโˆ’1= ๐‘– to ๐‘†๐‘ก ฬธ= ๐‘—.

Begin with the generation of probabilities๐‘๐‘–๐‘–,๐‘– = 1, 2, 3, 4 by taking the Beta distribution as conjugate prior: if we take ๐‘๐‘–๐‘–โˆผ Beta(๐‘ข๐‘–๐‘–, ๐‘ข๐‘–๐‘–), where ๐‘ข๐‘–๐‘–and๐‘ข๐‘–๐‘–are the known

hyperpara-meters of the priors, the posterior distribution of๐‘๐‘–๐‘–given ฬƒ๐‘†๐‘‡ still belongs to the Beta family distributions, that is,

๐‘๐‘–๐‘–| ฬƒ๐‘†๐‘‡โˆผ Beta (๐‘ข๐‘–๐‘–+ ๐‘›๐‘–๐‘–, ๐‘ข๐‘–๐‘–+ ๐‘›๐‘–๐‘–) , ๐‘– = 1, 2, 3, 4. (55) The others parameters, that is,๐‘๐‘–๐‘—for๐‘– ฬธ= ๐‘— and ๐‘— = 1, 2, 3, can be computed from the above equation๐‘๐‘–๐‘— = ๐‘๐‘–๐‘—(1 โˆ’ ๐‘๐‘–๐‘–), where ๐‘๐‘–๐‘— are generated from the following posterior Beta distribution:

๐‘๐‘–๐‘—| ฬƒ๐‘†๐‘‡โˆผ Beta (๐‘ข๐‘–๐‘—+ ๐‘›๐‘–๐‘—, ๐‘ข๐‘–๐‘—+ ๐‘›๐‘–๐‘—) . (56) For example, given that๐‘11is generated, we can obtain๐‘12 and๐‘13by considering

๐‘12| ฬƒ๐‘†๐‘‡โˆผ Beta (๐‘ข12+ ๐‘›12, ๐‘ข12+ ๐‘›12) ,

๐‘13| ฬƒ๐‘†๐‘‡โˆผ Beta (๐‘ข13+ ๐‘›13, ๐‘ข13+ ๐‘›13) , (57) where๐‘›12= ๐‘›13+๐‘›14and๐‘›13= ๐‘›12+๐‘›14. Finally, given๐‘11,๐‘12 and๐‘13generated in this way, we have๐‘14 = 1โˆ’๐‘11โˆ’๐‘12โˆ’๐‘13.

Remark 2. When we do not have any information about

priors distribution we employ hyperparameters ๐‘ข๐‘–๐‘— = 0.5, ๐‘–, ๐‘— = 1, 2, 3, 4. Usually we know that elements of the matrix diagonal in the transition matrix are bigger than elements out of the diagonal, because in a financial framework regime switching happens only occasionally: in this case, since we want๐‘๐‘–๐‘–close to 1 and๐‘๐‘–๐‘—,๐‘– ฬธ= ๐‘—, close to 0, we will choose ๐‘ข๐‘–๐‘–bigger than๐‘ข๐‘–๐‘–.

4. Goodness of Fit

Since financial time series are characterized by complex and rather unpredictable behavior, it is difficult to find, if there is any, a possible pattern. A typical set of techniques which allow to measure the goodness of forecasts obtained by using a certain model, is given by the residual analysis. Let us suppose that we are provided with a time series of return observations {๐‘ฆ๐‘ก}๐‘ก=1,...,๐‘‡,๐‘‡ โˆˆ N+, for which we choose, for example, the

model described in(4)with๐‘€ = 4. By running the procedure ofSection 2.1we obtain the filtered probabilities

P (๐‘†๐‘ก= ๐‘— | ๐œ“๐‘ก) , ๐‘— = 1, 2, 3, 4, ๐‘ก = 1, . . . , ๐‘‡, (58) and, by maximization of the log-likelihood function, we compute the parameters ฬ‚๐œ‡1, . . . , ฬ‚๐œ‡4, ฬ‚๐œŽ1, . . . , ฬ‚๐œŽ4, therefore we

can estimate both the mean and variance of the process at time๐‘ก, for any ๐‘ก = 1, . . . , ๐‘‡, given the information set ๐œ“๐‘กas weighted average of four values:

ฬ‚๐œ‡๐‘ก:= E (๐œ‡๐‘ก| ๐œ“๐‘ก) := ฬ‚๐œ‡1P (๐‘†๐‘ก= 1 | ๐œ“๐‘ก)

+ โ‹… โ‹… โ‹… + ฬ‚๐œ‡4P (๐‘†๐‘ก= 4 | ๐œ“๐‘ก) , ฬ‚๐œŽ๐‘ก2:= E (๐œŽ๐‘ก2| ๐œ“๐‘ก) := ฬ‚๐œŽ12P (๐‘†๐‘ก= 1 | ๐œ“๐‘ก)

+ โ‹… โ‹… โ‹… + ฬ‚๐œŽ42P (๐‘†๐‘ก= 4 | ๐œ“๐‘ก) .

(59)

If the chosen model fits well the data, then the standardized residuals will have the following form:

ฬ‚๐œ–๐‘ก=๐‘ฆ๐‘กโˆ’ ฬ‚๐œ‡๐‘ก

ฬ‚๐œŽ๐‘ก โˆผ N (0, 1) , ๐‘ก = 1, . . . , ๐‘‡, (60)

therefore it is natural to apply a normality test as, for example, the Jarque-Bera test (see [18]) for details. We recall briefly that Jarque-Bera statistics is defined as

JB:= ๐‘‡ 6 (๐‘†2โˆ’

1

4(๐พ โˆ’ 3)2) , (61) where the parameters๐‘† and ๐พ indicate the skewness, respec-tively, the kurtosis ofฬ‚๐œ–๐‘ก. Ifฬ‚๐œ–๐‘กcome from a Normal distribu-tion, the Jarque-Bera statistics converges asymptotically to a chi-squared distribution with two degrees of freedom, and can be used to test the null hypothesis of normality: this is a joint hypothesis of the skewness being zero and the excess kurtosis(๐พ โˆ’ 3) being also zero.

Remark 3. Note that the Jarque-Bera test is very sensitive

and often rejects the null hypothesis only because of a few abnormal observations, this is the reason why, one has to take point out these outliers which has to be canceled out before apply the test on the obtained smoothed data.

5. Prediction

The forecasting task is the most difficult step in the whole MSM approach. Let us suppose that our time series ends at time๐‘‡ โˆˆ N+, without further observations, then we have to start the prediction with the following quantities:

(i) the transition probability matrix๐‘ƒโˆ—:= {๐‘๐‘–๐‘—}๐‘–,๐‘—=1,2,3,4; (ii) the vector ๐œ‹๐‘‡ := P(๐‘†๐‘‡ | ๐œ“๐‘‡) = (P(๐‘†๐‘‡ = 1 |

๐œ“๐‘‡), . . . , P(๐‘†๐‘‡ = 4 | ๐œ“๐‘‡)) obtained from the last iteration of the filter algorithm, for example, the procedure inSection 2.1.

It follows that we have to proceed with the first step of the filter procedure obtaining the one-step ahead probability of the state๐‘†๐‘‡+1given the sample of observations๐œ“๐‘‡, that is,

P (๐‘†๐‘‡+1= ๐‘— | ๐œ“๐‘‡) =โˆ‘4

๐‘–=1

๐‘๐‘–๐‘—P (๐‘†๐‘‡= ๐‘— | ๐œ“๐‘‡) , ๐‘— = 1, 2, 3, 4. (62) Equation (62) can be seen as a prediction for the regime at time๐‘‡ + 1, knowing observations up to time ๐‘‡. At this

(10)

point, the best way to make prediction about the unobserved variable is the simulation of further observations. Indeed, with the new probability P(๐‘†๐‘‡+1 | ๐œ“๐‘‡) and the vector of parameter estimates ฬ‚๐œƒ := (ฬ‚๐œ‡1, . . . , ฬ‚๐œ‡4, ฬ‚๐œŽ1, . . . , ฬ‚๐œŽ4) we can estimate the one step ahead mean and variance as follows:

ฬ‚๐œ‡๐‘‡+1:= E (๐œ‡๐‘‡+1| ๐œ“๐‘‡) := ฬ‚๐œ‡1P (๐‘†๐‘‡+1= 1 | ๐œ“๐‘‡) + โ‹… โ‹… โ‹… + ฬ‚๐œ‡4P (๐‘†๐‘‡+1= 4 | ๐œ“๐‘‡) , ฬ‚๐œŽ2 ๐‘‡+1:= E (๐œŽ2๐‘‡+1| ๐œ“๐‘‡) := ฬ‚๐œŽ12P (๐‘†๐‘‡+1= 1 | ๐œ“๐‘‡) + โ‹… โ‹… โ‹… + ฬ‚๐œŽ42P (๐‘†๐‘‡+1= 4 | ๐œ“๐‘‡) . (63) Then we simulate ฬ‚๐‘ฆ๐‘‡+1by the Gaussian distributionN(ฬ‚๐œ‡๐‘‡+1, ฬ‚๐œŽ๐‘‡+1) and, once ฬ‚๐‘ฆ๐‘‡+1 has been simulated, we defe๐œ“๐‘‡+1 := {๐‘ฆ1, . . . , ๐‘ฆ๐‘‡, ฬ‚๐‘ฆ๐‘‡+1}. Then we first apply again the filter proce-dure ofSection 2.1for๐‘ก = ๐‘‡ + 1 in order to obtain P(๐‘†๐‘‡+1 | ๐œ“๐‘‡+1), then we compute P(๐‘†๐‘‡+1 | ๐œ“๐‘‡+1), ฬ‚๐œ‡๐‘‡+2and ฬ‚๐œŽ๐‘‡+22 , and

we simulateฬ‚๐‘ฆ๐‘‡+2by the Gaussian distributionN(ฬ‚๐œ‡๐‘‡+2, ฬ‚๐œŽ๐‘‡+2). Latter procedure runs the same all the other rime-steps๐‘‡ + 3, . . . , ๐‘‡+๐‘š, where ๐‘š โˆˆ N+is the time horizon of our forecast.

Remark 4. We would like to underline that latter described

method is not reliable with few simulations since each๐‘ฆ๐‘‡+๐œ, for๐œ = 1, . . . , ๐‘š may assume a wide range of values and a single drawn describes only one of the many possible paths. So we can think to reiterate previous strategy many times in order to compute the mean behavior ofP(๐‘†๐‘‡+๐œ | ๐œ“๐‘‡+๐œ), ฬ‚๐œ‡๐‘‡+๐œandฬ‚๐œŽ๐‘‡+๐œ. After having obtained a satisfactory number of

data, then we can construct a confidence interval within the state probability will more likely take value. Obviously a high number of iterations of latter procedure rapidly increases the computational complexity of the whole algorithm because of the MLE related computational complexity, therefore we will adopt a rather different strategy which consists in simulating ๐‘ฆ๐‘‡+๐œ ๐‘ times at each step (e.g., ๐‘ = 10000) and then taking the mean over those values. However, we must pay attention because the mean calculation could cancel the possible regime switching: for example, if we draw many times๐‘ฆ๐‘กfromN(0, ๐œŽ๐‘†๐‘ก) and we take the mean, by the law of large number we will have zero at any time. To overcome this problem we can take the mean of absolute values and then multiply this mean by a number๐‘ฅ, which is a random variable that takes values 1 orโˆ’1, with equal probability, hence deciding the sign of๐‘ฆ๐‘กat every simulation step.

6. Applications

In this section we are going to apply the classical inference approach for a MSM to analyse real financial time series. In particular we will first examine data coming from the Standard & Poorโ€™s 500 (S&P 500) equity index which is con-sidered, being based on the 500 most important companies in the United States, as one of the best representations of the U.S. stock market. Secondly, we shall consider the DAX (Deutsche Aktien Index) index which follows the quotations of the 30 major companies in Germany. Our choice is motivated by

a twofold goal: first we want to test the proposed 4-states MSM model on two particularly significant indexes which have shown to incorporate abrupt changes and oscillations, secondly we aim at comparing the behaviour of the two indexes between each other.

Computations have been performed following the MSM approach described in previous section, namely exploiting the procedures illustrated inSection 2. Let us underline that, instead of a standard 3-states MSM model, we shall use a 4-states MSM approach both for the S&P 500 and the DAX returns. Moreover the analysis has been realized for different intervals of time, focusing mainly on the period of Global Financial Crisis.

6.1. The S&P 500 Case. Figure 1 reports the graph of the

Standard & Poorโ€™s 500 from 1st June 1994 to 27th May 2014, and it points out the dramatic collapse of index prices in years 2008-2009, when the crisis blowed-up causing the achievement, 6th of March 2009 with 683.38 points, of the lowest value since September 1996.

Because of the latter fact we decided to focus our analysis on recent years. In particular we take into account data starting from the 1st of June 2007, and until 27 May 2014, therefore, denoting withฮ› the set of observations and with ๐‘‹๐‘ก,๐‘ก โˆˆ ฮ›, the price data of the S&P 500, returns are calculated as usual by๐‘ฆ๐‘ก := (๐‘‹๐‘กโˆ’ ๐‘‹๐‘กโˆ’1)/๐‘‹๐‘กโˆ’1,๐‘ก โˆˆ ฮ›, where {๐‘ฆ๐‘ก}๐‘กโˆˆฮ› are the values for which we want to choose the best MSM. Note that in our implementation we grouped the daily data into weekly parcels in order to make the filter procedures less time-consuming and have a more clear output, therefore we obtain a vector of 365 values, still denoted by๐‘ฆ๐‘ก, as shown in

Figure 2.

Next step consists in understand if the returns are serially correlated or serially uncorrellated, a taks which can be accomplished by running some suitable test, for example, the Durbin-Watson test (see, for example, [19,20] or [7]) com-puting directly the value of the autoregressive parameter๐œ™ by least square methods, namely๐œ™ := (โˆ‘๐‘กโˆˆฮ›๐‘ฆ๐‘ก๐‘ฆ๐‘ก+1)/(โˆ‘๐‘กโˆˆฮ›๐‘ฆ๐‘ก2), which gives us a rather low value, that is,โˆ’0.0697, so that we can neglect the autoregressive pattern and start the analysis by considering S&P 500 returns to be generated by a Gaussian distribution with switching mean and variance, that is,

๐‘ฆ๐‘ก= ๐œ‡๐‘†๐‘ก+ ๐œ–๐‘ก, ๐‘ก โˆˆ ฮ› {๐œ–๐‘ก}๐‘กโˆˆ{1,...,๐‘‡} are i.i.d. N (0, ๐œŽ2๐‘†๐‘ก) , ๐œ‡๐‘†๐‘ก= ๐œ‡1๐‘†1,๐‘ก+ โ‹… โ‹… โ‹… + ๐œ‡4๐‘†4,๐‘ก, ๐œŽ๐‘†๐‘ก= ๐œŽ1๐‘†1,๐‘ก+ โ‹… โ‹… โ‹… + ๐œŽ4๐‘†4,๐‘ก, ๐‘†๐‘กโˆˆ {1, . . . , 4} with probabilities ๐‘๐‘–๐‘—, (64)

where for(๐‘˜, ๐‘ก) โˆˆ {1, . . . , 4} ร— ฮ› we have ๐‘†๐‘˜,๐‘ก = 1 if ๐‘†๐‘ก = ๐‘˜, otherwise ๐‘†๐‘˜,๐‘ก = 0. Therefore, we suppose that the state variable๐‘†๐‘ก,๐‘ก โˆˆ ฮ›, takes its values in the set ฮฉ := {1, 2, 3, 4}, and we expect that the probabilities of being in the third and fourth state increase as a financial crisis occurs. Exploiting the procedure provided inSection 2.1, with respect to the returns

(11)

17-May-1994400 19-Jan-2001 24-Sep-2007 29-May-2014 600 800 1000 1200 1400 1600 1800 2000 S&P500

Figure 1: Daily observations of S&P 500 from 1994 to 2014.

07-Jun-2007 04-Oct-2009 01-Feb-2012 31-May-2014

0 0.05 0.1 0.15

Weekly returns S&P500 โˆ’0.2

โˆ’0.15 โˆ’0.1 โˆ’0.05

Figure 2: Daily returns of S&P 500 from 2007 to 2014.

๐‘ฆ๐‘ก,๐‘ก โˆˆ ฮ› = {1, . . . , 365}, we get the results shown in Figures3

and4.

Let us now consider the estimated standard deviation ฬ‚๐œŽ๐‘ก:= E (๐œŽ๐‘ก| ๐œ“๐‘ก) := ฬ‚๐œŽ1P (๐‘†๐‘ก= 1 | ๐œ“๐‘ก)

+ โ‹… โ‹… โ‹… + ฬ‚๐œŽ4P (๐‘†๐‘ก= 4 | ๐œ“๐‘ก) , ๐‘ก โˆˆ ฮ›, (65) which we want to compare with the VIX index, also known as the Chicago Board Options Exchange (CBOE) market volatility index, namely one of the most relevant measure for the implied volatility of the S&P 500 index, whose value used by our analysis are reported inFigure 5.

What we obtain by plotting both estimated volatility and VIX values in the same graph can be seen inFigure 6, where the VIX trend is plotted in red, while we have used the blue color for the conditional standard deviation values.

Note that, in order to have values of the same order, each ฬ‚๐œŽ๐‘ก, ๐‘ก โˆˆ ฮ›, has been multiplied by a scale factor equal to

1000. We would like to point out how the estimated standard deviation accurately approximates the VIX behaviour, hence allow us to count on an effective substitute for the volatility of the S&P 500, at least during a relative nonchaotic period. In fact we also underline that the greater discrepancies between real and simulated values appears during the maximum intensity period of the recent financial crisis. In particular the widest gaps are realized in correspondence with the recession experienced at the end of 2008.

In what follows we study how latter evidence influences the global goodness of the realized analysis. In particular we performed a goodness of fit analysis computing the standardized residuals of the proposed MSM byฬ‚๐œ–๐‘ก := (๐‘ฆ๐‘กโˆ’ ฬ‚๐œ‡๐‘ก)/ฬ‚๐œŽ๐‘ก,๐‘ก โˆˆ ฮ›, where ๐‘ฆ๐‘กis the observation of S&P 500 return

at time๐‘ก, ฬ‚๐œ‡๐‘กis the estimated conditional mean, andฬ‚๐œŽ๐‘กis the standard deviation. If the model is a good fit for the S&P 500 return, standardized residuals will be generated by a standard Gaussian distribution. In Figures7and8, we have reported both the histogram, its related graph, and the so called normal

probability plot (NPP) for the standardized residuals.

Let us recall that the purpose of the NPP is to graphically assess whether the residuals could come from a normal distribution. Indeed, if such a hypothesis holds, then the NPP

has to be linear, namely the large majority of the computed

values, that is, the blue points inFigure 8, should stay close to a particular line, which is the red dotted one inFigure 8, which is the case in our analysis apart from the three points in the left-hand corner of the graph, which correspond to the minimal values of the vector of standardized residuals.

Applying two normality tests on {ฬ‚๐œ–๐‘ก}๐‘กโˆˆฮ›, that is, the

Jarque-Bera test and (see, for example, [21, pag. 443]) the

Lilliefors test, we have that the null hypothesis of normality

for the standardized residuals can be rejected at the 5% level, unless the previous pointed out outliers are removed. Indeed if the two minimal standardized residuals, corresponding to ฬ‚๐œ–71 = โˆ’3.8441 and ฬ‚๐œ–153 = โˆ’3.6469, are cancelled out from the vector{ฬ‚๐œ–๐‘ก}๐‘กโˆˆฮ›, previously cited tests indicate that the

(12)

0 50 100 150 200 250 300 350 400 0 State 1 0 50 100 150 200 250 300 350 400 0 State 2 0 50 100 150 200 250 300 350 400 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 State 3 0 50 100 150 200 250 300 350 400 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 State 4

Figure 3: Filtered probabilitiesP(๐‘†๐‘ก= ๐‘˜ | ๐œ“๐‘ก) for ๐‘ก โˆˆ ฮ›, ๐‘˜ โˆˆ {1, 2, 3, 4}.

0 50 100 150 200 250 300 350 400 0 50 100 150 200 250 300 350 400 0 50 100 150 200 250 300 350 400 0 0.05 0.15 0.25 0.35 0 50 100 150 200 250 300 350 400 0 State 1 State 2 State 3 0.1 0.1 0.2 0.2 0.3 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 State 4

(13)

17-May-19940 19-Jan-2001 24-Sep-2007 29-May-2014 10 20 30 40 50 60 70 80 90 VIX

Figure 5: CBOE volatility index (VIX), daily data from 1994 to 2014.

0 50 100 150 200 250 300 350 400 10 20 30 40 50 60 70 80 VIX index Estimated volatility

Figure 6: VIX index (red) versus estimated volatility (blue).

0 50 100 150 200 250 300 350 400 0 1 2 3 4 Standardized residuals โˆ’1 โˆ’1 โˆ’2 โˆ’2 โˆ’3 โˆ’3 โˆ’4 โˆ’4 0 1 2 3 4 0 20 40 60 80 100 120

Figure 7: Plot and histogram of standardized residuals.

hypothesis of normality, at the same significance level of5%, cannot be rejected. In particular, the Jarque-Bera statistics value is JB = 2.7858 with corresponding ๐‘ƒ-value ๐‘ƒJB =

0.2153, and the critical value for this test, that is, the max-imum value of the JB statistics for which the null hypothesis cannot be rejected at the chosen significance level, is equal to๐‘˜JB = 5.8085. Similarly, with regard to the Lilliefors test,

numerical value of Liellifors statistics,๐‘ƒ-value and critical value are respectively given by๐ฟ = 0.0424, ๐‘ƒ๐ฟ = 0.1181 and ๐‘˜๐ฟ= 0.0472.

In what follows we develop the forecast procedure shown in Section 5. Since we are dealing with weekly data, let us

suppose we want to predict probability of volatilityฬ‚๐œŽ๐‘ก,๐‘ก โˆˆ ฮ› on a time horizon of two months, hence8 steps ahead, then simulations have been performed according to Remark 4, with๐‘ = 15000, ๐‘‡ = 365, ๐œ = {1, 2, . . . , 8}, and ๐‘ฅ uniformly distributed in{โˆ’1, 1}. Obtained forecasting results are shown inFigure 9, where plots are referred to the observations from the 300th to the 373rd, with the last8 simulated values within red rectangles.

6.2. The DAX Case. In what follows the proposed 4-state

MSM shall be applied to analyse the Deutsche Aktien Index (DAX) stock index during a shorter, compared to the study

(14)

0 1 2 3 0.001 0.0030.01 0.02 0.05 0.10 0.25 0.50 0.75 0.90 0.95 0.98 0.99 0.997 0.999 Data Prob abi lit y

Normal probability plot

โˆ’1 โˆ’2 โˆ’3 โˆ’4

Figure 8: Normal probability plot of standardized residuals.

0 10 20 30 40 50 60 70 80 0 0.01 0.02 0.03 Forecasted returns โˆ’0.01 โˆ’0.02 โˆ’0.03 (a) 0 10 20 30 40 50 60 70 80 0.0156 0.0158 0.016 0.0162 0.0164 0.0166 0.0168 0.017 0.0172 Forecasted volatility (b)

Figure 9: Forecast for returns (a) and conditional standard deviation (b).

09-Jan-2008 06-Jan-2009 04-Jan-2010 02-Jan-2011

0 0.05 0.1 0.15 0.2

Weekly returns DAX โˆ’0.2

โˆ’0.25

โˆ’0.15โˆ’0.1

โˆ’0.05

Figure 10: Weekly returns of DAX from 1st January 2008 to 1st January 2011.

made in Section 6.1, time interval, indeed we take into account data between the 1st of January 2008 and until the 1st of January 2011. Such a choice is motivated by the will of concentrate our attention on the most unstable period, that for the DAX index starts with the abrupt fall experienced by the European markets at the beginning of 2008. We underline that, with respect to the considered time period, the estimated autoregressive coefficient for the DAX index is a bit higher, in absolute value, than the one obtained for the S&P 500 index, indeed ฬ‚๐œ™DAX = โˆ’0.1477 versus ฬ‚๐œ™S&P500= โˆ’0.0697, so that we

decided to fit the weekly DAX returns with an autoregressive

pattern using the procedure inSection 2.2and according to the following MSM: ๐‘ฆ๐‘ก= ๐œ™ (๐‘ฆ๐‘กโˆ’1) + ๐œ–๐‘ก, ๐‘ก โˆˆ ฮ› {๐œ–๐‘ก}๐‘กโˆˆ{1,...,๐‘‡} are i.i.d. N (0, ๐œŽ2๐‘†๐‘ก) , ๐œŽ๐‘†๐‘ก= ๐œŽ1๐‘†1,๐‘ก+ โ‹… โ‹… โ‹… + ๐œŽ4๐‘†4,๐‘ก, ๐‘†๐‘กโˆˆ {1, . . . , 4} with probabilities ๐‘๐‘–๐‘—, (66)

(15)

0 20 40 60 80 100 120 140 160 00 20 40 60 80 100 120 140 160 0.05 0.15 0.25 0.35 0 20 40 60 80 100 120 140 160 0 0.05 0.15 0.25 0.35 0.45 0 20 40 60 80 100 120 140 160 0 State 1 State 2 State 3 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.1 0.2 0.2 0.3 0.3 0.4 0.4 0.5 0.6 0.7 0.8 0.9 1 State 4 0.1 0.2 0.3

Figure 11: Filtered probabilitiesP(๐‘†๐‘ก= ๐‘˜ | ๐œ“๐‘ก) for ๐‘ก โˆˆ ฮ›, ๐‘˜ โˆˆ {1, 2, 3, 4}.

0 20 40 60 80 100 120 140 160 0 20 40 60 80 100 120 140 160 0 20 40 60 80 100 120 140 160 00 20 40 60 80 100 120 140 160 State 1 State 2 State 3 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.8 0.9 1 State 4

Riferimenti

Documenti correlati

Nor can one overlook the fact that Vander at times speaks borrowing Nietzscheโ€™s voice, such as in โ€œwhere lust and its easements are concerned I am and always was beyond

A complete overview of main targets, key interactions, scores and policy options to reach integrated vector management for dengue control are provided in Table 1.. Prevention of

Digitalis Investigation Group trial (DIG) [A] and the Systolic Heart failure treatment with the I f inhibitor Ivabradine Trial

But suppose now there is a change in taxes, and from my current income level, my marginal 211 Taxes, Transfers, Labor Supply and Household Welfare... tax is lowered to 20

Socio- demographic and clinical characteristics were recorded; dysfunctional eating was tested by vali- dated questionnaires (Eating Attitude Test-EAT-26, Binge Eating Scale-BES;

dechlorination of PCDDs, PCDFs, and coplanar PCBs using metallic 294. calcium in ethanol under atmospheric pressure at room

persicae, is in accordance with previous data attesting that, in Italy, esterase insecticide resistance is based on FE4 amplification and, at least in the recent past, has proved

Rispettivamente, il Regno Unito gli investimenti in ricerca ed il trasferimento tecnologico, il Cile il sostegno allโ€™im- prenditorialitร , Israele la valorizzazione