Highlights
What are the main findings?
- A Bayesian Markov switching autoregressive model with time-varying parameters (Bayesian MSAR-TVP) is proposed for forecasting nonlinear time series data with stochastic structural variations.
- The Bayesian MSAR-TVP model outperforms the Classical MSAR, Classical MSAR-TVP, and Bayesian AR-TVP models in forecasting U.S. real GNP, particularly in handling complex datasets and out-of-sample forecasting.
What are the implications of the main findings?
- The proposed model addresses parameter uncertainty and adapts dynamically to regime shifts, enhancing the accuracy and reliability of economic forecasting.
- Its ability to capture economic volatility and structural breaks makes it an important tool for policy formulation and long-term economic predictions.
Abstract
This research tackles the challenge of forecasting nonlinear time series data with stochastic structural variations by proposing the Markov switching autoregressive model with time-varying parameters (MSAR-TVP). Although effective in modeling dynamic regime transitions, the Classical MSAR-TVP faces challenges with complex datasets. To address these issues, a Bayesian MSAR-TVP framework was developed, incorporating flexible parameters that adapt dynamically across regimes. The model was tested on two periods of U.S. real GNP data: a historically stable segment (1952–1986) and a more complex, modern segment that includes more economic volatility (1947–2024). The Bayesian MSAR-TVP demonstrated superior performance in handling complex datasets, particularly in out-of-sample forecasting, outperforming the Bayesian AR-TVP, Classical MSAR-TVP, and Classical MSAR models, as evaluated by mean absolute percentage error (MAPE) and mean absolute error (MAE). For in-sample data, the Classical MSAR-TVP retained its stability advantage. These findings highlight the Bayesian MSAR-TVP’s ability to address parameter uncertainty and adapt to data fluctuations, making it highly effective for forecasting dynamic economic cycles. Additionally, the two-year forecast underscores its practical utility in predicting economic cycles, suggesting continued expansion. This reinforces the model’s significance for economic forecasting and strategic policy formulation.
1. Introduction
Economic time series modeling has long been central to research on structural changes, nonlinearity, and non-stationarity, which are frequently encountered in economic data. A significant challenge in analyzing time series data is addressing the complexity arising from stochastic structural shifts. These stochastic structural changes refer to shifts in data patterns that may result from changes in economic policies, market dynamics, or global events. Nonlinear time series data are characterized by irregular patterns or behaviors that do not follow a simple linear relationship. This means the relationships between the variables fluctuate and evolve over time. Structural changes refer to shifts in the underlying patterns within the time series data. Linear approaches, including the autoregressive integrated moving average (ARIMA) model, frequently fall short in representing these nonlinear behaviors effectively [1,2]. As a result, the development of time series models has focused on capturing these nonlinearities and accounting for structural shifts in the data. To address these challenges, more sophisticated methods, such as Markov switching autoregressive (MSAR) models and those incorporating time-varying parameters (TVP), have been introduced. MSAR models, which capture transitions between different regimes based on an unobserved latent variable, have been applied to various domains, including real gross national product (GNP), stock market returns, equity prices, currency exchange rates, and inflation metrics [3,4,5,6]. The TVP model offers a key advantage by dynamically updating parameters to adapt to changing data relationships. Unlike fixed-parameter models, it adjusts in real-time, making it better suited for forecasting in dynamic environments. This continuous updating enables the model to handle shifting regimes without the need for recalibration at each stage, ensuring more accurate and timely predictions, especially in data with rapid structural changes [7,8].
The MSAR model, first introduced by Hamilton [3], is a widely used approach for capturing transitions between different economic regimes, such as phases of expansion and recession. This model assumes that variations in data patterns are governed by an unobserved latent variable representing the regime. By segmenting the data into distinct regimes, where each segment adheres to its unique autoregressive (AR) process, the MSAR framework effectively captures shifts between regimes. However, despite its effectiveness, the Classical MSAR model exhibits limitations in parameter flexibility, particularly when data exhibit gradual parameter changes within each regime [9].
GNP and gross domestic product (GDP) are both key economic indicators that measure overall economic activity. While GDP refers to the total value of goods and services produced within a country’s borders, GNP includes net income from abroad, making it a broader measure of national economic performance. Despite the shift in preference toward GDP in recent decades, U.S. real GNP data has been extensively studied in time series modeling due to its characteristics, including nonlinearity, structural changes, and complex regime dynamics. Hamilton [3] pioneered the application of the MSAR model to analyze business cycles and transitions between expansion and recession regimes. Subsequent studies by Lam [10] generalized Hamilton’s framework by relaxing the unit-root restriction in the autoregressive component, enabling the model to capture more flexible regime dynamics. Kim [11] further refined the model by introducing a state-space approach that integrated a general autoregressive component, enabling more flexible parameter estimation. On the other hand, Cai [12] utilized the quantile self-exciting threshold autoregressive (QSETAR) model to capture more specific nonlinear patterns in GNP data. More recently, Doornik [9] proposed the Markov switching component model, which provides a more nuanced structural representation of temporal variations. These studies highlight the importance of U.S. real GNP as a standard reference dataset for assessing the performance of different time series models, especially those designed to handle structural shifts.
To overcome the limitations of the traditional MSAR model and further investigate the modeling of U.S. real GNP data, the Markov switching autoregressive model with time-varying parameters (MSAR-TVP) was introduced in a previous study [13]. This model extends the MSAR framework by incorporating time-varying parameters, enabling greater flexibility in capturing structural shifts [11,14]. The MSAR-TVP model has demonstrated effectiveness not only in monitoring dynamic processes but also in delivering reliable forecasting results. In prior research, parameters were estimated conventionally using maximum likelihood estimation (MLE) alongside the Kim filter—a method combining the Kalman filter, Hamilton filter, and Kim collapsing—while optimization was performed via the Nelder–Mead algorithm. For the purposes of this study, this approach is referred to as the Classical MSAR-TVP model. Leveraging these capabilities, the Classical MSAR-TVP model showed superior performance when applied to U.S. real GNP data, which exhibit nonlinear behavior and structural transitions between periods of economic expansion and recession. Furthermore, the Classical MSAR-TVP outperformed the traditional MSAR model, here defined as the MSAR model estimated using MLE combined with the Hamilton filter.
Parameter optimization was conducted using the Nelder–Mead algorithm. While the Classical MSAR-TVP model has its strengths, it encounters several limitations, particularly when dealing with highly complex datasets. These limitations stem from its inability to adequately represent parameter uncertainty and its constrained flexibility in modeling posterior parameter distributions. To overcome these issues, the Bayesian methodology provides a more robust alternative c. The Bayesian framework enhances estimation by incorporating prior distributions, directly quantifying parameter uncertainty through posterior distributions [15]. Utilizing Markov chain Monte Carlo (MCMC) methods, such as Gibbs sampling, the Bayesian approach facilitates iterative sampling from the posterior distribution, enabling more precise parameter estimates, particularly for challenging datasets. This Bayesian method has been widely developed and proven effective for estimating parameters in MSAR models applied to complex data. The Bayesian approach has been extensively developed and shown to be effective in estimating parameters for MSAR models using MCMC methods, particularly Gibbs sampling [16,17,18]. Similarly, Bayesian methods have been widely applied to TVP models through Gibbs sampling, yielding significant results in capturing nonlinear data patterns [19,20,21,22].
This study introduces a novel framework for the MSAR-TVP model employing Bayesian parameter estimation, termed the Bayesian MSAR-TVP model. This enhanced approach utilizes the Bayesian framework to combine prior knowledge with observed data, enabling more reliable parameter estimation. By incorporating dynamic time-varying parameters, the Bayesian MSAR-TVP model enhances forecasting precision while offering deeper insights into regime shifts in economic time series. A key technical concern in Markov switching models is the label switching problem, which arises when the model’s latent regimes are not uniquely identifiable. Label switching occurs when regimes are arbitrarily assigned labels, leading to ambiguities in regime identification. In this study, we address this issue by proposing a Bayesian MSAR-TVP model that integrates Gibbs sampling with the Kim filter. Our proposed framework allows for joint estimation of regime labels and time-varying parameters, ensuring consistent regime identification across iterations. By capturing both parameter uncertainty and regime switching dynamics, the model offers a more robust framework for analyzing economic time series with complex structural changes.
In addition to the Bayesian MSAR-TVP model, this study also introduces the Bayesian Autoregressive with Time-Varying Parameters (Bayesian AR-TVP) model. This new model incorporates Bayesian parameter estimation, which adapts more dynamically to data with time-varying volatility, addressing some of the limitations identified in previous models. In contrast to the Bayesian MSAR-TVP model, which effectively captures regime shifts and time-varying parameters, the Bayesian AR-TVP model offers additional flexibility by modeling time-varying volatility. While both models aim to improve forecasting accuracy in dynamic economic environments, each offers unique advantages: the Bayesian MSAR-TVP is superior for clear regime shifts, while the Bayesian AR-TVP excels in environments with high, continuous volatility. The main aim of this study is to design the Bayesian MSAR-TVP framework and compare its performance against the Classical MSAR, Classical MSAR-TVP, and Bayesian AR-TVP models. These models are tested on U.S. real GNP datasets, containing relatively stable data (1952–1986) and more complex data (1947–2024). Model performance is evaluated using metrics such as mean absolute percentage error (MAPE) and mean absolute error (MAE), with the goal of assessing the Bayesian model’s ability to capture intricate economic patterns and produce more accurate predictions. The use of GNP instead of GDP follows Hamilton’s original study and ensures consistency with previous Classical MSAR and Classical MSAR-TVP applications in the literature.
Additionally, this research examines the capacity of the Bayesian MSAR-TVP model to identify regime changes, including recessions and expansions, and evaluates its two-year forecasting ability to support data-informed decision-making. This model provides a versatile analytical framework applicable across domains such as finance, stock markets, and policy-making.
The organization of this paper is as follows: Section 2 describes the fundamental model, outlines the development of the MSAR-TVP model, and explains the parameter estimation approach. Section 3 presents the findings of this research. Section 4 analyzes the empirical results and provides recommendations for future studies. Finally, Section 5 summarizes the conclusions of the paper.
2. Materials and Methods
2.1. MSAR-TVP Model
The MSAR-TVP model is an extension of the MSAR model, incorporating time-varying parameters within each regime. This model was introduced in our previous study [13]. It is designed to address time series data characterized by nonlinearity and stochastic structural changes. The concept integrates the state-space model representation with parameters that evolve over time according to a specific function, consistent with the AR process within each regime.
The MSAR-TVP model can be denoted as MS(M)-AR(p)-TVP, where M represents the number of regimes and p is the AR order within each regime. The model’s time-varying parameters are denoted as for each and . These parameters follow an AR(1) process.
The model can be formulated as follows:
Measurement Equation:
Parameter Transition Equation:
Transition Probabilities Matrix:
where , with , , and . Here, represents the dependent variable at time ; is the explanatory variable comprising the lagged values of ; is the mean of the observed data at time , influenced by state changes; is the unknown time-varying parameter of the -th order AR at time , influenced by state changes; is the -th order AR coefficient in the parameter transition equation, influenced by state changes; is the mean at time in the -th order AR in the parameter transition equation, influenced by state changes; is the error term of the measurement equation, with ; is the error term of the parameter transition equation, with ; is the variance of , influenced by state changes; is the variance of , influenced by state changes; and is the transition probabilities from state to state .
To simplify the implementation, the MSAR-TVP model in Equations (1)–(3) can be represented in vector and matrix notation as follows:
Measurement Equation:
where and ,
Parameter Transition Equation:
where and for , and the transition probability matrix as stated in Equation (3).
Here, it is defined that:
2.2. Bayesian Method
The Bayesian method is based on Bayes’ theorem, which combines prior information about the model parameters with observed data to produce a posterior distribution. Unlike classical methods, Bayesian inference treats all unknown parameters as random variables with specific prior distributions. Let represent the vector of unknown parameters of a model, and denote the data vector. The posterior distribution, which reflects updated information about the parameters, can be expressed as follows:
where is the posterior distribution, is the likelihood, and is the prior distribution. Equation (6) states that prior information is updated using the sample information contained in the data likelihood to obtain the posterior distribution, which is subsequently used for decision-making [23].
The prior distribution describes the initial information about the parameters before any observations are made, whereas the posterior distribution results from updating the prior information using sample data through the likelihood. The likelihood function, , serves as a continuous mechanism for updating the prior, enabling the resulting posterior distribution to be used as the new prior in subsequent iterations.
The selection of a prior distribution plays a crucial role in the Bayesian approach as it directly influences the posterior distribution inference. According to the literature, there are several types of priors, such as conjugate priors, non-conjugate priors, informative priors, non-informative priors, proper priors, improper priors, and pseudo priors [24,25]. A prior is considered conjugate if it has the same distributional form as its posterior distribution [26]. In this study, a conjugate prior is employed to simplify calculations and facilitate the application of computational methods in Bayesian analysis.
Bayesian inference often involves high-dimensional integration that is challenging to solve analytically. To address this issue, MCMC methods, such as the Gibbs Sampling algorithm, are used to enable iterative sampling from the posterior distribution. The algorithm constructs a Markov chain that converges to the posterior distribution, resulting in accurate parameter estimation. For the Markov chain to satisfy ergodicity and converge to the target distribution, several conditions must be met. First, the chain must be irreducible, meaning the transition probability between all states must be non-zero, ensuring that every state can be accessed from any other state. Second, it must be aperiodic, indicating that no periodic pattern exists in the parameter iterations, thereby preventing the Markov chain from becoming trapped in a fixed cycle. Finally, the chain must be positive recurrent, where parameters return to a specific value within a finite average time, ensuring the stability of the chain. Meeting these three conditions ensures that the parameter distributions obtained from MCMC accurately represent the posterior distribution.
The convergence of the MCMC algorithm can be evaluated using trace plots and autocorrelation function (ACF) plots. A trace plot visualizes the stability of the parameters and ensures that ergodicity is achieved, as indicated by parameters fluctuating randomly around a certain range that aligns with the target distribution. Stable and random fluctuations, resembling the shape of a “fat hairy caterpillar” [27], suggest that the parameter values have stabilized and are representative of the posterior distribution. Once ergodicity is confirmed, the independence between iterations is examined through the ACF plot, which identifies correlations across iterations. A significant ACF value at lag-0 and values close to zero at other lags indicate that the generated parameters efficiently cover the entire target distribution without autocorrelation between iterations.
The sampling process in MCMC aims to produce a Markov chain that satisfies the properties of positive recurrence, irreducibility, and aperiodicity. When these conditions are met, the parameter distribution generated by the chain will converge to a stationary distribution that aligns with the desired posterior distribution. If these assumptions are not satisfied, corrective steps such as increasing the number of iterations, performing a burn-in, adjusting the thinning value, or modifying the data distribution and prior may be required to improve accuracy.
The primary challenge in MCMC is generating samples from the posterior distribution density to calculate the expectation of posterior quantities. One of the most commonly used numerical sampling algorithms in MCMC is Gibbs sampling, which was selected in this study due to its efficiency in generating samples from the target distribution.
2.3. Gibbs Sampling
One of the widely used methods in Markov chain Monte Carlo (MCMC) is Gibbs sampling, introduced by Geman and Geman [15]. This method allows the generation of random variables from a marginal distribution directly, without the need to compute the density function of the distribution, through iterations in numerical simulation [28]. Sampling in Gibbs sampling is performed by generating a sequence of Gibbs random variables (Gibbs sequences) based on the fundamental properties of the Markov chain process. This process requires the conditional distribution for each variable being updated, assuming that the other variables remain fixed. For instance, given the joint posterior as shown in Equation (6), the full conditional distribution for the -th parameter can be expressed as:
where .
The general Gibbs sampling algorithm, referred to as Algorithm 1, can be described as follows:
| Algorithm 1. General Gibbs Sampling Algorithm |
|
This process is repeated until convergence is achieved in the distribution.
There are two main approaches in Gibbs sampling, namely single-move and multi-move Gibbs sampling [14], which are explained as follows.
- Single-Move Gibbs SamplingIn this approach, the elements of the parameter vector are updated one at a time. In each iteration, every element is updated based on its full conditional distribution , assuming the other elements remain fixed. Here, represents the parameter vector excluding . In other words, Algorithm 1 represents the single-move Gibbs sampling approach. This approach requires relatively simple computations, as only one parameter is updated at a time, and its conditional distribution is straightforward to calculate. However, this method tends to require more iterations to achieve convergence, particularly when the parameters exhibit high correlations.
- Multi-Move Gibbs SamplingUnlike the single-move approach, in multi-move Gibbs sampling, the entire parameter vector is updated simultaneously in a single iteration step. The parameters are jointly updated from the joint distribution . This approach is more efficient, especially when the parameters exhibit high correlations, as the entire vector is updated together. However, the computations become more complex because evaluating the joint distribution requires additional considerations, which can be analytically or numerically challenging.
The multi-move Gibbs sampling approach follows the same step structure as Algorithm 1, but the entire parameter vector is updated simultaneously using the joint distribution .
Subsequently, we developed a novel approach for parameter estimation in the MSAR-TVP model by integrating Gibbs sampling with the Kim filter. This innovative approach is designed to support the resolution of application-specific problems that are the focus of this research.
2.4. Estimation Procedures
The MSAR-TVP model was previously introduced in [13], with parameter estimation conducted using a classical approach. This approach utilized the Kim filter, a combination of the Kalman filter, Hamilton filter, and Kim collapsing procedure, as a filtering method to handle unobserved state vectors in models with time-varying parameters and regime switching. This section presents a novel approach for estimating the parameters of the MSAR-TVP model by integrating Gibbs sampling with the Kim filter.
This study formulates the parameter estimation algorithm for the MSAR-TVP model based on Equations (4) and (5). The focus of this research is on cases where the AR order is and the number of regimes is , denoted as MS(2)-AR(1)-TVP. The corresponding model equations are as follows:
Measurement Equation:
where ,
Parameter Transition Equation:
where and ,
Transition Probability Matrix as in Equation (3) by substituting , resulting in:
where with , and .
The summary of the Kim filter for the MS(2)-AR(1)-TVP model is as follows [13]:
- Determine the initial value and for the Kalman filter, as well as for the Hamilton filter, for .
- Run the Kalman filter to estimate for .
- Run the Hamilton filter to compute and for .
- Apply the Kim collapsing procedure, utilizing the probability terms from Step 3, to reduce the posterior matrix size from to
- Calculate the log-likelihood function for .
This process involves recursive steps that are iteratively executed for , continuously updating the information. The full procedure for the MSAR-TVP model filtering can be found in [13].
In the Bayesian approach, for , the parameters of the MS(2)-AR(1)-TVP model are represented as
Parameters such as , are estimated using predefined prior distributions. Other parameters, such as , are computed based on the results of other parameter estimations. This hierarchical estimation structure follows the Bayesian framework of Kim and Nelson [14], ensuring stable convergence and consistent inference across regimes. All these parameters depend on the unobserved variable which takes a value of 1 or 2 to represent two distinct regimes. These parameters are estimated using the Bayesian approach with Gibbs sampling, enabling accurate parameter inference based on the chosen hyperparameter values.
In the parameter estimation process of the MSAR-TVP model using the Bayesian approach, several notations are introduced to systematically facilitate the explanation of the method. The notation represents the vector of observation data from time 1 to , where each is the observed value at time . This vector is written as . The notation denotes the state vector encompassing all regimes of the variable from time 1 to , where each indicates the state at time . This vector is expressed as . The notation represents the time-varying parameter vector that includes all parameters from time 1 to for . This vector is written as:
Each element in is associated with at time , and for each , there are two parameters corresponding to and .
The Gibbs sampling procedure for this model begins with initial parameter values chosen randomly within the domain. The key steps in this procedure are as follows:
- Conditional on the state vector , the model hyperparameters, and the observation data vector generate the time-varying parameter vector from:
- 2.
- Conditional on the time-varying parameter vector , the model hyperparameters, and the observation data vector , generate the state vector from:
- 3.
- Generate the transition probability parameters and , conditional on the state vector .
- 4.
- Generate the parameter , conditional on the time-varying parameter vector and the state vector .
- 5.
- Compute the parameters , conditional on the observation data and the parameters generated in the previous steps
A detailed explanation of each step will be discussed in the subsequent sections, including the methods used to generate each variable that satisfies the model’s conditional features within the Gibbs sampling process.
2.4.1. Generating Conditioned on , the Hyperparameter Model, and
The multi-move Gibbs sampling approach is utilized in this study to generate , as it offers higher computational efficiency and faster convergence. In the Bayesian framework, the model’s hyperparameters play a crucial role in shaping the prior distribution, which reflects the initial information before the observations are obtained. These hyperparameters provide additional flexibility in the sampling process by controlling the characteristics of the posterior distribution.
The posterior distribution in Equation (13) indicates that the entire vector can be generated by first generating from , and subsequently, for , generating from Since the MS(2)-AR(1)-TVP model is linear and Gaussian in each of its regimes, the distribution of conditioned on and , as well as the distribution of conditioned on , , and for , are also Gaussian distributions.
The steps for generating through Gibbs sampling are as follows:
- Execute the Kim filter algorithm to compute and for and store the results. The final iteration of the Kim filter provides and , which are then used to generate based on the following equation:
- 2.
- For given and , if elements of , previously generated, are treated as additional observation vectors in the system, the distribution can be derived by applying the Kalman filter update equations for as follows:where the update equations for and are given by:Thus, the parameter , , can be generated based on the following equation:
2.4.2. Generating Conditioned on , the Hyperparameter Model, and
Conditional on , the observational data does not provide direct information about or other parameters in the model, except for those contained in . This is primarily due to the independence between and . In other words, the measurement and parameter transition equations in this model form two independent equation sets because and are independent. Consequently, in the process of generating , attention is focused on the equations of the MS(2)-AR(1)-TVP model, which define an autoregressive model with mean, variance, and AR coefficients that switch according to Markov dynamics when or . At this stage, is treated as input data for the model.
Considering , which has been generated in the previous step as a single dataset, the problem of generating the state vector and unknown hyperparameters can be solved using the two sets of equations through Gibbs sampling. In this study, the multi-move Gibbs sampling approach is employed to generate . The posterior distribution in Equation (14) indicates that is first generated conditional on and , Subsequently, for , is generated conditional on , , and which have been previously generated.
Steps to generate using Gibbs sampling:
- Run the Hamilton filter to obtain for , and store the results. The final iteration of the filter provides the estimate , which is then used to generate .
- To generate conditional on and , for use the following expression:where is the transition probability, and is the result stored from Step 1. Using Equation (20), the generation of follows the same procedure as single-move Gibbs sampling. First, calculate follows the same process as in the case of single-move Gibbs sampling. First, calculate:and then, as in single-move Gibbs sampling, use a random number drawn from a uniform distribution to generate . For example, generate a random number from a uniform distribution between 1 and 2. If the random number is less than or equal to the value calculated from , set ; otherwise, set .
2.4.3. Generating Parameters and Conditional on
The parameters and , conditional on , are independent of the dataset and other model parameters.
- Prior:
Assuming independent priors from a beta distribution for and , the priors are defined as follows:
with the joint prior function:
where , , are the hyperparameters specified by the prior.
- Likelihood:
The likelihood for and , conditional on , is formulated as:
where is the number of transitions from state i to j, which can be computed from .
- Posterior:
By combining the prior distribution and the likelihood function, the posterior distribution for and is obtained as:
Substituting the prior and likelihood yields:
From this result, the posterior distribution is given by two independent beta distributions:
from which and are drawn.
2.4.4. Generating Conditional on and
Conditional on and , the parameter transition equation in Equation (9) is independent of other parts of the model, and the distribution of , where , is independent of the other parameters in the model as well as the data . Consequently, the focus can be restricted to Equation (9) by excluding other components of the model when generating conditional on and . As a result, this problem reduces to a univariate autoregressive case in each regime via Gibbs sampling.
- Prior:
The prior for is assumed to follow a normal distribution:
Here, is an indicator function ensuring that the roots of the polynomial lie outside the unit circle, where is the backshift operator, thus maintaining the stability of the AR model in each state .
The prior function can be written as:
- Likelihood:
The likelihood for , conditional on and , is expressed as:
- Posterior:
By combining the prior and likelihood, the posterior distribution for is given by:
The parameter is drawn from the normal posterior distribution without truncation. The posterior distribution for is given as:
where the posterior mean and variance are calculated as:
where is the design vector based on previous observations , specifically . In practice represents endogenous lag variables of , making its dimension consistent with in iterations .
2.4.5. Generating Conditional on and Other Model Parameters
The calculation of and is performed based on other parameters that have been previously obtained. The parameter represents a constant at time in the measurement equation, influenced by regime changes, and is calculated using the formula: . Subsequently, represents a constant at time in the parameter transition equation, also influenced by regime changes, and is calculated using the formula: . Meanwhile, represents the variance at time of , which is influenced by regime changes. The parameter represents the variance at time of which is similarly influenced by regime changes.
After generating samples for each parameter through Gibbs sampling, iterations are performed until convergence is achieved. This process yields samples from the posterior distribution of each parameter. The final parameter estimates of the model are obtained from the ergodic mean, which represents the average of the posterior distribution after convergence has been reached.
While previous studies have explored Bayesian approaches for MSAR models with constant parameters, this research is the first to develop a comprehensive Bayesian estimation framework for the MSAR model with time-varying parameters (MSAR-TVP). The novelty lies in the integration of Gibbs sampling with the Kim filter to estimate both the hidden regimes and the time-evolving parameters. This integrated approach enables more accurate posterior inference, especially under high structural complexity. Unlike classical estimation methods, which rely on point estimates and fixed parameters, our Bayesian algorithm flexibly captures uncertainty in both the states and parameters, thereby enhancing the model’s robustness for economic forecasting.
2.5. MSAR-TVP Forecasting Model
In this section, we explain the forecasting model for the MS(2)-AR(1)-TVP model, which is based on the MS(2)-AR(1)-TVP model as shown in Equations (8)–(10). In this model, the error terms in the measurement and transition equations are assumed to have zero expectation, and are uncorrelated both temporally and between states, with the assumption that and , and is uncorrelated both temporally and across states, so .
With this assumption, the forecast for horizon can be formulated as the following conditional expectation:
where represents the available data up to time , represents the state information at time , and is the vector of unknown parameters, as defined in Equation (11).
Based on the MS(2)-AR(1)-TVP model in Equations (8)–(10), the forecast is performed iteratively as follows:
where and , and the transition probability matrices remain consistent with those in Equation (10).
The concept of one-step ahead iteration is applied here, where forecasting is carried out by gradually updating predictions for each time step , using the estimates from the previous step as input for the next prediction. This method allows the model to continuously adjust predictions based on the most recent data available.
2.6. Evaluation Techniques
The mean absolute percentage error (MAPE) and mean absolute error (MAE) are widely used metrics for assessing the accuracy of forecasting models [29]. MAPE provides a measure of forecast accuracy expressed as a percentage, making it particularly useful for conveying model performance to non-technical audiences. On the other hand, MAE quantifies the average size of prediction errors, regardless of direction, reflecting the extent of deviation between observed and predicted values. Lower values of MAPE and MAE indicate better model performance and greater predictive accuracy. MAPE is especially valued for its clarity, ease of interpretation, and its ability to convey comprehensive error information [30].
The mathematical definitions of MAPE and MAE are as follows:
where represents the observed value at time , and represents the forecasted value. Lewis [31] suggests that a MAPE value below 10% is indicative of highly accurate forecasting, serving as a benchmark for evaluating the precision of forecasting models in industrial and business contexts.
3. Results
This section discusses the application of the MSAR-TVP model to the quarterly U.S. real GNP data. Two datasets are used in this study. The first dataset, denoted as , represents U.S. real GNP data from Q3 1952 to Q4 1986. For analysis purposes, is divided into in-sample data covering Q3 1952 to Q4 1984 (130 observations) and out-of-sample data spanning Q1 1985 to Q4 1986 (8 observations). This dataset was selected due to its use in previous studies, the development of the Classical MSAR model [3] and the Classical MSAR-TVP model [13], allowing for a direct performance comparison of the models in a forecasting context.
The second dataset, denoted as includes U.S. real GNP data from Q1 1947 to Q1 2024. Similarly to , is divided into in-sample data spanning Q1 1947 to Q1 2022 (301 observations) and out-of-sample data covering Q2 2022 to Q1 2024 (8 observations). This extended dataset, which also encompasses the data range of , was selected to evaluate the performance and robustness of the Bayesian MSAR-TVP model in handling longer and more complex time series.
A performance comparison of the Classical MSAR, Classical MSAR-TVP, and Bayesian MSAR-TVP models was conducted for both in-sample and out-of-sample data using MAPE and MAE as evaluation metrics. The best-performing model was then used to forecast the next two years of data, spanning from Q2 2024 to Q1 2026 (8 observations).
3.1. Bayesian MSAR-TVP Model
The initial step in this study involves testing for nonlinearity and structural changes in the data. As shown in Table 1, the results of the preliminary analysis indicate strong evidence of data nonlinearity in both datasets, as confirmed by the Teräsvirta test [32] with p-values < 0.05. Additionally, the Chow Test [33,34] identifies significant structural changes at certain periods, with p-values < 0.05, highlighting the presence of regime switching in the data. These combined findings strongly justify the application of MSAR and MSAR-TVP models for time series modeling. This study focuses on implementing the Bayesian MSAR-TVP model and evaluating its performance in comparison to other models, namely the Classical MSAR and Classical MSAR-TVP models, to explore regime dynamics in the datasets and demonstrate the advantages of the proposed approach.
Table 1.
Dataset testing results.
The modeling analysis began with tests for stationarity in variance and mean. Variance stationarity tests on both datasets were conducted using the Box–Cox transformation [35], yielding a parameter of , which indicates that a logarithmic transformation is required to achieve variance stationarity. The transformed data are denoted as and . Subsequently, the augmented Dickey–Fuller (ADF) test [36] was applied to assess mean stationarity for and , yielding p-values of 0.0895 and 0.9236, respectively, indicating that the time series remain non-stationary in their means. To address this issue, differencing was applied to the data. The final model analysis was conducted on the log-differenced data multiplied by 100, denoted as and . The data and are appropriately modeled using the MSAR-TVP model, as nonlinearity testing through the RESET test [37] yields a p-value of 0.03841 and less than , respectively, indicating nonlinear characteristics in the data. Additionally, the Bai–Perron test [38] detects structural changes in both datasets. In terms of implications, the log-difference transformation of and not only accurately represents economic growth rates but also facilitates the identification of economic cycle patterns involving regime-switching dynamics.
The trends depicted in Figure 1 illustrate cyclical changes in the U.S. economy, characterized by regime shifts between expansion and recession periods. It can be observed that the two datasets exhibit distinct characteristics. The first dataset, U.S. real GNP from Q3 1952 to Q4 1984, after being stationarized , displays relatively stable patterns with shorter cycle lengths. In contrast, the second dataset, U.S. real GNP from Q1 1947 to Q1 2022 , reveals significantly more complex patterns with longer and more intricate cycles.
Figure 1.
Time series plot of the stationarized U.S. real GNP: (a) 1952–1984; (b) 1947–2022.
The MSAR-TVP model is implemented with two regimes: Regime 1, representing an expansion state, and Regime 2, representing a recession state. Each regime is assumed to follow an AR(1) process, allowing the real GNP data to be modeled within the MS(2)-AR(1)-TVP framework. The Bayesian MSAR-TVP model proposed in this study estimates model parameters using a Bayesian MCMC approach integrated with the Kim filter.
In this research, conjugate prior distributions are used for each model parameter, as explained in Section 2.3. The selection of priors is based on the domain knowledge or results from classical estimations (pseudo-priors). These pseudo-priors help the parameters converge more quickly to the target posterior distribution, thus accelerating the convergence process in the Bayesian approach. The prior distributions in this study are designed to be moderately informative, striking a balance between prior knowledge and flexibility for data-driven learning. Conjugate priors are specified for the main parameters estimated in the Bayesian MSAR-TVP model—namely, —while other parameters, such as variance terms for (i.e., ), and regime-dependent components, are provided as initial values or derived internally from the Kalman filtering process.
These priors are constructed based on pseudo-prior principles, where prior values are informed by classical estimation results and refined through simulation to facilitate convergence. This design avoids overly tight constraints that may restrict the posterior, as well as excessively loose assumptions that would diminish parameter identifiability. The moderate informativeness of these priors enables the model to achieve robust posterior inference without overpowering the information from the data. The full specification of the prior distributions for both datasets is provided in Appendix A.
Table 2 presents a summary of the posterior parameter estimation results, including the mean and standard deviation for each parameter. The posterior mean represents the point estimates obtained, while the standard deviation reflects the level of uncertainty associated with the estimates. Consequently, the smaller the standard deviation, the higher the confidence in the parameter estimates at a given confidence level.
Table 2.
Summary of posterior parameters for the Bayesian MSAR-TVP model on U.S. real GNP.
Based on the estimated parameters, the MSAR-TVP model can be represented by the following equations to describe the behavior of variables in each regime:
- Mathematical Representation of the MSAR-TVP Model for :
For :
For :
The transition probability matrix obtained is:
- Mathematical Representation of the MSAR-TVP Model for :
For :
For :
The transition probability matrix obtained is:
The MSAR-TVP model was applied to two distinct datasets, namely the U.S. Real GNP spanning the periods 1954–1984 and 1947–2024, aiming to explore temporal patterns and regime transitions. The transition probability matrices for both datasets, as shown in Equation (46) for the 1952–1986 dataset and Equation (51) for the 1947–2022 dataset, indicate a strong tendency to remain in the same state, exceeding 96% for both periods. For the 1952–1986 dataset, the probabilities of staying in State 1 and State 2 are 99.15% and 96.03%, respectively. Similarly, for the 1947–2022 dataset, these probabilities are 97.33% and 99.61%, respectively. The probabilities of transitioning between states are very low, less than 4% in all cases. This reflects high stability within each regime, with infrequent transitions between regimes, highlighting the MSAR-TVP model’s ability to capture stable and consistent temporal patterns.
The estimation results reveal that the model parameters, including the time-varying parameters and , as well as the other parameters , and , exhibit significant fluctuations across both datasets. For the 1952–1984 dataset (Figure 2 and Figure 3), reflects temporal dynamics, adjusting within the range of 0.15 to 0.25 in Regime 1, while in Regime 2 demonstrates higher sensitivity to structural changes. Other parameters, such as , and , stabilize after an initial period of fluctuation, reflecting the adaptation process of the average behavior of variables within each regime. In the 1947–2022 dataset (Figure 4 and Figure 5), remains relatively stable, fluctuating between −0.15 and 0 across most of the period in Regime 1. On the other hand, displays a more volatile pattern over the same range, indicating heightened sensitivity to structural dynamics in Regime 2. As in the earlier dataset, parameters like , and , exhibit stabilization patterns after an initial period of fluctuation, reflecting the adaptation process of the average behavior of variables within each regime. In both datasets, and , which represent the constants in the measurement equations for each regime, demonstrate stability after initial fluctuations. Conversely, the parameters and , representing the constants in the transition equations, show smaller fluctuations but remain dynamic.
Figure 2.
Time-varying parameters of the Bayesian MSAR-TVP model (1952–1984): (a) , (b) .

