1. Introduction
Factor analysis plays a critical role in quantitative finance, with applications in asset pricing, risk management, portfolio selection, and statistical arbitrage strategies. Broadly speaking, factor models can be categorized into two types: explicit factor models, which fall under supervised learning, and statistical factor models, which are typically unsupervised. Compared to explicit factor models such as Barra risk model (
Barra, 2004), statistical factor models offer two key advantages: they are numerically more stable in capturing the underlying covariance structure using fewer factors, and they are asset-class agnostic, making them broadly applicable across different markets.
However, financial markets are far from stationary. They undergo regime shifts that fundamentally alter market dynamics. For example, the transition from the unusually low-volatility environment of 2017 to the volatility spike in February 2018, the U.S. Federal Reserve’s abrupt rate hikes in 2022, or geopolitical shocks such as Russia’s invasion of Ukraine all represent regime-switching events. Standard statistical factor models, which assume globally static factor loadings, often fail to forecast covariances accurately during such transitions, the very moments when robust risk modeling is most needed.
The literature on statistical factor models has evolved to address such challenges. Early PCA-based factor models (
Jolliffe, 2004) are limited in parametric structure and perform poorly when within group variation dominates between group variation (
Hinton & Dayan, 1997;
McLachlan & Peel, 2000). In the 1980s, maximum likelihood (ML) factor analysis estimated via the EM algorithm was introduced by (
Rubin & Thayer, 1982). This was further generalized in the 1990s by (
Ghahramani & Hinton, 1996), who proposed the mixture of factor analyzers (MFA). By combining clustering with local dimension reduction, MFA works better than classical ML factor analysis due to its ability of segmenting data into different market regimes, each with its own factor structure, improving on the “one-size-fits-all” ML factor models.
Despite these advancements, within each regime, MFA still uses a classical ML factor model which assumes i.i.d. hidden factors and Gaussian innovations. Dynamic factor models extend this framework by introducing a recursive structure for hidden factor returns, capturing their time dynamics more realistically. Earlier works such as (
Bai & Wang, 2014;
Forni et al., 2009;
Geweke & Zhou, 1996;
Kim & Halbert, 1999) typically assume a simple first-order autoregressive (AR(1)) structure for factor returns, while later developments extend the underlying process to ARMA and VARMA formulations (see
Peña & Poncela, 2004,
2006;
Urteaga et al., 2017;
Varga & Szendrei, 2024). These dynamic factor models are capable of handling both stationary and nonstationary hidden factors.
In this paper, we focus on the AR(1)-based dynamic factor models with regime-switching factor loadings governed by a first order Markov chain. Such models, or, more generally, regime switching state space models, have been extensively studied in the literature (see
Carvalho et al., 2010;
Kim & Halbert, 1999;
Whiteley et al., 2010). This framework not only models the hidden factor process but also captures the regime switching effects inherent in financial data. Common estimation approaches include Gibbs sampling, the EM algorithm, particle MCMC and particle filtering. We adopt the particle filtering framework for its computational efficiency and sequential structure, which aligns closely with real world trading scenarios.
Particle filtering (
Arulampalam et al., 2002;
Doucet & Johansen, 2009) is a class of Monte Carlo methods designed to perform recursive Bayesian inference when analytical solutions such as the Kalman filter or Baum–Welch algorithm are infeasible. Although it is well developed when model parameter values are known, parameter learning in more complex settings remains challenging. Specifically, when parameters evolve according to a stochastic process rather than being constant, such as in applications in finance, an adaptive parameter learning algorithm becomes critical. To learn the parameter values, one early approach by (
Liu & West, 2001) incorporates parameters into the hidden state vector, but this often exacerbates the degeneracy issue in particle filtering. More computationally robust approaches have been introduced in (
Djuric et al., 2012) and (
Carvalho et al., 2010). Instead of combining parameter estimation to the learning algorithm they marginalize over parameters to reduce the estimation variance of their system. In this work, we implemented a particle filtering algorithm inspired by (
Djuric et al., 2012) and (
Carvalho et al., 2010) and applied it to estimate a regime switching dynamic factor model using real financial data.
The goal of this study is not merely methodological. By evaluating statistical factor models in the context of statistical arbitrage strategies, we directly test their practical usefulness for risk modeling. Following (
Avellaneda & Lee, 2010), we adopt a simplified trading framework where performance differences are driven primarily by the quality of covariance forecasts. In this setup, a superior factor model should deliver more accurate residuals, adapt more quickly to regime shifts, and ultimately provide a stronger risk foundation for arbitrage strategies.
The rest of paper is organized as follows:
Section 2 introduces the state space model and its estimation methods, including Kalman filter, EM algorithm, Particle filter, and the more recent development in parameter learning—the particle learning algorithm.
Section 3 presents statistical factor models such as the MLE factor model, mixture of factor analyzers and the regime-switching dynamic factor model. We highlight the evolution of statistical factor models over recent decades and provides a simulation study demonstrating the effectiveness of particle learning algorithm for estimating the regime-switching dynamic factor model.
Section 4 presents empirical studies applying the regime-switching dynamic factor model in the context of equity stat-arb strategy and compares its performance to the conventional MLE factor model. Finally,
Section 5 concludes the paper.
2. State Space Model and Its Estimation
A state space model is a framework used to describe the evolution of a dynamical system over time, particularly when the system is only partially observed. It has numerous applications in finance, such as time series prediction (alpha generation), statistical factor analysis (risk modeling), and portfolio selection (see
Kim & Halbert, 1999;
Kolm & Ritter, 2014). In the most general form, a state space model can be represented by the following:
where
denotes the hidden states with dimension
k, and
the observations with dimension
s. The terms
and
represent the noise terms for the evolution Equation
and the observation Equation
, with dimensions
w and
v, respectively. Throughout this work, we use bold lowercase to denote vectors, and bold uppercase to denote matrices. The functions
and
are general nonlinear functions defining the state transition and observation processes. When the parameter values of the above equations are known, inference about the hidden states can be efficiently performed using the recursive Bayesian algorithm (
Arulampalam et al., 2002), which is summarized as Algorithm 1:
Algorithm 1 Recursive Bayesian Algorithm |
|
Where the denominator in Equation
is called the marginal likelihood (or evidence), which is another intergral needs to be solved (see
Appendix A).
2.1. Kalman Filter and EM-Algorithm Estimation
When the dynamical system described by Equations
and
is linear, time-invariant, and finite-dimensional, functions
, and
can be expressed in the following form:
and if we further assume
,
, then the well-known Kalman filter can be derived to solve Equations
and
analytically as described in (
Arulampalam et al., 2002) and in Algorithm A1 (see
Appendix B). When parameters
,
are unknown, the EM algorithm (
Ghahramani & Hinton, 1996) can be employed for their estimation. In this framework, the Kalman filter is used in the E-step to compute the expected sufficient statistics of the hidden states, while the M-step updates the parameter estimates (see
Appendix C).
2.2. Particle Filter
When the dynamical system
and
do not admit a linear-Gaussian representation as in
and
, deriving an analytical solution for the recursive Bayesian inference becomes challenging. In such cases, particle filtering techniques has been a very popular approach for solving nonlinear dynamical system, including models like the stochastic volatility model (See
Djuric et al., 2012).
The Sequential Importance Sampling (SIS) filter (
Gordon et al., 1993) approximates the joint posterior density at time
t using the importance sampling method:
where
is the Dirac delta function, and
is the importance weight for particle
i, given by the following:
With the factorization
sequential sampling of states becomes feasible, which forms the foundation of SIS particle filter (see Algorithm A4).
In practice, the SIS particle filter suffers from weight degeneracy: the variance of the weight
will increase over time until only one particle dominates. To alleviate this issue, the Sequential Importance Resampling (SIR) filter resamples the particles based on their weights, replicating those particles with large weights and eliminating particles with small weights, thereby reducing variance (
Doucet & Johansen, 2009).
Although the optimal importance density for a generic particle filter algorithm is
(
Doucet et al., 2000), the SIR particle filter typically uses
as an important density and applies resampling at each step (see Algorithm A5). While SIR filter improves stability, it still has weaknesses (
Pitt & Shephard, 1999). First, if there is an outlier at time
t, the weights
will be unevenly distributed and the filter will become imprecise. Second, the predictive density
often fails to capture tail behavior accurately, causing some particles to drift into low-likelihood regions during step 2 in Algorithm A5.
To address these limitations, the auxiliary particle filter proposed by (
Pitt & Shephard, 1999) introduces a lookahead step—also known as the auxiliary variable mechanism. This approach uses a predictive weighting scheme (see Algorithm A6 step 1) that estimates the likelihood of the upcoming observation given the predicted state, a process often referred to as lookahead weighting. When the observation equation is informative in a dynamical system, the auxiliary particle filter usually will reduce variance in particle weights and hence perform better.
2.3. Particle Filter with Parameter Learning
The particle filter algorithms discussed so far assume that model parameters are known. However, in many applications, model parameters are typically unknown. Learning the static parameter values—or more broadly—identifying the coefficient evolution process—is a critical aspect of system identification. The integration of parameter learning into the particle filtering framework has been extensively studied (
Kantas et al., 2015).
One idea is to treat parameters as additional hidden state variables in the particle filtering framework, but this approach often leads to severe degeneracy issue. To address this issue,
Liu and West (
2001) proposed introducing an artificial evolutional model for the parameters and augment the hidden state space by including them.
Building on these ideas, Carvalho et al. (
Carvalho et al., 2010) introduced particle learning approach, a novel particle filter with the embedded parameter learning step. The particle learning method marginalizes both the parameters and the hidden states by only tracking their sufficient statistics, which are updated later using recursive Bayesian algorithm and Kalman filter, respectively. It is also constructed under the auxiliary particle filter framework; the performance improvement has been demonstrated in (
Carvalho et al., 2010;
Lopes & Tsay, 2010).
In our paper, we develop a simplified version of the particle learning algorithm to estimate regime-switching dynamic factor model.
2.3.1. Particle Learning
Particle learning algorithm was introduced by Carvalho et al. in (
Carvalho et al., 2010), extending the idea of auxiliary particle filter to incorporate parameter learning. While the overall filtering scheme is the same as auxiliary particle filter, the key innovation lies in tracking the “essential state”
.
Specifically, includes the following:
the sufficient statistics of the parameter vector ;
the sufficient statistics of hidden states , ; and
the current value of the parameter vector,
;
The reason we include parameter value in the essential state is because for evaluating likelihood and drawing samples from predictive density we need to use parameter values. However, their values are not directly sampled at each step, which most likely causes degeneracy issues; instead, they are inferred offline from their associated sufficient statistics. This approach is also referred to as marginalization by simulation.
The derivation of this filter starts with the recursive relation:
where
and
So, given the particles of
, we can construct a Monte Carlo estimate for
by sampling from
and
, respectively. After that we can update
and
deterministically. The particle learning method can be summarized as Algorithm 2:
Algorithm 2 Particle Learning |
(Resample) Draw , where (Propagate) Draw (Propagate) Draw (Update) (Sample) Draw (Update)
|
Where denotes the deterministic updating function for parameter sufficient statistics and denotes Kalman filter for state sufficient statistics update.
4. Results in Statistical Arbitrage Strategy
In both academic and industry, equity statistical arbitrage strategy (equity stat-arb) usually means the idea of trading groups of stocks against either explicit or synthetic factors, which can be seen as the generalization of “pairs-trading” (see
Avellaneda & Lee, 2010). In some cases, we would long an individual stock and short the factors, and in others we would short the stock and long the factors. Overall, due to the netting of long and short positions, our exposure to the factors will be small. One key step of the equity stat-arb strategy is the decomposition of assets’ returns into the systematic part and idiosyncratic part. When we use a more effective factor model, we can have a better decomposition and hence a better strategy performance.
4.1. Market Neutral Strategy
In this paper, we evaluate the quality of factor models within the context of an equity statistical arbitrage strategy. Inspired by the approach of (
Khandani & Lo, 2008), in order to avoid the unnecessary complexity of signal generation and potential overfitting issues, we adopt a deliberately simple reversion signal which is the negative value of previous day’s residuals. To ensure market neutrality, we construct a dollar-neutral portfolio each day, with equal dollar amounts allocated to long and short positions.
To be specific, we compare the performance of trading strategies derived from both the regime-switching dynamic factor model and static MLE factor model. For estimating the regime-switching dynamic factor model, we employ Algorithm 5. The initialization follows the same procedure as in the simulation analysis (
Section 3.3.2), with one refinement: to improve initial convergence, we use the estimates from a mixture of factor analyzer (MFA), trained on a “burn-in” sample from 3 January 2005 to 1 January 2011, as the initial mean of the factor loadings,
. Furthermore, the residualization step is implemented in a rolling window framework so that the residuals are always generated out-of-sample. For the estimation of the static MLE factor model, we employed Algorithm 3 as described in
Section 3.1. This serves as our baseline approach, providing a standard maximum likelihood estimation of factor loadings and covariances under the assumption of a single, time-invariant regime.
For computational efficiency, we designed a relatively lean experiment by restricting the dataset to the daily prices of the Dow Jones 30 constituents. Since factor models do not require the same scale-invariance adjustments as PCA-based approaches, we use raw returns rather than normalized return for the estimation. In this setting, we employ a three-factor model and assume that the factor loadings evolve according to a two-regime Markov chain. For each experiment, we use rolling window walk forward time series cross-validation framework to run our backtesting. The training data sample size is 120 days (around 6 months) and the test data sample size is 5 days (around one week). The objective of this experiment is not to identify or interpret the economic meaning of market regimes. Instead, our goal is to demonstrate that when a regime shift occurs, regardless of its underlying cause, our system adapts more rapidly to the new distribution (or data-generating process). This adaptability enables it to deliver a superior risk model for statistical arbitrage strategies.
After the residualization step, we can generate our signals using a naive rule-based approach. If the previous day’s residual for asset
i has
, where
d is the threshold, then we will say that the asset
i is over-priced at time
and short this asset for the next time stamp
t. For
, we will perform the opposite operation. For simplicity, in our experiment, we set
. At each time step, we form a dollar-neutral portfolio by applying the mean-variance closed form solution to both the long and short sides:
where
is the covariance matrix of returns,
represents the rule-based prediction, and
is a scaling factor that controls overall risk.
4.2. Performance Comparison
We run this naive strategy using the MLE static factor model, the dynamic factor model without regime switching mechanism, and the regime switching dynamic factor model, respectively, and the strategy performance is as shown in
Figure 4:
We can see from
Figure 4 that the strategy achieves a higher Sharpe ratio and a lower maximum drawdown when using the regime-switching dynamic factor model compared to both the static MLE factor model and the simple dynamic factor model. Specifically, the improvement in Sharpe is approximately 63%, while the reduction in maximum drawdown is about 12%. We also observe that the simple dynamic factor model performs well, telling us the importance of modeling the dynamics of factor returns in equity arbitrage strategies. However, incorporating the regime-switching mechanism provides an additional advantage: it meaningfully reduces drawdowns during market regime shifts (most notably during the COVID period) and improves estimation accuracy in the aftermath of such events. Based on these findings, we conclude that dynamic factor models consistently outperform static factor models, and that incorporating a regime-switching mechanism enables the model to adapt much more quickly to abrupt regime shifts, such as those observed during COVID, than conventional approaches.
The associated historical effective sample size plot and regime detection plot are given in
Figure 5:
In the above graphs, the effective sample size (ESS) is used to measure the stability of particle filtering algorithm in real data, and defined as:
where
are normalized weights.
From the ESS graph, we observe that the particle filter estimation is stable, as most of the time the ESS is larger than 2000 for a three-factor model. From the regimes detection, we can see there are more regime changes in the 2020 COVID period and early 2024. Indeed our regime switching model performs better during those periods compared with the simple dynamic factor model and static factor model.
It is also worth noting that although our model does not assume the factor return process is stationary, it is also informative to check the estimated transition matrix:
The modulus of its eigenvalues are: 0.074, 0.046, 0.046. Since
, the implied factor dynamics are stationary.
Although determining the number of factors and regimes is beyond the scope of this work, it is still worthwhile to examine results under varying specifications. By checking different numbers of factors and regimes, we can assess whether our earlier findings remain robust across alternative setups. The relevant results are summarized in the
Table 1 and
Table 2 as follows:
From the results above, we observe that our findings remain consistent across varying specifications of factor numbers and regime counts. This robustness test provides further confidence that improvements from regime-switching dynamic factor model are not sensitive to any specific parameter choices.
5. Discussion
This paper investigates the estimation of a regime-switching dynamic factor model using a particle learning algorithm. Through simulation studies, we validate our estimation approach by evaluating regime detection accuracy, idiosyncratic risk estimation, and the model’s ability to track expected returns. The empirical study in the equity statistical arbitrage framework further demonstrates that the regime-switching dynamic factor model outperforms a conventional static MLE factor model in capturing underlying data dynamics.
The particle learning algorithm implemented in this paper builds on the framework of (
Carvalho et al., 2010), with several modifications. First, we extend the innovation distribution to a mixture of Gaussian distributions. Second, we simplify the parameter learning step by only tracking the sufficient statistics, rather than using the marginalization via simulation. Lastly, we apply the estimated model to the empirical data and compare its performance against the conventional MLE factor model.
We are able to see the performance improvements in the equity statistical arbitrage strategy when using our model. Our model not only improves the Sharpe ratio but also minimizes the maximum drawdown. These results align with our initial motivation: It is well known that financial market operates under multiple regimes, and incorporating the regime switching mechanism that is governed by the hidden Markov model in our model representation allows us better model the structural shifts and enhances risk management—particularly during periods of elevated volatility and contagion risk.
While the current particle learning algorithm is based on the vanilla auxiliary particle filter, there remains a lot of room to improve the quality of our particle filtering algorithm and hence improve the tracking of hidden states (or hidden factors in this model). For instance, the ABC-based sequential Monte Carlo filter (
Jasra et al., 2010) could further enhance the filtering accuracy. Additionally, incorporating more robust, heavy-tailed innovation distributions (
Schoutens, 2005) may improve the robustness of our estimation, particularly in the presence of extreme market movements. Investigating more sophisticated specifications for the hidden factor process, including nonstationary factor models, would also be a promising direction for future research (
Peña & Poncela, 2004,
2006).