Multivariate State Space Models: Applications Sebastian Fossati University of Alberta
Application I: Clark (1989) Clark (1987) considered the UC-ARMA(2,0) model y t = µ t + C t µ t = d t 1 + µ t 1 + ε t, ε t iid N(0, σε) 2 d t = d t 1 + ω t, ω t iid N(0, σω) 2 C t = φ 1 C t 1 + φ 2 C t 2 + η t, η t iid N(0, ση) 2 where ε t, ω t, and η t are independent white noise processes. Clark (1989) considered a bivariate unobserved components model for real output and unemployment where a single unobservable component is assumed to explain the stationary movement in both real output and unemployment. 2 / 28
Bivariate UC-0 Model The UC-0 model for real output y t = µ t + C t µ t = d + µ t 1 + ε t, ε t iid N(0, σε) 2 C t = φ 1 C t 1 + φ 2 C t 2 + η t, η t iid N(0, ση) 2 The UC-0 model for the unemployment rate u t = α 0 C t + α 1 C t 1 + τ t + ν t, ν t iid N(0, σν) 2 τ t = τ t 1 + ω t, ω t iid N(0, σω) 2 ε t, η t, ν t, and ω t are independent white noise processes. Note that the cyclical component of unemployment, u t, is α 0 C t + α 1 C t 1 (Okun s Law). 3 / 28
Bivariate UC-0 Model in SS Form Define θ t = (µ t, d t, C t, C t 1, τ t ). Then the transition equation is µ t 1 1 0 0 0 µ t 1 ε t d t 0 1 0 0 0 d t 1 0 C t = 0 0 φ 1 φ 2 0 C t 1 + η t C t 1 0 0 1 0 0 C t 2 0 τ t 0 0 0 0 1 τ t 1 ω t That is G = 1 1 0 0 0 0 1 0 0 0 0 0 φ 1 φ 2 0 0 0 1 0 0 0 0 0 0 1, W t = σε 2 0 0 0 0 0 0 0 0 0 0 0 ση 2 0 0 0 0 0 0 0 0 0 0 0 σω 2 4 / 28
Bivariate UC-0 Model in SS Form The measurement is ( ) y t = y t u t = ( with θ t = (µ t, d t, C t, C t 1, τ t ). 1 0 1 0 0 0 0 α 0 α 1 1 ) θ t + ( 0 ν t ) That is F t = ( 1 0 1 0 0 0 0 α 0 α 1 1 ), V t = ( 0 0 0 σν 2 ) 5 / 28
Bivariate UC-0 Model in SS Form > ssm1 <- function(parm){ + parm <- parm_rest(parm) + + F.mat <- matrix(rep(0,10),nr=2) + F.mat[1,c(1,3)] <- F.mat[2,5] <- 1 + F.mat[2,3:4] <- parm[6:7] + V.mat <- diag(c(1e-07,parm[8])) + G.mat <- matrix(rep(0,25),nr=5) + G.mat[1,1:2] <- G.mat[2,2] <- G.mat[4,3] <- G.mat[5,5] <- 1 + G.mat[3,3:4] <- parm[1:2] + W.mat <- diag(c(parm[4],0,parm[3],0,parm[5])) + + m0.mat <- matrix(rep(0,5),nr=5) + C0.mat <- diag(5)*10^7 + + return( dlm(ff=f.mat,v=v.mat,gg=g.mat,w=w.mat, + m0=m0.mat,c0=c0.mat) ) + } 6 / 28
Bivariate UC0 Estimates > # estimate parameters > parm.start <- c(1.53,-.57,-0.8439,-1.0788,-1,-.34,-.16,-3.5065) > fit1 <- dlmmle(y=yy,parm=parm.start,build=ssm1,hessian=t) > mod1 <- ssm1(fit1$par) > > # filter and smooth > mod1f <- dlmfilter(yy,mod1); mod1s <- dlmsmooth(mod1f) > > # get parameter estimates > drift <- mod1f$m[nobs+1,2] > covar <- dlmsvd2var(mod1f$u.c[[nobs+1]],mod1f$d.c[nobs+1,]) > coef.se <- sqrt(covar[2,2]) > drift; coef.se [1] 0.8355899 [1] 0.03875873 7 / 28
Get Filtered Trend and Cycle Estimates Since θ t = (µ t, d t, C t, C t 1, τ t ), the trend and cycle of real output are the first and third elements of the filtered estimates of θ t, respectively. The trend of the unemployment rate is the last element of the filtered estimates of θ t. > # smoothed values > yt.trend <- ts(mod1s$s[-1,1],start=1948,frequency=4) > yt.cycle <- ts(mod1s$s[-1,3],start=1948,frequency=4) > ut.trend <- ts(mod1s$s[-1,5],start=1948,frequency=4) > ut.cycle <- ut - ut.trend 8 / 28
Trend and Cycle Decomposition of Real Output > # yt: plot filtered states (trend and cycle) > plot(yt.cycle,ylim=c(-10,7),xlim=c(1948,2011)) > abline(h=0) > plot(cbind(yt,yt.trend),ylim=c(740,960),xlim=c(1948,2011), + plot.type= s,col=c("black","blue")) Cycle Log Real US GDP and Trend 10 5 0 5 750 800 850 900 950 1950 1970 1990 2010 1950 1970 1990 2010 9 / 28
Trend and Cycle Decomposition of Unemployment > # ut: plot smoothed state (trend and cycle) > plot(ut.cycle,ylim=c(-4,5),xlim=c(1948,2011)) > abline(h=0) > plot(cbind(ut,ut.trend),ylim=c(0,12),xlim=c(1948,2011), + plot.type= s,col=c("black","blue")) 4 2 0 2 4 Cycle 0 2 4 6 8 10 12 Unemployment Rate and Trend 1950 1970 1990 2010 1950 1970 1990 2010 10 / 28
The Correlated UC Model Sinclair (2009) considered a bivariate UC model where the unobserved innovations are allowed to be correlated. The model for real output and the unemployment rate is y t = µ 1t + C 1t µ 1t = d 1 + µ 1t 1 + ε 1t, ε 1t iid N(0, σ 2 ε 1 ) C 1t = φ 11 C 1t 1 + φ 21 C 1t 2 + η 1t, η 1t iid N(0, σ 2 η 1 ) u t = µ 2t + C 2t µ 2t = µ 2t 1 + ε 2t, ε 2t iid N(0, σε 2 2 ) C 2t = φ 12 C 2t 1 + φ 22 C 2t 2 + η 2t, η 2t iid N(0, ση 2 2 ) ε 1t, η 1t, ε 2t, and η 2t, are allowed to be correlated processes. 11 / 28
Application II: Bivariate Random Walk Plus Noise Consider the simple model y 1t = θ t + v 1t, v 1t iid N(0, σv 2 1 ) y 2t = θ t + v 2t, v 2t iid N(0, σv 2 2 ) θ t = θ t 1 + w t, w t iid N(0, σw 2 ) v 1t, v 2t, and w t are independent white noise processes. In this model, the observed variables y 1t and y 2t are the sum of two unobserved components, θ t and v it for i = 1, 2. 12 / 28
Bivariate RW + Noise Model in SS Form The transition equation is θ t = θ t 1 + w t The measurement is ( ) y t = y 1t y 2t = ( 1 1 ) θ t + ( v 1t v 2t ) That is G t = 1, W t = σ 2 w, F t = ( 1 1 ), V t = ( σ 2 v 1 0 0 σ 2 v 2 ) 13 / 28
Simulated Bivariate RW + Noise > # simulate random walk + noise processes > nobs <- 250 > v1t <- sqrt(3)*rnorm(nobs) # var(v) = 3 > v2t <- sqrt(2)*rnorm(nobs) # var(v) = 2 > wt <- sqrt(.5)*rnorm(nobs) # var(w) =.5 > > # simulate time series > xt <- rep(0,nobs) > xt[1] <- wt[1] > for(i in 2:nobs){ xt[i] <- xt[i-1]+wt[i] } > y1t <- as.ts(xt+v1t) > y2t <- as.ts(xt+v2t) > yy <- cbind(y1t,y2t) 14 / 28
Simulated Bivariate RW + Noise 15 10 5 0 5 y1t xt 0 50 100 150 200 250 20 10 5 0 y2t xt 0 50 100 150 200 250 15 / 28
Bivariate RW + Noise Model in SS Form > ssm2 <- function(parm){ + parm <- parm_rest(parm) + + F.mat <- matrix(rep(1,2),nr=2) + V.mat <- diag(c(parm[1],parm[2])) + G.mat <- 1 + W.mat <- parm[3] + + m0.mat <- 0 + C0.mat <- 10^7 + + return( dlm(ff=f.mat,v=v.mat,gg=g.mat,w=w.mat, + m0=m0.mat,c0=c0.mat) ) + } 16 / 28
Bivariate RW + Noise Estimates > # estimate parameters > fit2 <- dlmmle(y=yy,parm=c(0,0,0),build=ssm2,hessian=t) > mod2 <- ssm2(fit2$par) > > # get estimates > coef <- parm_rest(fit2$par) > # get standard errors using delta method > jac <- jacobian(func=parm_rest,x=fit2$par) > var <- jac%*%solve(fit2$hessian)%*%t(jac) > # print results > coef; sqrt(diag(var)) [1] 2.6390636 2.0309149 0.5443563 [1] 0.2763963 0.2282129 0.1318732 > 17 / 28
Filter and Smooth > # filter and smooth > mod2f <- dlmfilter(yy,mod2); mod2s <- dlmsmooth(mod2f) > > # get smoothed estimates and standard errors > # smoothed values > xt.s <- ts(mod2s$s[-1],start=1) > # width of 90% confidence interval > se.s <- dlmsvd2var(mod2s$u.s,mod2s$d.s)[-1] > width <- qnorm(.95)*sqrt(sapply(se.s,diag)) > # put smoothed results together > xt.smoothed <- cbind(xt.s,as.vector(xt.s)+width%o%c(1,-1)) 18 / 28
Estimated RW 15 10 5 0 5 y1t xt.s 0 50 100 150 200 250 20 10 5 0 y2t xt.s 0 50 100 150 200 250 19 / 28
Application III: Dynamic Factor Models Let y t be a T N panel of macroeconomic indicators where y it, i = 1,..., N, t = 1,..., T, has a factor structure of the form y it = λ i (L)g t + e it where g t is an unobserved dynamic factor, λ i (L) = λ i0 + λ i1 L +... + λ is L s, λ ij are the dynamic factor loadings, and e it is the idiosyncratic error. The dynamics of the latent factor and the idiosyncratic errors are driven by autoregressive processes such that φ(l)g t = η t, η t iid N(0, σ 2 g ) ψ i (L)e it = ν it, ν it iid N(0, σ 2 i ) where φ(l) and ψ i (L) are polynomials in L of orders p g and p e, respectively. 20 / 28
A Real Activity Dynamic Factor Stock and Watson (1991) construct an index of business conditions based on a data set of 4 real activity indicators: industrial production, personal income less transfer payments, real manufacturing trade and sales, and employment. See also Aruoba, Diebold, and Scotti (2009) and Fossati (2012). For example, Fossati (2012) considers the model y it = λ i g t + e it g t = φ 1 g t 1 + φ 2 g t 2 + η t, η t iid N(0, σg 2 ) e it = ψ i1 e it 1 + ψ i2 e it 2 + ν it, ν it iid N(0, σi 2 ) Identification is achieved by setting σg 2 = 1. The dynamic factor models are usually estimated with the data transformed to ensure stationarity, and standardized prior to estimation. 21 / 28
Dynamic Factor Model in SS Form Define θ t = (g t, g t 1, e 1t, e 1t 1,..., e 4t, e 4t 1 ). The transition equation is θ t = Gθ t 1 + w t That is G = φ 1 φ 2 0 0... 0 0 1 0 0 0... 0 0 0 0 ψ 11 ψ 12... 0 0 0 0 1 0... 0 0......... 0 0 0 0... ψ 41 ψ 42 0 0 0 0... 1 0, w t = η t 0 v 1t 0. v 4t 0 and W = diag ( 1, 0, σ 2 1, 0,..., 0, σ 2 4, 0 ) 22 / 28
Dynamic Factor Model in SS Form The measurement is y t = y 1t y 2t y 3t y 4t = F θ t with θ t = (g t, g t 1, e 1t, e 1t 1,..., e 4t, e 4t 1 ). That is F = λ 1 0 1 0... 0 0 λ 2 0 0 0... 0 0 λ 3 0 0 0... 0 0 λ 4 0 0 0... 1 0, V t = 0 4 23 / 28
Estimate A Real Activity Factor for the US Economy A sample of the four monthly coincident indicators for 1960:1-2010:12 can be found in the file coinc.txt. The data is already transformed to ensure stationarity (log-differenced). As it is standard, the data is standardized prior to estimation. > # load coincident indicators > data <-read.table("coinc.txt",sep="",header=false) > yt <- ts(data,start=1960,frequency=12) > # load NBER recession dates > data <-read.table("nber_dates.txt",sep="",header=false) > nber <- ts(data$v1,start=1961,frequency=12) > > # standardize data to improve convergence > yy <- scale(yt) 24 / 28
Real Activity Factor Since θ t = (g t, g t 1, e 1t, e 1t 1,..., e 4t, e 4t 1 ), the dynamic factor is the first element of the filtered estimates of θ t. Note that major troughs correspond closely to NBER recession dates. df.f 6 4 2 0 2 4 1960 1970 1980 1990 2000 2010 25 / 28
Factor-Augmented Probit Regression Define a latent variable x t, which represents the state of the economy as measured by the Business Cycle Dating Committee of the NBER, such that x t = α + δĝ t + ɛ t, ɛ t ĝ t iid N(0, 1) We do not observe x t but rather NBER t NBER t = 1(x t 0) where NBER t is 1 if the observation corresponds to a recession and 0 otherwise. This is a standard probit model. The conditional probability of recession is given by p t = P(NBER t = 1 ĝ t ) = P(x t 0 ĝ t ) = Φ(α + δĝ t ) where Φ( ) is the distribution function of the standard normal. 26 / 28
Estimated Recession Probabilities > # plot recession probabilities > plot(probs,ylim=c(0,1),xlim=c(1961,2011)) > nbershade() > lines(probs) > abline(h=0) probs 0.0 0.2 0.4 0.6 0.8 1.0 1960 1970 1980 1990 2000 2010 27 / 28
Evaluation of Recession Probabilities The quadratic probability score (QPS) mat be used to evaluate the predicted recession probabilities. QPS = 1 T T (NBER t ˆp t ) 2 t=1 The QPS can take values from 0 to 1. Smaller QPS values indicate more accurate predictions. > # compute QPS (only interesting for model comparison) > qps <- mean((nber-probs)^2) > qps [1] 0.06457986 > 28 / 28