Figure 3.
Parameter values across different time points of the Bayesian MSAR-TVP Model (1952–1984): (a) , (b) , (c) , (d) .
Figure 4.
Time-varying parameters of the Bayesian MSAR-TVP Model (1947–2022): (a) , (b) .

Figure 5.
Parameter values across different time points of the Bayesian MSAR-TVP Model (1947–2022): (a) , (b) , (c) , (d) .
The Bayesian MSAR-TVP model demonstrated convergence for both datasets, with parameter estimates stabilizing during Gibbs sampling. For the 1952–1984 dataset, the maximum log-likelihood value was −203.359, while for the 1947–2022 dataset, it was −396.7628, indicating reliable and stable estimates. Convergence was verified through diagnostic checks, including trace plots and autocorrelation function (ACF) plots, which are presented in Appendix B. The trace plots for both datasets reveal that the parameter estimates reached steady-state conditions after sufficient burn-in periods, with 4025 iterations for Dataset 1 (out of 10,000 iterations) and 2581 iterations for Dataset 2 (out of 5000 iterations). The ACF plots further confirmed the robustness of the posterior samples, showing that only lag-0 exhibited significant correlation, indicating that the posterior samples met the independence criterion. These diagnostic tools ensure that the MCMC process has fully converged, validating the stability and accuracy of the model’s parameter estimates and providing confidence in the results.
3.2. Model Comparison
In this study, model performance was compared using MAPE and MAE for three models: Classical MSAR, Classical MSAR-TVP, and Bayesian MSAR-TVP. This approach aims to evaluate the predictive accuracy of the models across two distinct datasets (Dataset 1: 1952–1986 and Dataset 2: 1947–2024) for both in-sample and out-of-sample data. The results of the analysis are summarized in Table 3.
Table 3.
Comparison of MAPE and MAE for Classical MSAR, Classical MSAR-TVP, and Bayesian MSAR-TVP models on U.S. real GNP data.
The analysis presented in Table 3 highlights key findings regarding the performance of the Classical MSAR, Classical MSAR-TVP, Bayesian MSAR-TVP, and Bayesian AR-TVP models in forecasting datasets with different characteristics. For Dataset 1 (U.S. real GNP 1952–1986), the results reveal that the Classical MSAR-TVP model delivers the best performance for both in-sample and out-of-sample data. Specifically, for in-sample data, the Classical MSAR-TVP achieves a MAPE of 1.76% and an MAE of 42.7753, outperforming both the Bayesian MSAR-TVP (MAPE: 2.78%, MAE: 55.6518), the Classical MSAR (MAPE: 3.30%, MAE: 62.4868), and the Bayesian AR-TVP (MAPE: 3.55%, MAE: 84.2860). For out-of-sample data, the Classical MSAR-TVP model continues to excel, with a MAPE of 1.88% and an MAE of 69.3366, surpassing the Bayesian MSAR-TVP (MAPE: 3.62%, MAE: 131.8436), the Classical MSAR (MAPE: 4.33%, MAE: 159.2326), and the Bayesian AR-TVP (MAPE: 6.73%, MAE: 244.9528). These findings underscore that the Classical MSAR-TVP model is more effective at handling datasets with lower levels of complexity, yielding highly accurate and consistent predictions for both in-sample and out-of-sample data.
Conversely, for Dataset 2 (U.S. real GNP 1947–2024), which is more complex, the Bayesian MSAR-TVP model demonstrates significant superiority, particularly in out-of-sample data. The Bayesian MSAR-TVP achieves the best results with a MAPE of 6.56% and an MAE of 3499.565, substantially lower than the Classical MSAR-TVP (MAPE: 23.89%, MAE: 5347.443), the Bayesian AR-TVP (MAPE: 23.51%, MAE: 5263.634). and the Classical MSAR (MAPE: 24.24%, MAE: 5347.443). Although the Classical MSAR-TVP still outperforms in in-sample data with a MAPE of 4.96% and an MAE of 685.1016, compared to the Bayesian MSAR-TVP (MAPE: 5.48%, MAE: 740.1583), the Bayesian AR-TVP (MAPE: 6.33%, MAE: 868.7970), and the Classical MSAR (MAPE: 6.96%, MAE: 843.3941). The Bayesian MSAR-TVP model demonstrates superior performance in out-of-sample data. This highlights its effectiveness in handling long and complex datasets. This conclusion emphasizes the importance of selecting estimation methods that align with the dataset’s characteristics to achieve accurate and reliable predictions.
To further evaluate predictive performance, additional analysis was conducted by assessing model accuracy across multiple forecast horizons (from horizon 1 to horizon 8) with a fixed origin using one-step-ahead iteration. The results are summarized in Table 4 and Table 5. In these tables, each row represents one-step-ahead forecasts, where the previous prediction is used as the origin to make the forecast for the next time step.
Table 4.
Comparison of out-of-Sample model performance for U.S. real GNP (1985–1986).
Table 5.
Comparison of out-of-sample model performance for U.S. real GNP (2022–2024).
Table 4 presents the comparison of model performance for U.S. real GNP from Q1 1985 to Q4 1986. The Classical MSAR-TVP model consistently shows lower MAPE and MAE values compared to the other models across all quarters. While the Bayesian MSAR-TVP and Bayesian AR-TVP models perform adequately, the Classical MSAR-TVP remains the most reliable for short-term forecasting, demonstrating superior accuracy in capturing short-term fluctuations in U.S. real GNP data.
Table 5 compares the same models over a longer and more complex period, from Q2 2022 to Q1 2024. In the early quarters (Q2 2022 to Q1 2023), the Classical MSAR model slightly outperforms the Classical MSAR-TVP model in both MAPE and MAE, indicating better short-term accuracy. However, starting from Q2 2023, the Classical MSAR-TVP model gradually improves and eventually outperforms the Classical MSAR model in the later quarters, reflecting its superior adaptability to structural shifts in the data.
The Bayesian AR-TVP model outperforms both the Classical MSAR and Classical MSAR-TVP models in every quarter, though it still lags behind the Bayesian MSAR-TVP. Most notably, the Bayesian MSAR-TVP model outperforms all three other models throughout the period, with significantly lower MAPE and MAE values compared to the Classical MSAR-TVP, Classical MSAR, and Bayesian AR-TVP models. This highlights the strength of the Bayesian MSAR-TVP model in providing more accurate and stable forecasts, especially when handling longer and structurally complex datasets.
These results emphasize that the Bayesian MSAR-TVP model consistently achieves the best forecasting accuracy, offering significant advantages in capturing uncertainty and dynamic behavior in economic time series.
These findings are further supported by the visual analysis in Figure 6 and Figure 7, which illustrate the forecast trajectories for each model against actual observations. Based on the analysis presented in Figure 6 and Figure 7, a comparison is made between in-sample and out-of-sample forecasts of the Classical MSAR, Classical MSAR-TVP, Bayesian MSAR-TVP, and Bayesian AR-TVP models across two U.S. real GNP datasets. For Dataset 1 (1952–1986) (Figure 6), the Classical MSAR-TVP model exhibits the best performance in capturing historical data patterns, both in-sample and out-of-sample. This is evident from predictions that closely align with the actual data, reflecting the model’s superiority in identifying stable trends and relatively simple economic patterns during this period.
Figure 6.
Comparison of actual data, in-sample forecasts, and out-of-sample forecasts for Classical MSAR, Classical MSAR-TVP, Bayesian MSAR-TVP, and Bayesian AR-TVP models on U.S. real GNP (1952–1986).
Figure 7.
Comparison of actual data, in-sample forecasts, and out-of-sample forecasts for Classical MSAR, Classical MSAR-TVP, Bayesian MSAR-TVP, and Bayesian AR-TVP models on U.S. real GNP (1947–2024).
Conversely, for Dataset 2 (1947–2024) (Figure 7), which spans a longer and more complex period, the Bayesian MSAR-TVP model demonstrates superior performance, particularly in the out-of-sample forecast. This model more accurately tracks historical trends and captures the upward movements in economic activity. Its flexibility also allows it to better accommodate structural changes and uncertainties present in the data. Although the Classical MSAR-TVP model still performs reasonably well in-sample data, its predictive ability declines significantly out-of-sample compared to the Bayesian approach—especially when dealing with complex and volatile time periods.
Overall, the results illustrated in both figures support the earlier quantitative analysis, indicating that the Classical MSAR-TVP model performs better for data with stable trends, while the Bayesian MSAR-TVP model is more suited for complex and long-term datasets. This highlights that selecting the appropriate model heavily depends on the complexity level of the dataset, with the Bayesian model offering greater flexibility and accuracy under challenging data conditions.
To provide further statistical support for the model comparison, we conducted significance tests on the distribution of absolute percentage error (APE) between the Classical and Bayesian MSAR-TVP models. Based on the Kolmogorov–Smirnov (KS) test [39], we applied independent t-tests [40] for normally distributed data and Mann–Whitney U tests [41] for non-normal cases. For comparisons using t-tests, the Levene’s test [42] was employed to assess the homogeneity of variances and determine whether equal or unequal variance assumptions were appropriate. The results, presented in Table 6, show statistically significant differences in APE distributions—both in-sample and out-of-sample—particularly favoring the Bayesian approach on the more complex dataset (Dataset 2). These findings reinforce the robustness and predictive reliability of the Bayesian model in handling nonlinear and structurally complex time series data.
Table 6.
Results of APE difference tests between Classical and Bayesian MSAR-TVP models.
The results in Table 6 confirm that there are statistically significant differences in the APE distributions between the Classical and Bayesian MSAR-TVP models. For Dataset 1 (1952–1986), both in-sample and out-of-sample comparisons using t-tests show significant differences in prediction error patterns. In Dataset 2 (1947–2024), which reflects more complex and volatile data, the Mann–Whitney test (in-sample) and t-test (out-of-sample) also reveal significant differences. These results support the conclusion that the Bayesian model provides more accurate and stable forecasts, particularly in challenging and complex data environments.
In addition to significance testing, we further examined the predictive behavior using the distribution of APE. The lower APE standard deviation also signifies the best performance, as it reflects greater predictive consistency and accuracy. As shown in Table 7 and visualized in the corresponding boxplots (Figure 8 and Figure 9), the Bayesian approach produced a more concentrated APE distribution with fewer outliers. This indicates enhanced prediction stability, particularly in out-of-sample scenarios, and further supports the model’s effectiveness in managing complex economic data.
Table 7.
Comparison of APE standard deviations for Classical MSAR-TVP and Bayesian MSAR-TVP models.
Figure 8.
Box plot of APE for U.S. real GNP (1952–1986) comparing Classical MSAR-TVP and Bayesian MSAR-TVP models: (a) in-sample; (b) out-of-sample.
Figure 9.
Box plot of APE for U.S. real GNP (1947–2024) comparing Classical MSAR-TVP and Bayesian MSAR-TVP models: (a) in-sample; (b) out-of-sample.
Based on the results in Table 7, in Dataset 1 (1952–1986), the Classical MSAR-TVP model exhibited a lower APE standard deviation for in-sample data (0.947471 compared to 1.956111 for the Bayesian approach), indicating better predictive consistency for simpler data. However, for out-of-sample data, the Bayesian approach demonstrated superior stability with a lower APE standard deviation (0.850760 compared to 1.165966 for the classical approach), while maintaining greater predictive flexibility.
Conversely, in Dataset 2 (1947–2024), the Bayesian model excelled in predictive stability for both in-sample and out-of-sample data. The Bayesian approach exhibited a lower APE standard deviation for in-sample data (3.012078 compared to 4.904877 for the classical approach). However, for out-of-sample data, the classical approach demonstrated a smaller standard deviation (0.238539 compared to 1.672326 for Bayesian). Nevertheless, the Bayesian model’s predictive accuracy remained superior, with a smaller MAPE, making it a more effective approach for handling complex data.
The boxplots in Figure 8 and Figure 9 support these findings. For Dataset 1, the classical model demonstrated a narrower and more concentrated APE distribution for in-sample data, while the Bayesian approach exhibited higher predictive flexibility but with greater variability. Conversely, in Dataset 2, the Bayesian model produced a narrower APE distribution for both in-sample and out-of-sample data, emphasizing its superior predictive stability when dealing with highly complex datasets.
Overall, these findings affirm that the MSAR-TVP model, whether utilizing the classical or Bayesian approach, outperforms the Classical MSAR model in applications involving U.S. real GNP data. The Bayesian MSAR-TVP model demonstrates significant advantages in handling complex datasets, delivering more stable predictions with lower errors for out-of-sample data. Conversely, the Classical MSAR-TVP model is better suited for simpler datasets, emphasizing consistency in predictions. The choice of approach should consider the level of data complexity to ensure optimal performance across various analytical contexts.
3.3. Forecasting Using the Bayesian MSAR-TVP Model
This analysis employs the Bayesian MSAR-TVP model to monitor economic processes and forecast the next two years using U.S. real GNP data from 1947 to 2024. This model was selected due to its superior performance, particularly in handling complex datasets, as described in previous sections.
In Figure 10, the filtered probability plots illustrate the state transition patterns representing phases of economic expansion (State 1) and recession (State 2) in the U.S. during the analysis period. High probabilities in State 1 depict the dominance of expansionary conditions, while spikes in State 2 probabilities indicate periods of recession. The model consistently detects major economic events, such as the early 1980s recession, where the probability of a recession peaked between Q4 1981 and Q1 1982, reflecting the Federal Reserve’s tight monetary policies aimed at curbing high inflation [43]. The early 1990s recession is also captured by the model, with a recession probability of 0.766 in Q2 1990, driven by rising oil prices following Iraq’s invasion of Kuwait and the lingering effects of earlier monetary policies [44]. In 2001, the probability of recession spiked to 0.7, reflecting the bursting of the dot-com bubble, which triggered an official recession from March to November 2001 [43]. Furthermore, the 2008 global financial crisis was detected, with recession probabilities peaking in Q4 2008, highlighting the impact of the housing market collapse and subprime mortgage crisis [45]. The COVID-19 pandemic period in 2020 was also effectively identified, with recession probabilities nearing their maximum during Q2 and Q3 2020, capturing the economic contraction caused by global lockdown policies [46].
Figure 10.
Filtered probability of U.S. real GNP Bayesian MSAR-TVP model (1947–2022).
These results confirm the Bayesian approach’s ability to detect the dynamics of economic structures, providing deep insights into business cycles and capturing significant changes in economic conditions.
The plot in Figure 11 presents a comparison between actual data and the forecasting results of the Bayesian MSAR-TVP model for U.S. real GNP over the 1947–2024 period. This plot illustrates the model’s performance in predicting economic trends during the in-sample and out-of-sample periods, as well as its projections for the future. The analysis reveals that the Bayesian MSAR-TVP model consistently tracks historical data patterns and reflects economic growth trends that align with the dynamics of the actual data. The model effectively captures key patterns during the in-sample period, producing forecasts that closely match the observed data. During the out-of-sample period, the Bayesian MSAR-TVP model maintains good accuracy, with only minor discrepancies that may reflect variations or uncertainties inherent in economic data. Additionally, the model’s future projections align with reasonable growth patterns, highlighting its capability to project long-term trends based on the historical data structure. Notably, the forecasts for the next two years suggest that the U.S. economy is likely to remain in an expansionary regime.
Figure 11.
Comparison plot of actual data, in-sample, out-of-sample, and future forecasts using the Bayesian MSAR-TVP model for U.S. real GNP (1947–2026).
Table 8 provides details on the average run length (ARL) as well as the maximum and minimum run lengths for each state in the economic regime analysis using the Bayesian approach. Based on this table, State 1 (expansion) recorded an ARL of 36.13 quarters, indicating that expansion periods generally last longer than recessions. Conversely, State 2 (recession) had an ARL of 1.25 quarters. The maximum run length for expansion reached 131 quarters, whereas for recession, it was 2 quarters. The minimum run length for both states was 1 quarter, indicating the possibility of rapid regime shifts. Additionally, the equal number of runs—namely, 8 for both states—suggests that although expansion phases are longer, recessions occur with the same frequency. This highlights the need to consider recessions carefully in economic planning and business strategy development.
Table 8.
Run length and ARL of the Bayesian MSAR-TVP model for U.S. real GNP (1947–2022).
4. Discussion and Future Research Directions
This study developed a novel estimation method for the MSAR-TVP model using a Bayesian approach, hereafter referred to as Bayesian MSAR-TVP. This approach was designed to address the limitations of the Classical MSAR-TVP model, particularly in handling datasets with high complexity and dynamic structural changes. By integrating regime-switching capabilities with time-varying parameters, the model effectively captures the intricate dynamics inherent in economic data. Additionally, the new Bayesian AR-TVP model is also designed to capture structural changes over time.
The superiority of the Bayesian MSAR-TVP model over the Classical MSAR model is evident from the analysis of U.S. real GNP data. For datasets with relatively simple patterns (1952–1986), the Classical MSAR-TVP approach delivered the best performance, achieving high in-sample and out-of-sample prediction accuracy. However, for more complex datasets (1947–2024), the Bayesian MSAR-TVP approach demonstrated significant advantages, particularly in out-of-sample forecasting. With a MAPE of 6.56%, the Bayesian approach not only provided highly accurate predictions but also effectively captured the complex dynamics of regime changes. In comparison, the Bayesian AR-TVP model also effectively captured volatility and dynamic variations, though its predictive accuracy remained slightly lower than that of the Bayesian MSAR-TVP, especially during prolonged periods of instability.
Furthermore, the filtered probability analysis from the Bayesian MSAR-TVP model in this study confirmed the model’s effectiveness in detecting major economic events, such as the early 1980s recession, the 1990 recession, the dot-com bubble (2001), the 2008 global financial crisis, and the COVID-19 pandemic in 2020. These results demonstrate that the Bayesian approach is not only accurate in forecasting but also flexible in capturing transitions between expansion and recession phases in economic cycles. It also offers deep insights into the historical structure of the data, supporting data-driven decision-making in the field of economics.
Although the Bayesian MSAR-TVP model has demonstrated clear advantages, several limitations remain that could serve as a focus for future research. One primary limitation is the assumption that each regime follows an AR(1) process. Future studies could consider increasing the AR order to capture more complex economic patterns, especially in datasets with longer lag structures. Additionally, developing models with more than two regimes would provide greater flexibility, enabling the identification of more diverse economic phases, such as periods of moderate growth or sharp contraction. Another potential improvement is the incorporation of exogenous explanatory variables, such as interest rates, inflation, and unemployment, to enhance the model’s ability to capture external economic dynamics and improve forecasting accuracy. This is important to consider because, although the MAPE values remain under 10%, the forecast patterns do not perfectly align with the actual data, indicating that the model does not fully capture every aspect of the underlying dynamics. This misalignment may occur due to the occurrence of extreme events, which can lead to outliers. The model may struggle to account for such unpredictable shifts, and incorporating external variables could help capture these factors and improve forecast accuracy.
Another limitation lies in the assumption of Gaussian-distributed residuals, which may restrict the model’s applicability to datasets with outliers or asymmetric distributions. Hence, approaches that incorporate non-Gaussian residual distributions [47,48,49] are expected to improve the model’s robustness under extreme data conditions. Furthermore, exploring more general transition frameworks, such as pairwise Markov models (PMMs) [50,51,52,53] or other state-space models, could provide additional flexibility for handling more intricate regime dynamics.
The application of the Bayesian MSAR-TVP model in this study is limited to economic data, specifically U.S. real GNP. Future research could expand its applicability to diverse domains, including climate modeling, financial markets, demographic studies, commodity pricing, exchange rate dynamics, meteorology, population trends, and healthcare analytics, such as brain electroencephalography (EEG) signals. Extending its use across these fields could significantly advance predictive methodologies, reinforcing Bayesian MSAR-TVP as a powerful and versatile tool in data analysis.
In summary, this study paves the way for further advancements in nonlinear time series modeling. By addressing the current limitations, the Bayesian MSAR-TVP model could evolve into a more comprehensive approach, applicable not only to economic forecasting but also to a wide range of data-driven applications in the future. This is expected to spark further discussion among researchers about the potential of this model to tackle increasingly complex data analysis challenges.
In addition to its methodological contributions, the Bayesian MSAR-TVP model holds practical relevance for economic policy and planning. Its ability to detect structural regime shifts—such as recessions and expansions—with high accuracy can support the development of early warning systems and inform timely fiscal or monetary interventions. By providing quantitative insights into economic stability and volatility, the model offers a valuable tool for decision-makers in managing macroeconomic risks and anticipating future economic conditions.
5. Conclusions
This study successfully developed the Bayesian Markov switching autoregressive model with time-varying parameters (MSAR-TVP) as a superior approach for analyzing nonlinear time series with structural changes. Empirical evaluation using U.S. real GNP data demonstrated that the Classical MSAR-TVP model performed optimally on simpler datasets (1952–1986), achieving a MAPE of 1.76% and MAE of 42.7753 for in-sample data, and a MAPE of 1.88% and MAE of 69.3366 for out-of-sample data. In contrast, when applied to a more complex dataset (1947–2024), the Bayesian MSAR-TVP model demonstrated significant advantages, especially in out-of-sample forecasting, with a MAPE of 6.56% and MAE of 3499.565. These results highlight the effectiveness of the Bayesian approach in handling dynamic, long-horizon economic data with structural breaks.
Beyond forecasting accuracy, the Bayesian MSAR-TVP model effectively identified key regime transitions between economic regimes, including key recessionary periods such as the early 1980s, the early 1990s, the 2001 dot-com bubble burst, the 2008 global financial crisis, and the COVID-19 pandemic. Filtered probability analysis confirmed the model’s capacity to produce realistic regimes estimates, with a high probability of persistence within a regime (>96%) and relatively low probability of regime switching (<4%). These findings offer valuable insights for understanding macroeconomic dynamics and support evidence-based strategic planning.
Furthermore, the Bayesian AR-TVP model, introduced in this study, provides additional flexibility by modeling time-varying volatility, making it particularly useful during volatile periods. While its overall predictive accuracy is slightly lower than that of the Bayesian MSAR-TVP, it complements the latter by better representing short-term instability and dynamic volatility patterns.
Given its high forecasting precision, flexibility, and capability to accommodate complex time-dependent structures, the MSAR-TVP model—particularly its Bayesian implementation—presents substantial potential as a reliable tool for economic analysis and forecasting. Projections for the upcoming two years indicate continued expansionary conditions in the U.S. economy. Furthermore, the methodology can be extended to various domains, offering broader applicability for dynamic modeling and data-informed decision-making.
Author Contributions
Conceptualization, S.I.; methodology, S.I. and N.I.; software, S.I.; validation, S.I., N.I., I. and U.I.; formal analysis, S.I. and N.I.; investigation, S.I.; resources, S.I.; writing—original draft preparation, S.I.; writing—review and editing, N.I., I. and U.I.; visualization, S.I.; supervision, N.I. and I.; project administration, S.I.; funding acquisition, N.I. and S.I. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Data Availability Statement
The data for real GNP used in this research were sourced from the Business Conditions Digest of February and March 1986. Access to the data is available at: https://fraser.stlouisfed.org/title/business-conditions-digest-43?browse=1980s#7474 (accessed on 31 May 2023). The extended dataset, covering 1 January 1947 to 1 January 2024, is publicly available from the Federal Reserve Economic Data (FRED), supplied by the St. Louis Fed, at https://fred.stlouisfed.org/series/GNPC96 (accessed on 31 March 2024).
Acknowledgments
The author expresses sincere appreciation to the Center for Higher Education Funding and Assessment (PPAPT) and the Indonesia Endowment Fund for Education (LPDP) for the doctoral scholarship support that contributed to the completion of the Ph.D. study forming the basis of this research. Deep gratitude is also extended to the Department of Statistics, Faculty of Science and Data Analytics, Institut Teknologi Sepuluh Nopember (ITS), for academic guidance and collaboration during the research process, and to the Department of Statistics, Faculty of Mathematics and Natural Sciences, Universitas Negeri Yogyakarta (UNY), for continuous institutional support and encouragement throughout the completion and publication of this study.
Conflicts of Interest
The authors declare no conflicts of interest.
Appendix A
Table A1.
Priors of parameters on the Bayesian MSAR-TVP model.
Table A1.
Priors of parameters on the Bayesian MSAR-TVP model.
| Dataset 1 (U.S. Real GNP 1952–1984) | Dataset 2 (U.S. Real GNP 1947–2022) |
|---|---|
Appendix B
Appendix B.1
Figure A1 and Figure A2 shows the history plot of the Bayesian MSAR-TVP model parameters for U.S. real GNP from 1952 to 1984.
Figure A1.
Trace plot of the Bayesian MSAR-TVP model for U.S. real GNP (1952–1984).
Figure A1.
Trace plot of the Bayesian MSAR-TVP model for U.S. real GNP (1952–1984).

