S and S-PLUS
S and S-PLUS1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 S Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2.1 Assignment . . . . . . . . . . . . . . . . . . . . . . . 2 1.2.2 Class . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.3 Method . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.3 Modeling Functions in S+FinMetrics . . . . . . . . . . . . 8 1.3.1 Formula Specification . . . . . . . . . . . . . . . . . 8 1.3.2 Method . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4 S-PLUS Resources . . . . . . . . . . . . . . . . . . . . . . . . 12 1.4.1 Books . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.4.2 Internet . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.2.1 Assignment . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.2 Class . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.3 Method . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Modeling Functions in S+FinMetrics . . . . . . . . . . . . 8 1.3.1 Formula Specification . . . . . . . . . . . . . . . . . 8 1.3.2 Method . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4 S-PLUS Resources . . . . . . . . . . . . . . . . . . . . . . . . 12 1.4.1 Books . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.4.2 Internet . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.3.1 Formula Specification . . . . . . . . . . . . . . . . . 8 1.3.2 Method . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4 S-PLUS Resources . . . . . . . . . . . . . . . . . . . . . . . . 12 1.4.1 Books . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.4.2 Internet . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.3.2 Method . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.4 S-PLUS Resources . . . . . . . . . . . . . . . . . . . . . . . . 12 1.4.1 Books . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.4.2 Internet . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.4.1 Books . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.4.2 Internet . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2 Time Series Specification, Manipulation, and Visualization in S-PLUS 15
Visualization in S-PLUS 15
S-PLUS 152.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2 The Specification of “timeSeries” Objects in S-PLUS . . . 15 2.2.1 BasicManipulations . . . . . . . . . . . . . . . . . . 18 2.2.2 S-PLUS “timeDate” Objects . . . . . . . . . . . . . . 19 2.2.3 Creating Common “timeDate” Sequences . . . . . . 24 2.2.4 Miscellaneous Time and Date Functions . . . . . . . 28
2.2.1 BasicManipulations . . . . . . . . . . . . . . . . . . 18
2.2.2 S-PLUS “timeDate” Objects . . . . . . . . . . . . . . 19 2.2.3 Creating Common “timeDate” Sequences . . . . . . 24 2.2.4 Miscellaneous Time and Date Functions . . . . . . . 28
2.2.3 Creating Common “timeDate” Sequences . . . . . . 24 2.2.4 Miscellaneous Time and Date Functions . . . . . . . 28
2.2.4 Miscellaneous Time and Date Functions . . . . . . . 28
iv Contents
2.2.5 Creating “timeSeries” Objects . . . . . . . . . . . 28 2.2.6 Aggregating and Disaggregating Time Series . . . . 31 2.2.7 Merging Time Series . . . . . . . . . . . . . . . . . . 38 2.2.8 Dealing with Missing Values Using the
2.2.6 Aggregating and Disaggregating Time Series . . . . 31
2.2.7 Merging Time Series . . . . . . . . . . . . . . . . . . 38
2.2.8 Dealing with Missing Values Using the
S+FinMetrics Function interpNA . . . . . . . . . . 39 2.3 Time Series Manipulation in S-PLUS . . . . . . . . . . . . . 40 2.3.1 Creating Lags and Differences . . . . . . . . . . . . . 40 2.3.2 Return Definitions . . . . . . . . . . . . . . . . . . . 43 2.3.3 Computing Asset Returns Using the
2.3 Time Series Manipulation in S-PLUS . . . . . . . . . . . . . 40 2.3.1 Creating Lags and Differences . . . . . . . . . . . . . 40 2.3.2 Return Definitions . . . . . . . . . . . . . . . . . . . 43 2.3.3 Computing Asset Returns Using the
2.3.1 Creating Lags and Differences . . . . . . . . . . . . . 40 2.3.2 Return Definitions . . . . . . . . . . . . . . . . . . . 43 2.3.3 Computing Asset Returns Using the
2.3.2 Return Definitions . . . . . . . . . . . . . . . . . . . 43 2.3.3 Computing Asset Returns Using the
2.3.3 Computing Asset Returns Using the
S+FinMetrics Function getReturns . . . . . . . . . 46 2.4 Visualizing Time Series in S-PLUS . . . . . . . . . . . . . . 48 2.4.1 Plotting “timeSeries” Using the S-PLUS
2.4 Visualizing Time Series in S-PLUS . . . . . . . . . . . . . . 48 2.4.1 Plotting “timeSeries” Using the S-PLUS
2.4.1 Plotting “timeSeries” Using the S-PLUS
timeSeries” Using the S-PLUSGeneric plot Function . . . . . . . . . . . . . . . . . 48 2.4.2 Plotting “timeSeries” Using the S+FinMetrics
2.4.2 Plotting “timeSeries” Using the S+FinMetrics
timeSeries” Using the S+FinMetricsTrellis Plotting Functions . . . . . . . . . . . . . . . 51
2.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3 Time Series Concepts 57
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.2 Univariate Time Series . . . . . . . . . . . . . . . . . . . . . 58
3.2.1 Stationary and Ergodic Time Series . . . . . . . . . 58
3.2.2 Linear Processes and ARMAModels . . . . . . . . . 64
3.2.3 AutoregressiveModels . . . . . . . . . . . . . . . . . 66
3.2.4 Moving AverageModels . . . . . . . . . . . . . . . . 71
3.2.5 ARMA(p,q)Models . . . . . . . . . . . . . . . . . . 74
3.2.6 Estimation of ARMAModels and Forecasting . . . . 76
3.2.7 Martingales and Martingale Difference Sequences . . 83 3.2.8 Long-run Variance . . . . . . . . . . . . . . . . . . . 85 3.2.9 Variance Ratios . . . . . . . . . . . . . . . . . . . . . 88 3.3 Univariate Nonstationary Time Series . . . . . . . . . . . . 93 3.4 LongMemory Time Series . . . . . . . . . . . . . . . . . . . 97 3.5 Multivariate Time Series . . . . . . . . . . . . . . . . . . . . 101 3.5.1 Stationary and Ergodic Multivariate Time Series . . 101 3.5.2 MultivariateWold Representation . . . . . . . . . . 106 3.5.3 Long Run Variance . . . . . . . . . . . . . . . . . . . 107 3.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
3.2.8 Long-run Variance . . . . . . . . . . . . . . . . . . . 85
3.2.9 Variance Ratios . . . . . . . . . . . . . . . . . . . . . 88
3.3 Univariate Nonstationary Time Series . . . . . . . . . . . . 93
3.4 LongMemory Time Series . . . . . . . . . . . . . . . . . . . 97
3.5 Multivariate Time Series . . . . . . . . . . . . . . . . . . . . 101
3.5.1 Stationary and Ergodic Multivariate Time Series . . 101
3.5.2 MultivariateWold Representation . . . . . . . . . . 106
3.5.3 Long Run Variance . . . . . . . . . . . . . . . . . . . 107
3.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
4 UnitRootTests 111
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
4.2 Testing for Nonstationarity and Stationarity . . . . . . . . . 112
4.3 Autoregressive Unit Root Tests . . . . . . . . . . . . . . . . 114
4.3.1 Simulating the DF and Normalized Bias
Distributions . . . . . . . . . . . . . . . . . . . . . . 116
4.3.2 Trend Cases . . . . . . . . . . . . . . . . . . . . . . . 118
4.3.3 Dickey-Fuller Unit Root Tests . . . . . . . . . . . . . 120
Contents v
4.3.4 Phillips-Perron Unit Root Tests . . . . . . . . . . . . 127
4.4 Stationarity Tests . . . . . . . . . . . . . . . . . . . . . . . . 129
4.4.1 Simulating the KPSS Distributions . . . . . . . . . . 130
4.4.2 Testing for Stationarity Using the S+FinMetrics
S+FinMetricsFunction stationaryTest . . . . . . . . . . . . . . . 131 4.5 Some Problems with Unit Root Tests . . . . . . . . . . . . . 132 4.6 Efficient Unit Root Tests . . . . . . . . . . . . . . . . . . . 132 4.6.1 Point Optimal Tests . . . . . . . . . . . . . . . . . . 133 4.6.2 DF-GLS Tests . . . . . . . . . . . . . . . . . . . . . 134 4.6.3 Modified Efficient PP Tests . . . . . . . . . . . . . . 134 4.6.4 Estimating λ2 . . . . . . . . . . . . . . . . . . . . . . 135 4.6.5 Choosing Lag Lengths to Achieve Good Size and Power135 4.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
4.5 Some Problems with Unit Root Tests . . . . . . . . . . . . . 132
4.6 Efficient Unit Root Tests . . . . . . . . . . . . . . . . . . . 132 4.6.1 Point Optimal Tests . . . . . . . . . . . . . . . . . . 133 4.6.2 DF-GLS Tests . . . . . . . . . . . . . . . . . . . . . 134 4.6.3 Modified Efficient PP Tests . . . . . . . . . . . . . . 134 4.6.4 Estimating λ2 . . . . . . . . . . . . . . . . . . . . . . 135 4.6.5 Choosing Lag Lengths to Achieve Good Size and Power135 4.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
4.6.1 Point Optimal Tests . . . . . . . . . . . . . . . . . . 133
4.6.2 DF-GLS Tests . . . . . . . . . . . . . . . . . . . . . 134
4.6.3 Modified Efficient PP Tests . . . . . . . . . . . . . . 134 4.6.4 Estimating λ2 . . . . . . . . . . . . . . . . . . . . . . 135 4.6.5 Choosing Lag Lengths to Achieve Good Size and Power135 4.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
4.6.4 Estimating λ2 . . . . . . . . . . . . . . . . . . . . . . 135 4.6.5 Choosing Lag Lengths to Achieve Good Size and Power135 4.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
4.6.5 Choosing Lag Lengths to Achieve Good Size and Power135
4.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
5 Modeling Extreme Values 141
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5.2 ModelingMaxima andWorst Cases . . . . . . . . . . . . . . 142
5.2.1 The Fisher-Tippet Theorem and the Generalized
Extreme Value Distribution . . . . . . . . . . . . . . 143
5.2.2 Estimation of the GEV Distribution . . . . . . . . . 147
5.2.3 Return Level . . . . . . . . . . . . . . . . . . . . . . 153
5.3 Modeling Extremes Over High Thresholds . . . . . . . . . . 157
5.3.1 The Limiting Distribution of Extremes Over
High Thresholds and the Generalized Pareto
Distribution . . . . . . . . . . . . . . . . . . . . . . . 159
5.3.2 Estimating the GPD byMaximumLikelihood . . . . 164
5.3.3 Estimating the Tails of the Loss Distribution . . . . 165
5.3.4 RiskMeasures . . . . . . . . . . . . . . . . . . . . . 171
5.4 Hill’s Non-parametric Estimator of Tail Index . . . . . . . . 174
5.4.1 Hill Tail and Quantile Estimation. . . . . . . . . . . 175
5.5 Summary of Extreme ValueModeling Functions . . . . . . 178
5.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
6 Time Series Regression Modeling 181
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
6.2 Time Series RegressionModel . . . . . . . . . . . . . . . . . 182
6.2.1 Least Squares Estimation . . . . . . . . . . . . . . . 183
6.2.2 Goodness of Fit . . . . . . . . . . . . . . . . . . . . . 183
6.2.3 Hypothesis Testing . . . . . . . . . . . . . . . . . . . 184
6.2.4 Residual Diagnostics . . . . . . . . . . . . . . . . . . 185
6.3 Time Series Regression Using the S+FinMetrics
S+FinMetricsFunction OLS . . . . . . . . . . . . . . . . . . . . . . . . . . 185 6.4 Dynamic Regression . . . . . . . . . . . . . . . . . . . . . . 201 6.4.1 Distributed Lags and Polynomial Distributed Lags . 205 6.4.2 Polynomial Distributed LagModels . . . . . . . . . 207
6.4 Dynamic Regression . . . . . . . . . . . . . . . . . . . . . . 201
6.4.1 Distributed Lags and Polynomial Distributed Lags . 205
6.4.2 Polynomial Distributed LagModels . . . . . . . . . 207
vi Contents
6.5 Heteroskedasticity and Autocorrelation Consistent
CovarianceMatrix Estimation . . . . . . . . . . . . . . . . . 208
6.5.1 The Eicker-White Heteroskedasticity Consistent
(HC) CovarianceMatrix Estimate . . . . . . . . . . 209
6.5.2 Testing for Heteroskedasticity . . . . . . . . . . . . . 211
6.5.3 The Newey-West Heteroskedasticity and
Autocorrelation Consistent (HAC) Covariance
Matrix Estimate . . . . . . . . . . . . . . . . . . . . 214
6.6 Recursive Least Squares Estimation . . . . . . . . . . . . . 217
6.6.1 CUSUM and CUSUMSQ Tests for Parameter
Stability . . . . . . . . . . . . . . . . . . . . . . . . . 218
6.6.2 Computing Recursive Least Squares Estimates
Using the S+FinMetrics Function RLS . . . . . . . . 219 6.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
6.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
7 Univariate GARCH Modeling 223
7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
7.2 The Basic ARCHModel . . . . . . . . . . . . . . . . . . . . 224
7.2.1 Testing for ARCH Effects . . . . . . . . . . . . . . . 228 7.3 The GARCHModel and Its Properties . . . . . . . . . . . . 229 7.3.1 ARMA Representation of GARCHModel . . . . . . 230 7.3.2 GARCHModel and Stylized Facts . . . . . . . . . . 230 7.4 GARCH Modeling Using S+FinMetrics . . . . . . . . . . . 232 7.4.1 GARCHModel Estimation . . . . . . . . . . . . . . 232 7.4.2 GARCHModel Diagnostics . . . . . . . . . . . . . . 235 7.5 GARCHModel Extensions . . . . . . . . . . . . . . . . . . 240 7.5.1 Asymmetric Leverage Effects and News Impact . . . 241 7.5.2 Two ComponentsModel . . . . . . . . . . . . . . . . 247 7.5.3 GARCH-in-the-MeanModel . . . . . . . . . . . . . . 250 7.5.4 ARMA Terms and Exogenous Variables in ConditionalMean Equation . . . . . . . . . . . . . . 252 7.5.5 Exogenous Explanatory Variables in the Conditional Variance Equation . . . . . . . . . . . . 255 7.5.6 Non-Gaussian Error Distributions . . . . . . . . . . 256 7.6 GARCHModel Selection and Comparison . . . . . . . . . . 259 7.6.1 Constrained GARCH Estimation . . . . . . . . . . . 261 7.7 GARCHModel Prediction . . . . . . . . . . . . . . . . . . . 261 7.8 GARCHModel Simulation . . . . . . . . . . . . . . . . . . 264 7.9 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 7.10 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
7.3 The GARCHModel and Its Properties . . . . . . . . . . . . 229
7.3.1 ARMA Representation of GARCHModel . . . . . . 230
7.3.2 GARCHModel and Stylized Facts . . . . . . . . . . 230
7.4 GARCH Modeling Using S+FinMetrics . . . . . . . . . . . 232 7.4.1 GARCHModel Estimation . . . . . . . . . . . . . . 232 7.4.2 GARCHModel Diagnostics . . . . . . . . . . . . . . 235 7.5 GARCHModel Extensions . . . . . . . . . . . . . . . . . . 240 7.5.1 Asymmetric Leverage Effects and News Impact . . . 241 7.5.2 Two ComponentsModel . . . . . . . . . . . . . . . . 247 7.5.3 GARCH-in-the-MeanModel . . . . . . . . . . . . . . 250 7.5.4 ARMA Terms and Exogenous Variables in ConditionalMean Equation . . . . . . . . . . . . . . 252 7.5.5 Exogenous Explanatory Variables in the Conditional Variance Equation . . . . . . . . . . . . 255 7.5.6 Non-Gaussian Error Distributions . . . . . . . . . . 256 7.6 GARCHModel Selection and Comparison . . . . . . . . . . 259 7.6.1 Constrained GARCH Estimation . . . . . . . . . . . 261 7.7 GARCHModel Prediction . . . . . . . . . . . . . . . . . . . 261 7.8 GARCHModel Simulation . . . . . . . . . . . . . . . . . . 264 7.9 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 7.10 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
7.4.1 GARCHModel Estimation . . . . . . . . . . . . . . 232
7.4.2 GARCHModel Diagnostics . . . . . . . . . . . . . . 235
7.5 GARCHModel Extensions . . . . . . . . . . . . . . . . . . 240
7.5.1 Asymmetric Leverage Effects and News Impact . . . 241 7.5.2 Two ComponentsModel . . . . . . . . . . . . . . . . 247 7.5.3 GARCH-in-the-MeanModel . . . . . . . . . . . . . . 250 7.5.4 ARMA Terms and Exogenous Variables in ConditionalMean Equation . . . . . . . . . . . . . . 252 7.5.5 Exogenous Explanatory Variables in the Conditional Variance Equation . . . . . . . . . . . . 255 7.5.6 Non-Gaussian Error Distributions . . . . . . . . . . 256 7.6 GARCHModel Selection and Comparison . . . . . . . . . . 259 7.6.1 Constrained GARCH Estimation . . . . . . . . . . . 261 7.7 GARCHModel Prediction . . . . . . . . . . . . . . . . . . . 261 7.8 GARCHModel Simulation . . . . . . . . . . . . . . . . . . 264 7.9 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 7.10 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
7.5.2 Two ComponentsModel . . . . . . . . . . . . . . . . 247
7.5.3 GARCH-in-the-MeanModel . . . . . . . . . . . . . . 250
7.5.4 ARMA Terms and Exogenous Variables in
ConditionalMean Equation . . . . . . . . . . . . . . 252
7.5.5 Exogenous Explanatory Variables in the
Conditional Variance Equation . . . . . . . . . . . . 255
7.5.6 Non-Gaussian Error Distributions . . . . . . . . . . 256
7.6 GARCHModel Selection and Comparison . . . . . . . . . . 259
7.6.1 Constrained GARCH Estimation . . . . . . . . . . . 261
7.7 GARCHModel Prediction . . . . . . . . . . . . . . . . . . . 261
7.8 GARCHModel Simulation . . . . . . . . . . . . . . . . . . 264
7.9 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
7.10 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
8 Long Memory Time Series Modeling 271
8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
8.2 LongMemory Time Series . . . . . . . . . . . . . . . . . . . 272
8.3 Statistical Tests for LongMemory . . . . . . . . . . . . . . 276
Contents vii
8.3.1 R/S Statistic . . . . . . . . . . . . . . . . . . . . . . 276
8.3.2 GPH Test . . . . . . . . . . . . . . . . . . . . . . . . 278
8.4 Estimation of LongMemory Parameter . . . . . . . . . . . 280
8.4.1 R/S Analysis . . . . . . . . . . . . . . . . . . . . . . 280
8.4.2 PeriodogramMethod . . . . . . . . . . . . . . . . . . 282
8.4.3 Whittle’sMethod . . . . . . . . . . . . . . . . . . . . 283
8.5 Estimation of FARIMA and SEMIFARModels . . . . . . . 284
8.5.1 Fractional ARIMAModels . . . . . . . . . . . . . . 285
8.5.2 SEMIFARModel . . . . . . . . . . . . . . . . . . . . 292
8.6 LongMemory GARCHModels . . . . . . . . . . . . . . . . 296
8.6.1 FIGARCH and FIEGARCHModels . . . . . . . . . 296
8.6.2 Estimation of LongMemory GARCHModels . . . . 297
8.6.3 Custom Estimation of Long Memory GARCH
Models . . . . . . . . . . . . . . . . . . . . . . . . . 301
8.7 Prediction fromLongMemoryModels . . . . . . . . . . . . 304
8.7.1 Prediction fromFARIMA/SEMIFARModels . . . . 304
8.7.2 Prediction from FIGARCH/FIEGARCH Models . . 308
8.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
9 Rolling Analysis of Time Series 313
9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
9.2 Rolling Descriptive Statistics . . . . . . . . . . . . . . . . . 314
9.2.1 Univariate Statistics . . . . . . . . . . . . . . . . . . 314
9.2.2 Bivariate Statistics . . . . . . . . . . . . . . . . . . . 321
9.2.3 ExponentiallyWeightedMoving Averages . . . . . . 323
9.2.4 Moving Average Methods for Irregularly Spaced
High Frequency Data . . . . . . . . . . . . . . . . . 327
9.2.5 Rolling Analysis of Miscellaneous Functions . . . . . 334
9.3 Technical Analysis Indicators . . . . . . . . . . . . . . . . . 337
9.3.1 Price Indicators . . . . . . . . . . . . . . . . . . . . . 338
9.3.2 Momentum Indicators and Oscillators . . . . . . . . 338
9.3.3 Volatility Indicators . . . . . . . . . . . . . . . . . . 340
9.3.4 Volume Indicators . . . . . . . . . . . . . . . . . . . 341
9.4 Rolling Regression . . . . . . . . . . . . . . . . . . . . . . . 342
9.4.1 Estimating Rolling Regressions Using the
S+FinMetrics Function rollOLS . . . . . . . . . . . 343 9.4.2 Rolling Predictions and Backtesting . . . . . . . . . 349 9.5 Rolling Analysis of General Models Using the S+FinMetrics
9.4.2 Rolling Predictions and Backtesting . . . . . . . . . 349
9.5 Rolling Analysis of General Models Using the S+FinMetrics
S+FinMetricsFunction roll . . . . . . . . . . . . . . . . . . . . . . . . . . 358 9.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
9.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
10 Systems of Regression Equations 361
10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
10.2 Systems of Regression Equations . . . . . . . . . . . . . . . 362
10.3 Linear Seemingly Unrelated Regressions . . . . . . . . . . . 364
viii Contents
10.3.1 Estimation . . . . . . . . . . . . . . . . . . . . . . . 364
10.3.2 Analysis of SUR Models with the S+FinMetrics
S+FinMetricsFunction SUR . . . . . . . . . . . . . . . . . . . . . . 367 10.4 Nonlinear Seemingly Unrelated RegressionModels . . . . . 374 10.4.1 Analysis of Nonlinear SUR Models with the
10.4 Nonlinear Seemingly Unrelated RegressionModels . . . . . 374
10.4.1 Analysis of Nonlinear SUR Models with the
S+FinMetrics Function NLSUR . . . . . . . . . . . . 375 10.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
10.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
11 Vector Autoregressive Models for Multivariate
Time Series 383
11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
11.2 The Stationary Vector AutoregressionModel . . . . . . . . 384
11.2.1 Estimation . . . . . . . . . . . . . . . . . . . . . . . 386
11.2.2 Inference on Coefficients . . . . . . . . . . . . . . . . 388 11.2.3 Lag Length Selection . . . . . . . . . . . . . . . . . . 388 11.2.4 Estimating VAR Models Using the S+FinMetrics
11.2.3 Lag Length Selection . . . . . . . . . . . . . . . . . . 388
11.2.4 Estimating VAR Models Using the S+FinMetrics
S+FinMetricsFunction VAR . . . . . . . . . . . . . . . . . . . . . . 388 11.3 Forecasting . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 11.3.1 Traditional Forecasting Algorithm . . . . . . . . . . 396 11.3.2 Simulation-Based Forecasting . . . . . . . . . . . . . 400 11.4 Structural Analysis . . . . . . . . . . . . . . . . . . . . . . . 404 11.4.1 Granger Causality . . . . . . . . . . . . . . . . . . . 405 11.4.2 Impulse Response Functions . . . . . . . . . . . . . . 407 11.4.3 Forecast Error Variance Decompositions . . . . . . . 412 11.5 An Extended Example . . . . . . . . . . . . . . . . . . . . . 414 11.6 Bayesian Vector Autoregression . . . . . . . . . . . . . . . . 422 11.6.1 An Example of a Bayesian VARModel . . . . . . . 422 11.6.2 Conditional Forecasts . . . . . . . . . . . . . . . . . 425 11.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
11.3 Forecasting . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
11.3.1 Traditional Forecasting Algorithm . . . . . . . . . . 396
11.3.2 Simulation-Based Forecasting . . . . . . . . . . . . . 400
11.4 Structural Analysis . . . . . . . . . . . . . . . . . . . . . . . 404
11.4.1 Granger Causality . . . . . . . . . . . . . . . . . . . 405
11.4.2 Impulse Response Functions . . . . . . . . . . . . . . 407
11.4.3 Forecast Error Variance Decompositions . . . . . . . 412
11.5 An Extended Example . . . . . . . . . . . . . . . . . . . . . 414
11.6 Bayesian Vector Autoregression . . . . . . . . . . . . . . . . 422
11.6.1 An Example of a Bayesian VARModel . . . . . . . 422
11.6.2 Conditional Forecasts . . . . . . . . . . . . . . . . . 425
11.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
12 Cointegration 429
12.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
12.2 Spurious Regression and Cointegration . . . . . . . . . . . . 430
12.2.1 Spurious Regression . . . . . . . . . . . . . . . . . . 430
12.2.2 Cointegration . . . . . . . . . . . . . . . . . . . . . . 433
12.2.3 Cointegration and Common Trends . . . . . . . . . . 435
12.2.4 Simulating Cointegrated Systems . . . . . . . . . . . 435
12.2.5 Cointegration and Error CorrectionModels . . . . . 439
12.3 Residual-Based Tests for Cointegration . . . . . . . . . . . . 442
12.3.1 Testing for Cointegration When the Cointegrating
Vector Is Pre-specified . . . . . . . . . . . . . . . . . 442 12.3.2 Testing for Cointegration When the Cointegrating Vector Is Estimated . . . . . . . . . . . . . . . . . . 445 12.4 Regression-Based Estimates of Cointegrating Vectors and Error CorrectionModels . . . . . . . . . . . . . . . . . . . . 448
12.3.2 Testing for Cointegration When the Cointegrating
Vector Is Estimated . . . . . . . . . . . . . . . . . . 445
12.4 Regression-Based Estimates of Cointegrating Vectors and
Error CorrectionModels . . . . . . . . . . . . . . . . . . . . 448
Contents ix
12.4.1 Least Square Estimator . . . . . . . . . . . . . . . . 448
12.4.2 Stock and Watson’s Efficient Lead/Lag Estimator . 449 12.4.3 Estimating Error Correction Models by Least Squares . . . . . . . . . . . . . . . . . . . . . . . . . 452 12.5 VARModels and Cointegration . . . . . . . . . . . . . . . . 453 12.5.1 The Cointegrated VAR . . . . . . . . . . . . . . . . 454 12.5.2 Johansen’s Methodology for Modeling Cointegration . . . . . . . . . . . . . . . . . . . . . . 456 12.5.3 Specification of Deterministic Terms . . . . . . . . . 457 12.5.4 Likelihood Ratio Tests for the Number of Cointegrating Vectors . . . . . . . . . . . . . . . . . 459 12.5.5 Testing Hypothesis on Cointegrating Vectors Using the S+FinMetrics Function coint . . . . . . 461 12.5.6 Maximum Likelihood Estimation of the Cointegrated VECM . . . . . . . . . . . . . . . . . . 465 12.5.7 Maximum Likelihood Estimation of the Cointegrated VECM Using the S+FinMetrics
12.4.3 Estimating Error Correction Models by Least
Squares . . . . . . . . . . . . . . . . . . . . . . . . . 452
12.5 VARModels and Cointegration . . . . . . . . . . . . . . . . 453
12.5.1 The Cointegrated VAR . . . . . . . . . . . . . . . . 454
12.5.2 Johansen’s Methodology for Modeling
Cointegration . . . . . . . . . . . . . . . . . . . . . . 456
12.5.3 Specification of Deterministic Terms . . . . . . . . . 457 12.5.4 Likelihood Ratio Tests for the Number of Cointegrating Vectors . . . . . . . . . . . . . . . . . 459 12.5.5 Testing Hypothesis on Cointegrating Vectors Using the S+FinMetrics Function coint . . . . . . 461 12.5.6 Maximum Likelihood Estimation of the Cointegrated VECM . . . . . . . . . . . . . . . . . . 465 12.5.7 Maximum Likelihood Estimation of the Cointegrated VECM Using the S+FinMetrics
12.5.4 Likelihood Ratio Tests for the Number of
Cointegrating Vectors . . . . . . . . . . . . . . . . . 459
12.5.5 Testing Hypothesis on Cointegrating Vectors
Using the S+FinMetrics Function coint . . . . . . 461 12.5.6 Maximum Likelihood Estimation of the Cointegrated VECM . . . . . . . . . . . . . . . . . . 465 12.5.7 Maximum Likelihood Estimation of the Cointegrated VECM Using the S+FinMetrics
12.5.6 Maximum Likelihood Estimation of the
Cointegrated VECM . . . . . . . . . . . . . . . . . . 465
12.5.7 Maximum Likelihood Estimation of the
Cointegrated VECM Using the S+FinMetrics
S+FinMetricsFunction VECM . . . . . . . . . . . . . . . . . . . . . 466 12.5.8 Forecasting fromthe VECM . . . . . . . . . . . . . 472 12.6 Appendix: Maximum Likelihood Estimation of a Cointegrated VECM . . . . . . . . . . . . . . . . . . . . . . 474 12.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
12.5.8 Forecasting fromthe VECM . . . . . . . . . . . . . 472
12.6 Appendix: Maximum Likelihood Estimation of a
Cointegrated VECM . . . . . . . . . . . . . . . . . . . . . . 474
12.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
13 Multivariate GARCH Modeling 479
13.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
13.2 ExponentiallyWeighted Covariance Estimate . . . . . . . . 480
13.3 Diagonal VEC Model . . . . . . . . . . . . . . . . . . . . . . 484
13.4 Multivariate GARCH Modeling in S+FinMetrics . . . . . . 485 13.4.1 Multivariate GARCHModel Estimation . . . . . . . 485 13.4.2 Multivariate GARCHModel Diagnostics . . . . . . . 488 13.5 Multivariate GARCHModel Extensions . . . . . . . . . . . 494 13.5.1 Matrix-Diagonal Models . . . . . . . . . . . . . . . . 494 13.5.2 BEKKModels . . . . . . . . . . . . . . . . . . . . . 496 13.5.3 Univariate GARCH-basedModels . . . . . . . . . . 497 13.5.4 ARMA Terms and Exogenous Variables . . . . . . . 502 13.5.5 Multivariate Conditional t-Distribution . . . . . . . 506 13.6 Multivariate GARCH Prediction . . . . . . . . . . . . . . . 507 13.7 CustomEstimation of GARCHModels . . . . . . . . . . . . 510 13.7.1 GARCHModel Objects . . . . . . . . . . . . . . . . 510 13.7.2 Revision of GARCHModel Estimation . . . . . . . . 512 13.8 Multivariate GARCHModel Simulation . . . . . . . . . . . 513 13.9 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
13.4.1 Multivariate GARCHModel Estimation . . . . . . . 485
13.4.2 Multivariate GARCHModel Diagnostics . . . . . . . 488
13.5 Multivariate GARCHModel Extensions . . . . . . . . . . . 494
13.5.1 Matrix-Diagonal Models . . . . . . . . . . . . . . . . 494
13.5.2 BEKKModels . . . . . . . . . . . . . . . . . . . . . 496
13.5.3 Univariate GARCH-basedModels . . . . . . . . . . 497
13.5.4 ARMA Terms and Exogenous Variables . . . . . . . 502
13.5.5 Multivariate Conditional t-Distribution . . . . . . . 506
13.6 Multivariate GARCH Prediction . . . . . . . . . . . . . . . 507
13.7 CustomEstimation of GARCHModels . . . . . . . . . . . . 510
13.7.1 GARCHModel Objects . . . . . . . . . . . . . . . . 510
13.7.2 Revision of GARCHModel Estimation . . . . . . . . 512
13.8 Multivariate GARCHModel Simulation . . . . . . . . . . . 513
13.9 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
14 State Space Models 517
14.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
x Contents
14.2 State Space Representation . . . . . . . . . . . . . . . . . . 518
14.2.1 Initial Conditions . . . . . . . . . . . . . . . . . . . . 519
14.2.2 State Space Representation in
S+FinMetrics/SsfPack . . . . . . . . . . . . . . . . 519 14.2.3 Missing Values . . . . . . . . . . . . . . . . . . . . . 525 14.2.4 S+FinMetrics/SsfPack Functions for Specifying the State Space Form for Some Common Time SeriesModels . . . . . . . . . . . . . . . . . . . . . . 526 14.2.5 Simulating Observations from the State SpaceModel . . . . . . . . . . . . . . . . . . . . . . 538 14.3 Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . 541 14.3.1 Kalman Filter . . . . . . . . . . . . . . . . . . . . . . 541 14.3.2 Kalman Smoother . . . . . . . . . . . . . . . . . . . 541 14.3.3 Smoothed State and Response Estimates . . . . . . 542 14.3.4 Smoothed Disturbance Estimates . . . . . . . . . . . 542 14.3.5 Forecasting . . . . . . . . . . . . . . . . . . . . . . . 542 14.3.6 S+FinMetrics/SsfPack Implementation of State SpaceModeling Algorithms . . . . . . . . . . . . . . 543 14.4 Estimation of State SpaceModels . . . . . . . . . . . . . . . 550 14.4.1 Prediction Error Decomposition of Log-Likelihood . . . . . . . . . . . . . . . . . . . . . 550 14.4.2 Fitting State Space Models Using the
14.2.3 Missing Values . . . . . . . . . . . . . . . . . . . . . 525
14.2.4 S+FinMetrics/SsfPack Functions for Specifying the State Space Form for Some Common Time SeriesModels . . . . . . . . . . . . . . . . . . . . . . 526 14.2.5 Simulating Observations from the State SpaceModel . . . . . . . . . . . . . . . . . . . . . . 538 14.3 Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . 541 14.3.1 Kalman Filter . . . . . . . . . . . . . . . . . . . . . . 541 14.3.2 Kalman Smoother . . . . . . . . . . . . . . . . . . . 541 14.3.3 Smoothed State and Response Estimates . . . . . . 542 14.3.4 Smoothed Disturbance Estimates . . . . . . . . . . . 542 14.3.5 Forecasting . . . . . . . . . . . . . . . . . . . . . . . 542 14.3.6 S+FinMetrics/SsfPack Implementation of State SpaceModeling Algorithms . . . . . . . . . . . . . . 543 14.4 Estimation of State SpaceModels . . . . . . . . . . . . . . . 550 14.4.1 Prediction Error Decomposition of Log-Likelihood . . . . . . . . . . . . . . . . . . . . . 550 14.4.2 Fitting State Space Models Using the
the State Space Form for Some Common Time
SeriesModels . . . . . . . . . . . . . . . . . . . . . . 526
14.2.5 Simulating Observations from the State
SpaceModel . . . . . . . . . . . . . . . . . . . . . . 538
14.3 Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
14.3.1 Kalman Filter . . . . . . . . . . . . . . . . . . . . . . 541
14.3.2 Kalman Smoother . . . . . . . . . . . . . . . . . . . 541
14.3.3 Smoothed State and Response Estimates . . . . . . 542
14.3.4 Smoothed Disturbance Estimates . . . . . . . . . . . 542
14.3.5 Forecasting . . . . . . . . . . . . . . . . . . . . . . . 542
14.3.6 S+FinMetrics/SsfPack Implementation of State SpaceModeling Algorithms . . . . . . . . . . . . . . 543 14.4 Estimation of State SpaceModels . . . . . . . . . . . . . . . 550 14.4.1 Prediction Error Decomposition of Log-Likelihood . . . . . . . . . . . . . . . . . . . . . 550 14.4.2 Fitting State Space Models Using the
SpaceModeling Algorithms . . . . . . . . . . . . . . 543
14.4 Estimation of State SpaceModels . . . . . . . . . . . . . . . 550
14.4.1 Prediction Error Decomposition of
Log-Likelihood . . . . . . . . . . . . . . . . . . . . . 550
14.4.2 Fitting State Space Models Using the
S+FinMetrics/SsfPack Function SsfFit . . . . . . 552 14.4.3 Quasi-MaximumLikelihood Estimation . . . . . . . 559 14.5 Simulation Smoothing . . . . . . . . . . . . . . . . . . . . . 563 14.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
14.4.3 Quasi-MaximumLikelihood Estimation . . . . . . . 559
14.5 Simulation Smoothing . . . . . . . . . . . . . . . . . . . . . 563
14.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
15 Factor Models for Asset Returns 567
15.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
15.2 Factor Model Specification . . . . . . . . . . . . . . . . . . . 568 15.3 Macroeconomic FactorModels for Returns . . . . . . . . . . 569 15.3.1 Sharpe’s Single IndexModel . . . . . . . . . . . . . 570 15.3.2 The GeneralMultifactorModel . . . . . . . . . . . . 575 15.4 Fundamental FactorModel . . . . . . . . . . . . . . . . . . 578 15.4.1 BARRA-type Single FactorModel . . . . . . . . . . 579 15.4.2 BARRA-type Industry FactorModel . . . . . . . . . 580 15.5 Statistical FactorModels for Returns . . . . . . . . . . . . . 588 15.5.1 Factor Analysis . . . . . . . . . . . . . . . . . . . . . 588 15.5.2 Principal Components . . . . . . . . . . . . . . . . . 595 15.5.3 Asymptotic Principal Components . . . . . . . . . . 604 15.5.4 Determining the Number of Factors . . . . . . . . . 608 15.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
15.3 Macroeconomic FactorModels for Returns . . . . . . . . . . 569
15.3.1 Sharpe’s Single IndexModel . . . . . . . . . . . . . 570
15.3.2 The GeneralMultifactorModel . . . . . . . . . . . . 575
15.4 Fundamental FactorModel . . . . . . . . . . . . . . . . . . 578
15.4.1 BARRA-type Single FactorModel . . . . . . . . . . 579
15.4.2 BARRA-type Industry FactorModel . . . . . . . . . 580
15.5 Statistical FactorModels for Returns . . . . . . . . . . . . . 588
15.5.1 Factor Analysis . . . . . . . . . . . . . . . . . . . . . 588
15.5.2 Principal Components . . . . . . . . . . . . . . . . . 595
15.5.3 Asymptotic Principal Components . . . . . . . . . . 604
15.5.4 Determining the Number of Factors . . . . . . . . . 608
15.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
16 Term Structure of Interest Rates 615
16.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
Contents xi
16.2 Discount, Spot and Forward Rates . . . . . . . . . . . . . . 616
16.2.1 Definitions and Rate Conversion . . . . . . . . . . . 616 16.2.2 Rate Conversion in S+FinMetrics . . . . . . . . . . 617 16.3 Quadratic and Cubic Spline Interpolation . . . . . . . . . . 618 16.4 Smoothing Spline Interpolation . . . . . . . . . . . . . . . . 622 16.5 Nelson-Siegel Function . . . . . . . . . . . . . . . . . . . . . 626 16.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 630 16.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
16.2.2 Rate Conversion in S+FinMetrics . . . . . . . . . . 617 16.3 Quadratic and Cubic Spline Interpolation . . . . . . . . . . 618 16.4 Smoothing Spline Interpolation . . . . . . . . . . . . . . . . 622 16.5 Nelson-Siegel Function . . . . . . . . . . . . . . . . . . . . . 626 16.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 630 16.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
16.3 Quadratic and Cubic Spline Interpolation . . . . . . . . . . 618
16.4 Smoothing Spline Interpolation . . . . . . . . . . . . . . . . 622
16.5 Nelson-Siegel Function . . . . . . . . . . . . . . . . . . . . . 626
16.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 630
16.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
17 Robust Change Detection 633
17.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
17.2 REGARIMAModels . . . . . . . . . . . . . . . . . . . . . . 634
17.3 Robust Fitting of REGARIMAModels . . . . . . . . . . . . 635
17.4 Prediction Using REGARIMAModels . . . . . . . . . . . . 640
17.5 Controlling Robust Fitting of REGARIMA Models . . . . . 641
17.5.1 Adding Seasonal Effects . . . . . . . . . . . . . . . . 641 17.5.2 Controlling Outlier Detection . . . . . . . . . . . . . 643 17.5.3 Iterating the Procedure . . . . . . . . . . . . . . . . 645 17.6 Algorithms of Filtered τ-Estimation . . . . . . . . . . . . . 647 17.6.1 ClassicalMaximumLikelihood Estimates . . . . . . 648 17.6.2 Filtered τ-Estimates . . . . . . . . . . . . . . . . . . 649 17.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
17.5.2 Controlling Outlier Detection . . . . . . . . . . . . . 643
17.5.3 Iterating the Procedure . . . . . . . . . . . . . . . . 645
17.6 Algorithms of Filtered τ-Estimation . . . . . . . . . . . . . 647 17.6.1 ClassicalMaximumLikelihood Estimates . . . . . . 648 17.6.2 Filtered τ-Estimates . . . . . . . . . . . . . . . . . . 649 17.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
17.6.1 ClassicalMaximumLikelihood Estimates . . . . . . 648
17.6.2 Filtered τ-Estimates . . . . . . . . . . . . . . . . . . 649 17.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
17.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
18 Nonlinear Time Series Models 651
18.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 651
18.2 BDS Test for Nonlinearity . . . . . . . . . . . . . . . . . . . 652
18.2.1 BDS Test Statistic . . . . . . . . . . . . . . . . . . . 653
18.2.2 Size of BDS Test . . . . . . . . . . . . . . . . . . . . 653
18.2.3 BDS Test As a Nonlinearity Test and a Mis-specification Test . . . . . . . . . . . . . . . . . . . . . . . . . . . 655 18.3 Threshold AutoregressiveModels . . . . . . . . . . . . . . . 660 18.3.1 TAR and SETARModels . . . . . . . . . . . . . . . 661 18.3.2 Tsay’s Approach . . . . . . . . . . . . . . . . . . . . 662 18.3.3 Hansen’s Approach . . . . . . . . . . . . . . . . . . . 669 18.4 Smooth Transition AutoregressiveModels . . . . . . . . . . 676 18.4.1 Logistic and Exponential STARModels . . . . . . . 676 18.4.2 Test for STAR Nonlinearity . . . . . . . . . . . . . . 678 18.4.3 Estimation of STARModels . . . . . . . . . . . . . . 681 18.5 Markov Switching State SpaceModels . . . . . . . . . . . . 685 18.5.1 Discrete StateMarkov Process . . . . . . . . . . . . 686 18.5.2 Markov Switching AR Process . . . . . . . . . . . . 688 18.5.3 Markov Switching State SpaceModels . . . . . . . . 689 18.6 An Extended Example: Markov Switching Coincident Index 699 18.6.1 State Space Representation of Markov Switching Coincident IndexModel . . . . . . . . . . . . . . . . . . 700
Test . . . . . . . . . . . . . . . . . . . . . . . . . . . 655
18.3 Threshold AutoregressiveModels . . . . . . . . . . . . . . . 660
18.3.1 TAR and SETARModels . . . . . . . . . . . . . . . 661
18.3.2 Tsay’s Approach . . . . . . . . . . . . . . . . . . . . 662
18.3.3 Hansen’s Approach . . . . . . . . . . . . . . . . . . . 669
18.4 Smooth Transition AutoregressiveModels . . . . . . . . . . 676
18.4.1 Logistic and Exponential STARModels . . . . . . . 676
18.4.2 Test for STAR Nonlinearity . . . . . . . . . . . . . . 678
18.4.3 Estimation of STARModels . . . . . . . . . . . . . . 681
18.5 Markov Switching State SpaceModels . . . . . . . . . . . . 685
18.5.1 Discrete StateMarkov Process . . . . . . . . . . . . 686
18.5.2 Markov Switching AR Process . . . . . . . . . . . . 688
18.5.3 Markov Switching State SpaceModels . . . . . . . . 689
18.6 An Extended Example: Markov Switching Coincident Index 699
18.6.1 State Space Representation of Markov Switching Coincident
IndexModel . . . . . . . . . . . . . . . . . . 700
xii Contents
18.6.2 Approximate MLE of Markov Switching Coincident
Index . . . . . . . . . . . . . . . . . . . . . . . . . . 703
18.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
19 Copulas 711
19.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
19.2 Motivating Example . . . . . . . . . . . . . . . . . . . . . . 712
19.3 Definitions and Basic Properties of Copulas . . . . . . . . . 720 19.3.1 Properties of Distributions . . . . . . . . . . . . . . 720 19.3.2 Copulas and Sklar’s Theorem . . . . . . . . . . . . . 722 19.3.3 DependenceMeasures and Copulas . . . . . . . . . . 724 19.4 Parametric Copula Classes and Families . . . . . . . . . . . 727 19.4.1 Normal Copula . . . . . . . . . . . . . . . . . . . . . 727 19.4.2 NormalMixture Copula . . . . . . . . . . . . . . . . 728 19.4.3 Extreme Value Copula Class . . . . . . . . . . . . . 728 19.4.4 Archimedean Copulas . . . . . . . . . . . . . . . . . 730 19.4.5 Archimax Copulas . . . . . . . . . . . . . . . . . . . 733 19.4.6 Representation of Copulas in S+FinMetrics . . . . . 733 19.4.7 Creating Arbitrary Bivariate Distributions . . . . . . 741 19.4.8 Simulating from Arbitrary Bivariate Distributions . 743 19.5 Fitting Copulas to Data . . . . . . . . . . . . . . . . . . . . 745 19.5.1 Empirical Copula . . . . . . . . . . . . . . . . . . . . 745 19.5.2 MaximumLikelihood Estimation . . . . . . . . . . . 748 19.5.3 Fitting Copulas Using the S+FinMetrics/EVANESCE
19.3.1 Properties of Distributions . . . . . . . . . . . . . . 720
19.3.2 Copulas and Sklar’s Theorem . . . . . . . . . . . . . 722
19.3.3 DependenceMeasures and Copulas . . . . . . . . . . 724
19.4 Parametric Copula Classes and Families . . . . . . . . . . . 727
19.4.1 Normal Copula . . . . . . . . . . . . . . . . . . . . . 727
19.4.2 NormalMixture Copula . . . . . . . . . . . . . . . . 728
19.4.3 Extreme Value Copula Class . . . . . . . . . . . . . 728
19.4.4 Archimedean Copulas . . . . . . . . . . . . . . . . . 730
19.4.5 Archimax Copulas . . . . . . . . . . . . . . . . . . . 733
19.4.6 Representation of Copulas in S+FinMetrics . . . . . 733 19.4.7 Creating Arbitrary Bivariate Distributions . . . . . . 741 19.4.8 Simulating from Arbitrary Bivariate Distributions . 743 19.5 Fitting Copulas to Data . . . . . . . . . . . . . . . . . . . . 745 19.5.1 Empirical Copula . . . . . . . . . . . . . . . . . . . . 745 19.5.2 MaximumLikelihood Estimation . . . . . . . . . . . 748 19.5.3 Fitting Copulas Using the S+FinMetrics/EVANESCE
19.4.7 Creating Arbitrary Bivariate Distributions . . . . . . 741
19.4.8 Simulating from Arbitrary Bivariate Distributions . 743
19.5 Fitting Copulas to Data . . . . . . . . . . . . . . . . . . . . 745
19.5.1 Empirical Copula . . . . . . . . . . . . . . . . . . . . 745
19.5.2 MaximumLikelihood Estimation . . . . . . . . . . . 748
19.5.3 Fitting Copulas Using the S+FinMetrics/EVANESCE
S+FinMetrics/EVANESCEfunction fit.copula . . . . . . . . . . . . . . . . . . 749 19.6 RiskManagement Using Copulas . . . . . . . . . . . . . . . 752 19.6.1 Computing Portfolio Risk Measures Using Copulas . 752 19.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
19.6 RiskManagement Using Copulas . . . . . . . . . . . . . . . 752
19.6.1 Computing Portfolio Risk Measures Using Copulas . 752
19.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
20 Continuous-Time Models for Financial Time Series 757
20.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
20.2 SDEs — Background . . . . . . . . . . . . . . . . . . . . . . 758
20.3 Approximating solutions to SDEs . . . . . . . . . . . . . . . 759
20.4 S+FinMetrics functions for solving SDEs . . . . . . . . . . 763 20.4.1 Problem-specific simulators . . . . . . . . . . . . . . 763 20.4.2 General simulators . . . . . . . . . . . . . . . . . . . 769 20.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780
20.4.1 Problem-specific simulators . . . . . . . . . . . . . . 763 20.4.2 General simulators . . . . . . . . . . . . . . . . . . . 769 20.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780
20.4.2 General simulators . . . . . . . . . . . . . . . . . . . 769
20.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780
21 Generalized Method of Moments 783
21.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 783
21.2 Single Equation Linear GMM . . . . . . . . . . . . . . . . . 784
21.2.1 Definition of the GMMEstimator . . . . . . . . . . 785 21.3 Estimation of S . . . . . . . . . . . . . . . . . . . . . . . . . 791 21.3.1 Serially UncorrelatedMoments . . . . . . . . . . . . 791 21.3.2 Serially CorrelatedMoments . . . . . . . . . . . . . 792
21.3 Estimation of S . . . . . . . . . . . . . . . . . . . . . . . . . 791 21.3.1 Serially UncorrelatedMoments . . . . . . . . . . . . 791 21.3.2 Serially CorrelatedMoments . . . . . . . . . . . . . 792
21.3.1 Serially UncorrelatedMoments . . . . . . . . . . . . 791
21.3.2 Serially CorrelatedMoments . . . . . . . . . . . . . 792
Contents xiii
21.3.3 Estimating S Using the S+FinMetrics Function var.hac794 21.4 GMM Estimation Using the S+FinMetrics Function GMM . 795 21.5 Hypothesis Testing for LinearModels . . . . . . . . . . . . 806 21.5.1 Testing Restrictions on Coefficients . . . . . . . . . . 806 21.5.2 Testing Subsets of Orthogonality Conditions . . . . 809 21.5.3 Testing Instrument Relevance . . . . . . . . . . . . . 811 21.6 Nonlinear GMM . . . . . . . . . . . . . . . . . . . . . . . . 814 21.6.1 Asymptotic Properties . . . . . . . . . . . . . . . . . 815 21.6.2 Hypothesis Tests for NonlinearModels . . . . . . . . 816 21.7 Examples of NonlinearModels . . . . . . . . . . . . . . . . 817 21.7.1 Student-t Distribution . . . . . . . . . . . . . . . . . 817 21.7.2 MA(1)Model . . . . . . . . . . . . . . . . . . . . . . 819 21.7.3 Euler Equation Asset PricingModel . . . . . . . . . 825 21.7.4 Stochastic VolatilityModel . . . . . . . . . . . . . . 830 21.7.5 Interest Rate DiffusionModel . . . . . . . . . . . . . 835 21.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840
21.4 GMM Estimation Using the S+FinMetrics Function GMM . 795 21.5 Hypothesis Testing for LinearModels . . . . . . . . . . . . 806 21.5.1 Testing Restrictions on Coefficients . . . . . . . . . . 806 21.5.2 Testing Subsets of Orthogonality Conditions . . . . 809 21.5.3 Testing Instrument Relevance . . . . . . . . . . . . . 811 21.6 Nonlinear GMM . . . . . . . . . . . . . . . . . . . . . . . . 814 21.6.1 Asymptotic Properties . . . . . . . . . . . . . . . . . 815 21.6.2 Hypothesis Tests for NonlinearModels . . . . . . . . 816 21.7 Examples of NonlinearModels . . . . . . . . . . . . . . . . 817 21.7.1 Student-t Distribution . . . . . . . . . . . . . . . . . 817 21.7.2 MA(1)Model . . . . . . . . . . . . . . . . . . . . . . 819 21.7.3 Euler Equation Asset PricingModel . . . . . . . . . 825 21.7.4 Stochastic VolatilityModel . . . . . . . . . . . . . . 830 21.7.5 Interest Rate DiffusionModel . . . . . . . . . . . . . 835 21.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840
21.5 Hypothesis Testing for LinearModels . . . . . . . . . . . . 806
21.5.1 Testing Restrictions on Coefficients . . . . . . . . . . 806 21.5.2 Testing Subsets of Orthogonality Conditions . . . . 809 21.5.3 Testing Instrument Relevance . . . . . . . . . . . . . 811 21.6 Nonlinear GMM . . . . . . . . . . . . . . . . . . . . . . . . 814 21.6.1 Asymptotic Properties . . . . . . . . . . . . . . . . . 815 21.6.2 Hypothesis Tests for NonlinearModels . . . . . . . . 816 21.7 Examples of NonlinearModels . . . . . . . . . . . . . . . . 817 21.7.1 Student-t Distribution . . . . . . . . . . . . . . . . . 817 21.7.2 MA(1)Model . . . . . . . . . . . . . . . . . . . . . . 819 21.7.3 Euler Equation Asset PricingModel . . . . . . . . . 825 21.7.4 Stochastic VolatilityModel . . . . . . . . . . . . . . 830 21.7.5 Interest Rate DiffusionModel . . . . . . . . . . . . . 835 21.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840
21.5.2 Testing Subsets of Orthogonality Conditions . . . . 809
21.5.3 Testing Instrument Relevance . . . . . . . . . . . . . 811
21.6 Nonlinear GMM . . . . . . . . . . . . . . . . . . . . . . . . 814
21.6.1 Asymptotic Properties . . . . . . . . . . . . . . . . . 815
21.6.2 Hypothesis Tests for NonlinearModels . . . . . . . . 816
21.7 Examples of NonlinearModels . . . . . . . . . . . . . . . . 817
21.7.1 Student-t Distribution . . . . . . . . . . . . . . . . . 817
21.7.2 MA(1)Model . . . . . . . . . . . . . . . . . . . . . . 819
21.7.3 Euler Equation Asset PricingModel . . . . . . . . . 825
21.7.4 Stochastic VolatilityModel . . . . . . . . . . . . . . 830
21.7.5 Interest Rate DiffusionModel . . . . . . . . . . . . . 835 21.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840
21.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840
22 Semi-Nonparametric Conditional Density Models 845
22.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 845
22.2 Overview of SNPMethodology . . . . . . . . . . . . . . . . 846
22.3 Estimating SNP Models in S+FinMetrics . . . . . . . . . . 849 22.3.1 Example Data . . . . . . . . . . . . . . . . . . . . . 851 22.3.2 Markovian Time Series and the Gaussian Vector AutoregressionModel . . . . . . . . . . . . . . . . . . . 853 22.3.3 Hermite Expansion and the Semiparametric VAR . . 858 22.3.4 Conditional Heterogeneity . . . . . . . . . . . . . . . 866 22.3.5 ARCH/GARCH Leading Term . . . . . . . . . . . . 871 22.4 SNPModel Selection . . . . . . . . . . . . . . . . . . . . . . 877 22.4.1 RandomRestarts . . . . . . . . . . . . . . . . . . . . 879 22.4.2 The expand Function . . . . . . . . . . . . . . . . . 884 22.4.3 The SNP.auto Function . . . . . . . . . . . . . . . . 887 22.5 SNPModel Diagnostics . . . . . . . . . . . . . . . . . . . . 889 22.5.1 Residual Analysis . . . . . . . . . . . . . . . . . . . . 889 22.5.2 Simulation . . . . . . . . . . . . . . . . . . . . . . . 893 22.6 Prediction froman SNPModel . . . . . . . . . . . . . . . . 895 22.7 Data Transformations . . . . . . . . . . . . . . . . . . . . . 896 22.7.1 Centering and Scaling Transformation . . . . . . . . 897 22.7.2 Transformations to deal with Heavy Tailed Data . . 899 22.7.3 Transformation to Deal with Small SNP Density Values901 22.8 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 902 22.8.1 SNP Models for Daily Returns on Microsoft Stock . 902 22.8.2 SNP Models for Daily Returns on S&P 500 Index . 907 22.8.3 SNP Models for Weekly 3-Month U.S. T-Bill Rates . 913 22.9 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 917
22.3.1 Example Data . . . . . . . . . . . . . . . . . . . . . 851
22.3.2 Markovian Time Series and the Gaussian Vector AutoregressionModel
. . . . . . . . . . . . . . . . . . . 853
22.3.3 Hermite Expansion and the Semiparametric VAR . . 858
22.3.4 Conditional Heterogeneity . . . . . . . . . . . . . . . 866
22.3.5 ARCH/GARCH Leading Term . . . . . . . . . . . . 871
22.4 SNPModel Selection . . . . . . . . . . . . . . . . . . . . . . 877
22.4.1 RandomRestarts . . . . . . . . . . . . . . . . . . . . 879
22.4.2 The expand Function . . . . . . . . . . . . . . . . . 884 22.4.3 The SNP.auto Function . . . . . . . . . . . . . . . . 887 22.5 SNPModel Diagnostics . . . . . . . . . . . . . . . . . . . . 889 22.5.1 Residual Analysis . . . . . . . . . . . . . . . . . . . . 889 22.5.2 Simulation . . . . . . . . . . . . . . . . . . . . . . . 893 22.6 Prediction froman SNPModel . . . . . . . . . . . . . . . . 895 22.7 Data Transformations . . . . . . . . . . . . . . . . . . . . . 896 22.7.1 Centering and Scaling Transformation . . . . . . . . 897 22.7.2 Transformations to deal with Heavy Tailed Data . . 899 22.7.3 Transformation to Deal with Small SNP Density Values901 22.8 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 902 22.8.1 SNP Models for Daily Returns on Microsoft Stock . 902 22.8.2 SNP Models for Daily Returns on S&P 500 Index . 907 22.8.3 SNP Models for Weekly 3-Month U.S. T-Bill Rates . 913 22.9 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 917
22.4.3 The SNP.auto Function . . . . . . . . . . . . . . . . 887 22.5 SNPModel Diagnostics . . . . . . . . . . . . . . . . . . . . 889 22.5.1 Residual Analysis . . . . . . . . . . . . . . . . . . . . 889 22.5.2 Simulation . . . . . . . . . . . . . . . . . . . . . . . 893 22.6 Prediction froman SNPModel . . . . . . . . . . . . . . . . 895 22.7 Data Transformations . . . . . . . . . . . . . . . . . . . . . 896 22.7.1 Centering and Scaling Transformation . . . . . . . . 897 22.7.2 Transformations to deal with Heavy Tailed Data . . 899 22.7.3 Transformation to Deal with Small SNP Density Values901 22.8 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 902 22.8.1 SNP Models for Daily Returns on Microsoft Stock . 902 22.8.2 SNP Models for Daily Returns on S&P 500 Index . 907 22.8.3 SNP Models for Weekly 3-Month U.S. T-Bill Rates . 913 22.9 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 917
22.5 SNPModel Diagnostics . . . . . . . . . . . . . . . . . . . . 889
22.5.1 Residual Analysis . . . . . . . . . . . . . . . . . . . . 889
22.5.2 Simulation . . . . . . . . . . . . . . . . . . . . . . . 893
22.6 Prediction froman SNPModel . . . . . . . . . . . . . . . . 895
22.7 Data Transformations . . . . . . . . . . . . . . . . . . . . . 896
22.7.1 Centering and Scaling Transformation . . . . . . . . 897
22.7.2 Transformations to deal with Heavy Tailed Data . . 899
22.7.3 Transformation to Deal with Small SNP Density Values901
22.8 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 902
22.8.1 SNP Models for Daily Returns on Microsoft Stock . 902
22.8.2 SNP Models for Daily Returns on S&P 500 Index . 907
22.8.3 SNP Models for Weekly 3-Month U.S. T-Bill Rates . 913
22.9 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 917
xiv Contents
23 Efficient Method of Moments 921
fficient Method of Moments 92123.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 921
23.2 An Overview of the EMMMethodology . . . . . . . . . . . 923
23.2.1 Continuous Time Stochastic Volatility Model for Interest
Rates . . . . . . . . . . . . . . . . . . . . . . . 923
23.2.2 MinimumChi-Squared Estimators . . . . . . . . . . 926
23.2.3 Efficiency Considerations . . . . . . . . . . . . . . . 928 23.2.4 A General Purpose Auxiliary Model . . . . . . . . . 933 23.2.5 The Projection Step . . . . . . . . . . . . . . . . . . 933 23.2.6 The Estimation Step . . . . . . . . . . . . . . . . . . 934 23.3 EMM Estimation in S+FinMetrics . . . . . . . . . . . . . . 936 23.3.1 Simulator Functions . . . . . . . . . . . . . . . . . . 938 23.3.2 SNP AuxiliaryModel Estimation . . . . . . . . . . . 941 23.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 941 23.4.1 MA(1)Model . . . . . . . . . . . . . . . . . . . . . . 942 23.4.2 Discrete Time Stochastic Volatility Models . . . . . 952 23.4.3 Interest Rate DiffusionModels . . . . . . . . . . . . 964 23.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 983
23.2.4 A General Purpose Auxiliary Model . . . . . . . . . 933
23.2.5 The Projection Step . . . . . . . . . . . . . . . . . . 933
23.2.6 The Estimation Step . . . . . . . . . . . . . . . . . . 934
23.3 EMM Estimation in S+FinMetrics . . . . . . . . . . . . . . 936 23.3.1 Simulator Functions . . . . . . . . . . . . . . . . . . 938 23.3.2 SNP AuxiliaryModel Estimation . . . . . . . . . . . 941 23.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 941 23.4.1 MA(1)Model . . . . . . . . . . . . . . . . . . . . . . 942 23.4.2 Discrete Time Stochastic Volatility Models . . . . . 952 23.4.3 Interest Rate DiffusionModels . . . . . . . . . . . . 964 23.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 983
23.3.1 Simulator Functions . . . . . . . . . . . . . . . . . . 938
23.3.2 SNP AuxiliaryModel Estimation . . . . . . . . . . . 941
23.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 941
23.4.1 MA(1)Model . . . . . . . . . . . . . . . . . . . . . . 942
23.4.2 Discrete Time Stochastic Volatility Models . . . . . 952
23.4.3 Interest Rate DiffusionModels . . . . . . . . . . . . 964 23.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 983
23.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 983
Index 989