Figure A2.
ACF plot of the Bayesian MSAR-TVP model for U.S. real GNP (1952–1984).
Figure A2.
ACF plot of the Bayesian MSAR-TVP model for U.S. real GNP (1952–1984).

Appendix B.2
Figure A3 and Figure A4 shows the history plot of the Bayesian MSAR-TVP model parameters for U.S. real GNP from 1947 to 2022.
Figure A3.
Trace plot of the Bayesian MSAR-TVP model for U.S. real GNP (1947–2022).
Figure A3.
Trace plot of the Bayesian MSAR-TVP model for U.S. real GNP (1947–2022).

Figure A4.
ACF plot of the Bayesian MSAR-TVP model for U.S. real GNP (1947–2022).
Figure A4.
ACF plot of the Bayesian MSAR-TVP model for U.S. real GNP (1947–2022).

References
- Meyler, A.; Kenny, G.; Quinn, T. Forecasting Irish Inflation Using ARIMA Models. Econ. Anal. Res. Publ. Dep. Cent. Bank Irel. 1998, 1998, 1–48. [Google Scholar]
- Tzagkarakis, G.; Dionysopoulos, T.; Achim, A. Recurrence Quantification Analysis of Denoised Index Returns via Alpha-Stable Modeling of Wavelet Coefficients: Detecting Switching Volatility Regimes. Stud. Nonlinear Dyn. Econom. 2016, 20, 75–96. [Google Scholar] [CrossRef]
- Hamilton, J.D. A New Approach to the Economic Analysis of Nonstationary Time Series and the Business Cycle. Econometrica 1989, 57, 357–384. [Google Scholar] [CrossRef]
- Adejumo, O.A.; Albert, S.; Asemota, O.J. Markov Regime-Switching Autoregressive Model of Stock Market Returns in Nigeria. CBN J. Appl. Stat. 2020, 11, 65–83. [Google Scholar] [CrossRef] [PubMed][Green Version]
- Stillwagon, J.; Sullivan, P. Markov Switching in Exchange Rate Models: Will More Regimes Help? Empir. Econ. 2020, 59, 413–436. [Google Scholar] [CrossRef]
- Lukianenko, I.; Nasachenko, M. Inflation Expectations Modeling: The Application of Markov Switching Autoregression. Sci. Pap. Nauk. Econ. 2020, 5, 82–88. [Google Scholar] [CrossRef]
- Zhang, X.; Liu, P.; Cheng, L.; Zhou, L.; Liu, W.; Luo, X. Time-Varying Parameters from the Same Period in Previous Years to Improve Runoff Forecasting. J. Hydrol. 2024, 631, 130685. [Google Scholar] [CrossRef]
- Zivot, E.; Wang, J. Modeling Financial Time Series with S_PLUS®, 2nd ed.; Springer: New York, NY, USA, 2006. [Google Scholar]
- Doornik, J.A. A Markov-Switching Model with Component Structure for US GNP. Econ. Lett. 2013, 118, 265–268. [Google Scholar] [CrossRef]
- Pok-sang, L. The Hamilton Model with a General Autoregressive Component: Estimation and Comparison with Other Models of Economic Time Series. J. Monet. Econ. 1990, 26, 409–432. [Google Scholar] [CrossRef]
- Kim, C.J. Dynamic Linear Models with Markov-Switching. J. Econom. 1994, 60, 1–22. [Google Scholar] [CrossRef]
- Cai, Y. A Quantile Approach to US GNP. Econ. Model. 2007, 24, 969–979. [Google Scholar] [CrossRef]
- Inayati, S.; Iriawan, N.; Irhamah, A. Markov Switching Autoregressive Model with Time-Varying Parameters. Forecasting 2024, 6, 568–590. [Google Scholar] [CrossRef]
- Kim, C.J.; Nelson, C.R. State-Space Models with Regime Switching: Classical and Gibbs-Sampling Approaches with Applications; The MIT Press: Cambridge, MA, USA, 2000. [Google Scholar]
- Geman, S.; Geman, D. Stochastic Relaxation, Gibbs Distributions, and the Bayesian Restoration of Images. IEEE Trans. Pattern Anal. Mach. Intell. 1984, 6, 721–741. [Google Scholar] [CrossRef] [PubMed]
- Kim, C.J.; Nelson, C.R. Has the U.S. Economy Become More Stable? A Bayesian Approach Based on a Markov-Switching Model of the Business Cycle. Rev. Econ. Stat. 1999, 81, 608–616. [Google Scholar] [CrossRef]
- Kim, C.J.; Nelson, C.R. A Bayesian Approach to Testing for Markov-Switching in Univariate and Dynamic Factor Models. Int. Econ. Rev. 2001, 42, 989–1013. [Google Scholar] [CrossRef]
- Kaufmann, S. Measuring Business Cycles with a Dynamic Markov Switching Factor Model: An Assessment Using Bayesian Simulation Methods. Econom. J. 2000, 3, 39–65. [Google Scholar] [CrossRef]
- Hartmann, A.; Vinga, S.; Lemos, J.M. Online Bayesian Time-Varying Parameter Estimation of HIV-1 Time-Series. IFAC Proc. Vol. 2012, 45, 1294–1299. [Google Scholar] [CrossRef]
- Yümlü, M.S.; Gürgen, F.S.; Cemgil, A.T.; Okay, N. Bayesian Changepoint and Time-Varying Parameter Learning in Regime Switching Volatility Models. Digit. Signal Process. 2015, 40, 198–212. [Google Scholar] [CrossRef]
- Rajan, J.J.; Rayner, P.J.W. Parameter Estimation of Time-Varying Autoregressive Models Using the Gibbs Sampler. Electron. Lett. 1995, 31, 1035–1036. [Google Scholar] [CrossRef]
- Tanizaki, H. The Time-Varying Parameter Model Revisited. Kobe Univ. Econ. Rev. 1999, 45, 41–57. [Google Scholar]
- Gelman, A.; Carlin, J.B.; Stern, H.S.; Rubin, D.B. Bayesian Data Analysis, 2nd ed.; Chapman & Hall/CRC: London, UK, 2004. [Google Scholar]
- Box, G.E.P.; Tiao, G.C. Bayesian Inference in Statistical Analysis; Addison-Wesley Publishing Company, Inc.: Boston, MA, USA, 1973. [Google Scholar]
- Carlin, B.P.; Chib, S. Bayesian Model Choice via Markov Chain Monte Carlo Methods. J. R. Stat. Soc. Ser. B 1995, 57, 473–484. [Google Scholar] [CrossRef]
- Ntzoufras, I. Bayesian Modeling Using WinBUGS; John Wiley & Sons: Hoboken, NJ, USA, 2009; ISBN 9780470141144. [Google Scholar]
- Vasishth, S. Additional Notes on MCMC Sampling. 2020. Available online: https://vasishth.github.io/IntroductionBDA/slides/02MCMCAdditionalNotes.pdf (accessed on 3 July 2023).
- Casella, G.; George, E.I. Explaining the Gibbs Sampler. Am. Stat. 1992, 46, 167–174. [Google Scholar] [CrossRef]
- Vega, R.; Flores, L.; Greiner, R. SIMLR: Machine Learning inside the SIR Model for COVID-19 Forecasting. Forecasting 2022, 4, 72–94. [Google Scholar] [CrossRef]
- Montaño Moreno, J.J.; Palmer Pol, A.; Sesé Abad, A.; Cajal Blasco, B. Using the R-MAPE Index as a Resistant Measure of Forecast Accuracy. Psicothema 2013, 25, 500–506. [Google Scholar] [CrossRef] [PubMed]
- Lewis, C.D. Industrial and Business Forecasting Methods: A Practical Guide to Exponential Smoothing and Curve Fitting; Heinemann: Penang, Malaysia, 1982. [Google Scholar]
- Teräsvirta, T.; Lin, C.F.; Granger, C.W.J. Power of the Neural Network Linearity Test. J. Time Ser. Anal. 1993, 14, 209–220. [Google Scholar] [CrossRef]
- Chow, G.C. Tests of Equality Between Sets of Coefficients in Two Linear Regressions. Econometrica 1960, 28, 591–605. [Google Scholar] [CrossRef]
- Zeileis, A.; Leisch, F.; Homik, K.; Kleiber, C. Strucchange: An R Package for Testing for Structural Change. J. Stat. Softw. 2002, 7, 1–38. [Google Scholar] [CrossRef]
- Box, G.E.P.; Cox, D.R. An Analysis of Transformations. J. R. Stat. Soc. Ser. B 1964, 26, 211–252. [Google Scholar] [CrossRef]
- Gujarati, D.N.; Porter, D.C. Basic Econometrics, 5th ed.; McGraw-Hill: New York, NY, USA, 2012. [Google Scholar]
- Ramsey, J.B. Tests for Specification Errors in Classical Linear Least-Squares Regression Analysis. J. R. Stat. Soc. Ser. B Stat. Methodol. 1969, 31, 350–371. [Google Scholar] [CrossRef]
- Bai, J.; Perron, P. Computation and Analysis of Multiple Structural Change Models. J. Appl. Econom. 2003, 18, 1–22. [Google Scholar] [CrossRef]
- Daniel, W.W. Applied Nonparametric Statistics, 2nd ed.; PWS-Kent: Boston, MA, USA, 2000. [Google Scholar]
- Lu, Z.L.; Yuan, K.-H. Welch’s t Test. In Encyclopedia of Research Design; Salkind, N.J., Ed.; Sage Publications: Thousand Oaks, CA, USA, 2010; pp. 1620–1623. [Google Scholar]
- Corder, G.W.; Foreman, D.I. Nonparametric Statistics: A Step-by-Step Approach, 2nd ed.; John Wiley & Sons: Hoboken, NJ, USA, 2014; ISBN 9788578110796. [Google Scholar]
- Levene, H. Robust Tests for Equality of Variances. In Contributions to Probability and Statistics; Olkin, I., Ed.; Stanford University Press: Palo Alto, CA, USA, 1960; pp. 278–292. [Google Scholar]
- National Bureau of Economic Research (NBER). U.S. Business Cycle Expansions and Contractions. Available online: https://www.nber.org/research/data/us-business-cycle-expansions-and-contractions (accessed on 3 July 2023).
- McNees, S.K. The 1990-91 Recession in Historical Perspective. N. Engl. Econ. Rev. 1992, 3–22. Available online: https://ideas.repec.org/a/fip/fedbne/y1992ijanp3-22.html (accessed on 1 March 2024).
- Federal Reserve Bank of St. Louis. The Financial Crisis: Timeline of Events and Policy Actions. Available online: https://fraser.stlouisfed.org/timeline/financial-crisis (accessed on 27 October 2024).
- Bureau of Economic Analysis (BEA). Gross Domestic Product, 2nd Quarter 2020: Advance Estimate and Annual Update. Available online: https://www.bea.gov/news/2020/gross-domestic-product-2nd-quarter-2020-advance-estimate-and-annual-update (accessed on 3 July 2023).
- Choir, A.S.; Iriawan, N.; Mutmainah, S.S.K. R Package, version 0.1.4; Neojags: Neo-Normal Distributions Family for Markov Chain Monte Carlo (MCMC) Models in JAGS; CRAN: Windhoek, Namibia, 2025; Available online: https://cran.r-project.org/web/packages/neojags/index.html (accessed on 3 July 2025).
- Choir, A.S.; Iriawan, N.; Suprih Ulama, B.S.; Dokhi, M. MSEPBurr Distribution: Properties and Parameter Estimation. Pak. J. Stat. Oper. Res. 2019, 15, 179–193. [Google Scholar] [CrossRef]
- Iriawan, N. Computationally Intensive Approaches to Inference in Neo-Normal Linear Models; Curtin University of Technology: Bentley, UK, 2000. [Google Scholar]
- Petetin, Y.; Desbouvries, F. Bayesian Multi-Object Filtering for Pairwise Markov Chains. IEEE Trans. Signal Process. 2013, 61, 4481–4490. [Google Scholar] [CrossRef]
- Kulikova, M.V.; Tsyganova, J.V.; Kulikov, G.Y. UD-Based Pairwise and MIMO Kalman-Like Filtering for Estimation of Econometric Model Structures. IEEE Trans. Autom. Control 2020, 65, 4472–4479. [Google Scholar] [CrossRef]
- Mahler, R. The Pairwise-Markov Bernoulli Filter. IEEE Access 2020, 8, 168229–168245. [Google Scholar] [CrossRef]
- Nemesin, V.; Derrode, S. Robust Partial-Learning in Linear Gaussian Systems. IEEE Trans. Autom. Control 2015, 60, 2518–2523. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).












