Abstract
Researchers collecting intensive longitudinal data (ILD) are increasingly looking to model psychological processes, such as emotional dynamics, that organize and adapt across time in complex and meaningful ways. This is also the case for researchers looking to characterize the impact of an intervention on individual behavior. To be useful, statistical models must be capable of characterizing these processes as complex, time-dependent phenomenon, otherwise only a fraction of the system dynamics will be recovered. In this paper we introduce a Square-Root Second-Order Extended Kalman Filtering approach for estimating smoothly time-varying parameters. This approach is capable of handling dynamic factor models where the relations between variables underlying the processes of interest change in a manner that may be difficult to specify in advance. We examine the performance of our approach in a Monte Carlo simulation and show the proposed algorithm accurately recovers the unobserved states in the case of a bivariate dynamic factor model with time-varying dynamics and treatment effects. Furthermore, we illustrate the utility of our approach in characterizing the time-varying effect of a meditation intervention on day-to-day emotional experiences.
1. Introduction
Reality is complicated. This is especially true in the psychological sciences where the modeling of basic psychological processes must contend with large amounts of measurement error, nonlinear relations among phenomena of interest and often severe unobserved heterogeneity. In terms of heterogeneity, not only do individuals differ from one another in complex and meaningful ways, psychological processes within individuals develop and adapt across a myriad of timescales and contexts. To be useful, models must be capable of characterizing these processes as complex, time-dependent phenomenon, otherwise the resulting insights and decisional criteria afforded by the modeling process will be narrowly defined. In this paper we introduce a nonlinear state space model and estimation framework capable of handling complex dynamic models where the relations between variables underlying processes of interest change in a manner that may be difficult to specify in advance. That is to say we outline a method that is useful even when there is little pre-existing knowledge about the nature of the change process itself. In the remainder of this introduction we will motivate the proposed model and estimator for psychological researchers by providing the requisite background information on our implementation while explicitly detailing the types of processes and questions amenable to this modeling framework.
1.1. Nonstationary Processes in Psychological Research
Historically, the majority of the probability theory developed for time series analysis was concerned with stationary time series. To define a stationary process let yt be a k × 1 vector of observations at time t. We can call the process yt stationary if the probability distributions from the random vectors () and () are equivalent for all lags or leads () and all set of times () (Grenander & Rosenblatt, 1957, p. 29–33). Intuitively this means a time series is stationary if there are no systematic changes in the series mean (e.g. trends) or variance, and all periodic variation has been removed from the series. Technically speaking, the majority of natural processes are unlikely to be stationary but it is also often the case that nonstationary series can be made stationary for the purpose of analysis. As the lion’s share of analytic approaches assume stationarity this is a convenient choice for researchers when a more complex characterization of the system is not possible.
However, unlike many time series modelers who are primarily interested in forecasting, psychologists are generally focused on model construction and interpretation, and removing nonstationary characteristics of the process is in many cases inconsistent with the goals of the modeling endeavor. If researchers are unable to approximate the complexity of the process under study, the model itself is unlikely to provide useful insights about the phenomenon. Furthermore, failure to account for nonstationarity can lead to dramatic underestimates of the uncertainty associated with a given model, leading researchers to be overconfident in their assessments, making generalization and the establishment of lawful relations based on individual behavior more difficult.
For these reasons models of psychological processes developed from sequentially collected experimental or observational data often require methodological approaches capable of handling nonstationarity. For example, if the subject under study adjusts their responses based on changing decisional criteria, concentration levels, fatigue or any factors secondary to the stimuli itself the process is likely to be nonstationary. Examples of this can be found in models of learning (Browne & Zhang, 2007), psychophysical stimulus detection paradigms where responses may depend on more than just the task intensity at any given presentation (Doll, Veltink, & Buitenweg, 2015; Fründ, Haenel, & Wichmann, 2011), as well as emotional dynamics both within (Koval & Kuppens, 2012) and between (Bringmann, Ferrer, Hamaker, Borsboom, & Tuerlinckx, 2018) individuals, to name just a few. Furthermore, by design the presence of an intervention will often lead a process to become nonstationary. This is even more likely if the impact of the intervention changes throughout (and possibly following) the course of a treatment. Related to the examples given above but stated more generally stationarity implicitly requires the parameters or relations among variables underlying a phenomenon of interest to be invariant with respect to time and violation of this premise will lead to a nonstationary series.
1.2. Time-Varying Parameter Models
Models that allow for parameters to change across time are one approach for handling nonstationarity. Broadly these models can be classified as Regime-Switching (RS) when parameters are allowed to vary discretely, typically as a function of recurrent shifts between distinct model states (or regimes). A second class of models, and the models with which this paper is concerned, are time-varying parameter (TVP) models where the parameters are allowed to continuously vary across time. In the TVP case changes are hypothesized to be smooth rather than sharp. In the case of observed variable time series popular RS models include the threshold autoregressive model (Tong & Lim, 1980), threshold cointegration model (Balke & Fomby, 1997), the threshold unit root model (Caner & Hansen, 2001), and the Markov-switching autoregressive model (Hamilton, 1989). Psychological researchers have employed these models to investigate dyadic interactions (Hamaker, Zhang, & van der Maas, 2009), the time dependency between positive and negative affect (Hamaker, Grasman, & Kamphuis, 2010), and have also extended these frameworks to handle time series from multiple individuals (De Haan-Rietdijk, Gottman, Bergeman, & Hamaker, 2016).
Likewise, commonly implemented TVP models for observed variable time series include the the local linear trend model (Harvey, 1990), time varying autoregressive moving average (ARMA) models (where the autoregression parameter is allowed to vary over time) (Weiss, 1985), the stochastically varying coefficient regression (VCR) model (Pagan, 1980) and the time-varying vector autoregression (VAR) model (Jiang & Kitagawa, 1993). TVP models have also been employed in psychological applications. For example, time-varying VAR models have been used to investigate emotion dynamics among dyads (Bringmann et al., 2018) and well-being in individuals diagnosed with Autism Spectrum Disorder (Haslbeck & Waldorp, 2019). Interested readers can see Haslbeck, Bringmann, and Waldorp (2019) for a detailed overview and an empirical comparison of the approaches developed by Bringmann et al. (2018) and Haslbeck and Waldorp (2019).
Unfortunately many of the processes most interesting to psychologists are complex, characterized by nonlinear relations among variables and diluted by measurement error. When unaccounted for measurement error can cause unintended consequences during modeling for both time-invariant and time-varying parameter models. None of the observed variable approaches described above are intended to account for measurement error. When present and unaccounted for measurement error will render an otherwise observed AR process latent, and this latent process will be of a differing order than the observed process (Box & Jenkins, 1976), complicating the modeling process. Furthermore, if an AR model is fit to observed data measured with error the autoregressive coefficients obtained from this analysis will be biased towards zero (Staudenmayer & Buonaccorsi, 2005) and maximum likelihood estimation will provide unreliable inferences (Fuller, 2009) and distorted diagnostic tests (Patriota, Sato, & Blas Achic, 2010). For these reasons researchers will often turn to state space (or factor analytic) methods when multiple-indicators of a construct of interest are available. State space methods are capable of accounting for measurement error while elegantly handling a wide variety of nonlinear dependencies among latent and observed variables. Similar to the observed variable case, this class of non-linear latent variable models with time-varying parameters have also been employed by psyshometricians and researchers in the social and behavioral sciences.
In the economics literature Stock and Watson (2009) proposed an exploratory dynamic factor model to identify discontinuities within economic time series evidenced by discrete shifts in the factor loading pattern. Yang and Chow (2010) proposed a regime-switching approach within the state-space modeling framework for characterizing the dynamics of facial electromyography. Here the discrete shifts alone rendered the process nonlinear, however, the latent states themselves were characterized by a linear process within each regime. Chow and Zhang (2013) extended the model from Yang and Chow (2010) to the nonlinear case in the form of a nonlinear regime-switching state-space model estimated using a combination of the Extended Kalman and Kim Filters. Here the nonlinearity arises from the dynamics within each regime being defined according to the logistic function and the piecewise nonlinearity introduced by the regime switching. Although the class of hidden Markov models are similar to the latent variable RS models described above they are generally defined without dynamics among the latent states and for this reason we do not consider them further here.
In the psychology literature Molenaar, De Gooijer, and Schmitz (1992) was the first to propose a unidimensional dynamic factor model for nonstationary data by incorporating a linear trend at the latent level. Molenaar (1994) extended this model further to allow for the autoregressive and factor loading parameters to vary as polynomial functions of time. In the economics literature Negro and Otrok (2008) proposed a dynamic factor model with arbitrarily time-varying factor loadings and stochastic volatility in both the latent factors and error components. Chow, Zu, Shifren, and Zhang (2011) also developed a dynamical factor model with a single time-varying cross-regressive parameter hypothesized to obey an AR(1) process based on the differences in the coefficient values from baseline. This model was estimated using a first-order Extended Kalman Filter (EKF), similar to the method proposed in Molenaar (1994). In the neuroimaging literature a number of authors have explored using the EKF to model physiological signals. For example, Milde et al. (2010) used a version of the EKF to model high-dimensional multi-trial laser-evoked brain potentials. Havlicek, Friston, Jan, Brazdil, and Calhoun (2011) applied the EKF to coupled dynamical systems of evoked brain responses in functional Magnetic Resonance Imaging (fMRI). Hu, Zhang, and Hu (2012) used the EKF to model time-varying source connectivity based on somatosensory evoked potentials. Finally, Molenaar, Beltz, Gates, and Wilson (2016) proposed a multi-dimensional exploratory factor analysis model in conjunction with a second-order Extended Kalman Filter (SEKF) to estimate individual-level functional connectivity maps from fMRI data.
The current work directly extends the procedures developed by Molenaar et al. (2016) in several important ways. First, we have developed a square-root version of the second-order Extended Kalman Filter (SR-SEKF) which effectively doubles the numerical precision of the SEKF algorithm. Second, we have implemented the Rauch-Tung-Striebel (RTS; Ruach, Tung, & Striebel, 1965) smoother adapted to the second-order Extended Kalman Filter. Third, we examine the performance of the developed procedure in the context of detecting and estimating multiple time-varying parameters simultaneously. Fourth, we examine the performance of the algorithm in detecting and characterizing multiple time-varying treatment effects. Fifth, we systematically explore the impact of allowing for more time-varying parameters on the bias and variability of the existing parameter estimates.
The remainder of the article is organized as follows. We begin by orienting the reader to the linear dynamic factor analysis model as typically presented in the structural equation modeling (SEM) framework. We then demonstrate how the linear model can be adapted to handle time-varying parameters and detail a set of estimation routines that are capable of handling the nonlinearities induced by this adaptation. We examine the performance of the estimator under a number of novel modeling conditions and provide an empirical example demonstrating the utility of the proposed approach for psychological researchers.
2. Models and Notation
2.1. Linear Dynamic Factor Model Specification
With minor modifications we use the notation of Molenaar (2017) to specify a general form for the dynamic factor model:
| (1) |
| (2) |
where (1) describes the observed variable or measurement model and (2) describes a vector autoregressive moving average (VARMA) latent time series. In the measurement model yt is a k × 1 vector of observations at time t, is a sequences of k × m factor loading matrices up to order s, is an m × 1 vector of latent factors at time t, and is a k × 1 vector of unique factors at time t, and . For the latent variable time series is a series of m × m matrices up to order p containing the autoregressive and cross-regressive weights, is a series of m × m matrices up to order q containing the moving average weights, is a m × r matrix of regression coefficients relating an r × 1 vector of exogenous covariates, xt to the latent series , and is a m × 1 vector of random shocks or innovations with .
2.2. Nonlinear Dynamic Factor Model Specification
To allow for arbitrarily time-varying parameters in (1) and (2) it is convenient to reformulate the linear dynamic factor model described above into the state space framework. Here we must also make the distinction between parameters which are time-invariant and those which we believe to vary in time. Let the the column vector contain the time-varying parameters from (1) and (2) such that . Here the operator stacks the unique time-varying (time-invariant) elements of each patterned matrix column-wise as in Magnus (1983). A number of options are available for modeling . Here we present the rather general specification
| (3) |
where is a zero-mean white-noise process. This specification is equivalent to letting obey a random walk. We note the specification of (3) means can vary arbitrarily across time without requiring any pre-defined parametric representation. This means does not need to change linearly, quadratically, or obey any specific functional form. However, as the variance of The only requirement placed on is that it varies slowly in time relative to the variation observed in yt (Priestley, 1988). One potential disadvantage related to this specification is the implicit assumption that the variance of increases over time. However, the variance of may be of less interest when employing a time-varying parameter model, as is the case here. In practice there are also methods available to ensure the EKF yields consistent estimates of the time-varying states under this specification (Bar-Shalom, Kirubarajan, & Li, 2002, p. 482), which is often the primary objective of a time-varying parameter analysis. Although other specifications are available, the specification in 3 allows for a parsimonious and easily interpretable characterization of smoothly evolving parameters in the state-space framework.
Now, let represent an augmented state vector that has been expanded to include the original state variables in as well as the time-varying parameters in , such that,
| (4) |
A nonlinear state space model for the augmented state vector in (4) and the observed variable time series can then be written as
| (5) |
| (6) |
where contains the adjusted elements from , and similarly contains the adjusted elements in and . Similar to above the measurement and process noise vectors are normally distributed with mean zero and covariance matrices given by and , respectively, and contains the time-invariant parameters from the following model matrices,
| (7) |
We assume the set of linear or nonlinear functions h() and f() describing the measurement relations and dynamic evolution of the augmented state vector to be continuously differentiable.
3. The Extended Kalman Filter
The Extended Kalman Filter (EKF; Bar-Shalom et al., 2002; Gelb, 2001) is an extension of the classic Kalman Filter (KF) to the case of nonlinear dynamics and measurement processes. The EKF is appropriate for estimating the types of nonlinear state space models with additive noise described above. Unlike the traditional KF the EKF requires a series expansion of the nonlinearities in both the dynamics and measurement equations as a means to approximate the joint distribution of the latent states and observed variables. Here we employ the second-order EKF and thus include a second-order expansion to provide higher-order correction terms in the prediction and updating equations.
3.1. Estimation Algorithm
A single cycle of the KF algorithm can be understood as a mapping of the conditional mean and covariance of the states at time t to the corresponding quantities at t + 1 using the information set available at t. Here the information set, , includes Yt, or the sequence of observations through time t (including the initial state) and Xt−1, the sequence of known exogenous inputs prior to time t. Using this prior information we can define the approximate conditional mean of the state as , the estimator error as , and the associated conditional covariance matrix of the state (or in the case of a nonlinear model the covariance matrix of the estimation error) as . Here we note that under differing conditions the conditional mean will represent an estimate of the state if j = k, an estimate of the smoothed state if j < k, and an estimate of the predicted state if j > k.
3.2. Initial State and Design Parameters
The EKF algorithm requires a number of quantities prior to its initialization. These quantities include an initial estimate of the state, , and the corresponding state covariance matrix, . In addition, estimates of the measurement noise covariance matrix, , and the process noise covariance, , are required. The choice of these quantities is far from trivial and can have a large impact on the subsequent performance of the filter. In previous research on the EKF these design parameters have often been chosen arbitrarily making it difficult to assess the performance of the estimator against alternative algorithms (see Schneider & Georgakis, 2013). For this reason we discuss the choice of these parameters in the context of the current problem. First, sufficiently precise estimates of both and (as well as ) can be obtained from a preliminary P-Technique factor analysis (Molenaar & Nesselroade, 2009). For the elements of pertaining to the time-varying parameters Bar-Shalom et al. (2002, p. 482) suggest using a few percent of the estimated time-invariant coefficient pertaining to the suspected time-varying parameter as an initial estimate of the process noise variance.
The choice of and is considerably more difficult. In the context of the SEKF with time-invariant parameters a number of methods have been suggested. These approaches could be adapted to the context of time-varying parameters, however, the utility of this approach has not been demonstrated in the literature. Here we adopt a procedure proposed by (Molenaar et al., 2016) for tuning and along with the other time-invariant parameters in using the raw data log-likelihood function
| (8) |
where contains the one-step ahead prediction errors obtained from the SEKF and St is the corresponding covariance matrix. Here we obtain parameter estimates based on the assumptions of a linear measurement model with additive and Gaussian distributed process and measurement noises. If the one-step ahead prediction errors are normally and independently distributed after removing the time dynamics implied by the model the optimization procedure will yield maximum likelihood estimates (Chow, Ferrer, & Nesselroade, 2007). In addition, the tuning procedure described above has the added benefit that the estimated values of returned by this index the variability of the time-varying parameters themselves, allowing for the possibility the parameters are in fact time-invariant (e.g. zero variance). Once this log-likelihood function has been optimized with respect to all the time invariant parameters in π these estimates are treated as fixed to obtain smoothed state estimates. This procedure is described in greater detail below.
3.3. Square Root Filter
A number of authors have analyzed square root versions of the first-order EKF (Chandra & Gu, 2019; Park & Kailath, 1995). However, to the best of our knowledge we are the first to explicitly detail how a square root filter can be adapted to the second-order EKF. In the square-root filter described here the square root of the state covariance matrix, rather than the state covariance matrix itself, is propagated through the Kalman recursions. Generally, the structure of the square root covariance matrix allows for a number of improvements over the standard implementation, including (a) assurance of a symmetric positive definite error covariance matrix, (b) higher order precision and therefore improved numerical accuracy (Grewal & Andrews, 2001), and (c) improved performance in parallel implementations (Park & Kailath, 1995).
3.4. State Prediction
As stated previously the primary objective of the SEKF is to obtain unbiased estimates of the state vectors, or latent variables, , by minimizing the least squares prediction error. At each time period the EKF completes two steps: (1) In the prediction step, a model-based prediction of the individual scores is obtained from scores at the previous time point . (2) In the correction step, the model-based prediction is corrected using observed information gathered at time t. These two alternating steps occur in an on-line fashion at each time point, moving through the data structure sequentially.
To obtain the predicted state we expand in Taylor Series the nonlinear function given in (6) around the previous state estimate . To the second order this series expansion ignoring the higher order terms is given by
| (9) |
where is the Jacobian of the vector function f evaluated at the previous estimate of the state, and is the Hessian matrix of the ith state variable. Moving forward we will use Jf and Hf,i to represent the Jacobian and Hessian of the state, respectively. Furthermore, we take the values of to be known within the recursions of the EKF.
Taking the conditional expectation of (9) given the observed information and known parameter values we obtain the following formula for the predicted state
| (10) |
as only and are random variables in (9) and the second order term is simplified based on the expectation of quadratic forms. The positive semi-definite state covariance matrix P has been factorized such that , and . For the positive semi-definite matrix P the Cholesky decomposition is a computationally convenient method that satisfies the identity above. Furthermore, by subtracting (10) from (9) we obtain the state prediction error as
| (11) |
where again the higher order terms are ignored and ei is a Cartesian basis vector with the ith element set to unity and the remaining elements set to zero.
3.5. State Prediction Covariance Matrix
In the standard implementation of the SEKF the mean squared error covariance matrix of (11) is written as
| (12) |
where use has been made of results for the covariance matrix of quadratic forms and the assumption that moments greater than two are equal to zero. However, in the square root version of the filter we are are only interested in updating . In the square root version of a first-order EKF this is straightforward as only the factorized version of is required. However, in the SEKF we must also include the linearization error in our factorization such that
| (13) |
where here and below a matrix is factorized using the Cholesky decomoposition such that , and . With these quantities in hand the factorized state prediction covariance matrix can be obtained from the following identity and transformation
| (14) |
where κ indicates the transformation of a symmetric matrix to upper-triangular via the QR decomposition.
3.6. Measurement Prediction
We can write the predicted measurement observations for the second-order EKF as
| (15) |
using the factorized state prediction covariance matrix where the associated measurement prediction covariance matrix is given by
and is the Jacobian of the vector function h evaluated at the updated estimate of the state, and is the Hessian matrix of the ith state variable.
3.7. State Update Equations
Traditionally in the non-square-root second-order filter we compute the state update, , directly from
| (16) |
where is the filter gain and is the measurement residual, and the updated state covariance is . In the modified square-root version of the filter proposed here we use the factorized state prediction covariance matrix to construct the following identity
| (17) |
where is the square root of the measurement noise covariance matrix, κ again indicates the transformation of a symmetric matrix to upper-triangular via the QR decomposition and the filter gain is calculated by . The updated state can then be obtained using (16).
Thus far we have described a single cycle of the SR-SEKF algorithm. This cycle is then repeated for each subsequent set of observations from t = 2 to T, until the state vector has been estimated for each t in the series. This full set of recursions produces a likelihood value based on the prediction errors as summarized in Equation 8, which is then optimized with respect to the time-invariant parameters in the model. Included in this set of time-invariant parameters being optimized are the diagonal elements of , which in the case of the time-varying parameters provide additional information as to whether or not the parameter varies meaningfully across time (Molenaar et al., 2016). Finally, once the likelihood function has been optimized the estimated time-invariant parameters are treated as fixed and the states can be smoothed to obtain improved estimates of the states and state covariance matrix. Although a detailed analysis of the computational complexity of our EKF implementation is beyond the scope of this paper interested readers can find a detailed discussion of computational complexity reduction methods for filtering algorithms in Raitoharju and Piché (2019).
3.8. Fixed-Interval Smoother
Smoothing is the estimation of the state at time j with an interval of data where j < k. A number of smoothers have been defined based on the selection of k, however, we only consider the fixed-interval smoother where k = T. Fixed-interval smoothing is equivalent to smoothing the entire trajectory of the estimated states based on all of the available timepoints. Here we implement the Rauch-Tung-Striebel smoother (RTS; Ruach et al., 1965) adapted to the SEKF. This fixed-interval smoother requires the following quantities to be saved from the forward recursions of the SEKF: , and . Using these estimates calculated backwards in time starting from k = T, the smoothed state estimates are calculated as
| (18) |
where
| (19) |
and the smoothed state covariance matrix is
| (20) |
4. Monte Carlo Simulations
Monte Carlo simulations were conducted to examine the finite-sample properties of the SEKF estimator in nonlinear time-varying parameter state space models. The simulations were loosely based on the empirical example considered in this paper, where daily measures of two latent constructs (positive and negative affect) were collected prior to, during, and following a multiple-week intervention. A number of scenarios regarding the time-varying dynamics and hypothesized intervention effects could be considered. For the purpose of this paper we focused our simulations on two situations we thought were substantively interesting while also having the potential to contribute new information to the literature on time-varying parameter estimation. First, we considered the scenario where the cross-regressive effects between the latent states (positive and negative affect) varied across time. Second, we investigated the case where the effect of an intervention on the latent states (positive and negative affect) varied in time following the onset of the intervention, possibly continuing even after the intervention ceased. These two scenarios are represented in simulations 1 and 2, respectively.
As previously mentioned, in addition to the overall performance of the estimator in terms of parameter recovery we were also interested in answering a number of preliminary questions relevant to the use of these models in psychological research. First, is the estimator able to accurately recover multiple time-varying parameters when they exist in the data generating model? Second, what is the impact of allowing many model parameters to vary in the estimated model when only a subset of those parameters are time-varying in the true or data generating model?
Finally, we also wanted to better understand the potential advantages of our proposed square-root algorithm (SR-SEKF) over the standard second-order EKF (SEKF). In theory these two approaches are algebraically equivalent, however, previous research has shown square-root filters can reduce the computational complexity compared to standard algorithms, with downstream effects on computational efficiency, convergence rates and parameter estimation. For these reasons we also chose to compare our approach to its non-square-root counterpart.
All the estimation routines described in this paper and employed for the simulations and empirical example were coded in R by the first author. In the remainder of this section we describe in more detail the outcomes of interest, data generating models, and simulation results.
4.1. Measures
To compare the performance of the estimator across time-varying and time-invariant parameters we examined its relative bias and efficiency within each simulation condition. For parameters that were generated as time-invariant and also treated as time-invariant in the fitted model the mean relative bias was calculated as where is the data generating parameter in a given simulation condition, is the estimate for parameter a in the kth Monte Carlo replication, and N is the total number of replications. For parameters that were generated as time-invariant but treated as time-varying in the fitted model mean relative bias was calculated as where is the estimate for parameter a at timepoint t in the kth Monte Carlo replication. Mean relative bias was then multiplied by 100 to obtain the mean percentage of relative bias. Second, for parameters generated and estimated as time-invariant we examined the variability associated with each model parameter using the standard deviation of across replications within a single block of the simulation, . We also report the accuracy of the estimation procedure for detecting whether a parameter was correctly time-varying or time-invariant based on the conservative measure of zero variance for the final smoothed estimates of each parameter within a given sample.
4.2. Data Generating Models
As stated previously we considered two main simulation conditions. First, we examined the case where the cross-regressive effects between the latent states (positive and negative affect) vary across time. Second, we investigated the case where the effect of an intervention on the latent states (positive and negative affect) varied in time.
Continuous multivariate latent time series were generated in accordance with equations (1) and (2) for time series lengths of T = 70,200,500. Random shock vectors and measurement errors were generated from and , respectively. A burn-in period of 1,000 time points was discarded from the series to attenuate any persisting effects of the initial parameters. 100 datasets were generated for each block of the simulation design. Across our two main simulation conditions the data was generated with factor loadings equal to , measurement error variances equal to , and autoregressive coefficients as () = (.7, .5). Furthermore, the exogenous input variable x1 was coded as zero or one depending on whether the intervention was active at a given timepoint. To mirror the empirical example, treatment began after approximately 2/11 of the series had elapsed, and continued until the final observation point. As the treatment in our empirical example involved teaching the subjects meditation techniques that were carried over to the home environment this setup was designed to reflect the uncertainty in the duration of treatment effects. Additional details regarding the individual model specifications used to generate and fit individual datasets will be described in detail below.
In simulation 1 we sought to investigate whether the proposed estimator could accurately recover time-varying cross-regressive parameters and . In the data generating model and were generated as random walks and then scaled to the range of (−0.3, 0.3). To better reflect what is likely a smooth evolution of the parameters in terms of daily changes in affect regulation we locally regressed and smoothed the generated random walks using a 50% smoothing span (Cleveland, 1979). Visual depiction of the data generating values for the cross-regressive coefficients are shown as the “True States” in Figure 1. As the focus of simulation 1 was on the cross-regressive coefficients, the parameters describing the treatment effect on the latent constructs were held constant at = 0.5 and = 0.5. As it will often the be the case that researchers do not know a priori which parameters are time-varying we also wanted to better understand the consequences of allowing many parameters to vary in time. For simulations 1 and 2 (presented below) this was examined across three sub-conditions A, B and C. In sub-condition A, only and were estimated as time-varying and the remaining parameters were estimated as time-invariant. In sub-condition B and , as well as the autoregressive coefficients, and , were estimated as time-varying. In sub-condition C, all the elements of , as well as the treatment effects in were estimated as possibly varying across time.
Figure 1:
Mean Time-Varying Parameter Estimates for Simulation 1C
In simulation 2 we examined whether the estimator could accurately recover time-varying treatment effects characterized by the and parameters. Just as in simulation 1 the time-varying parameters were generated as random walks, scaled to the range of (−0.5, 0.5) and smoothed. Visual depiction of the data generating values for the time-varying treatment effects are shown under the label “True States” in Figure 2. In simulation 2 the cross-regressive parameters were held constant at = −0.2 and = −0.3. We also extended simulation 2 across the three sub-conditions. In sub-condition A and were estimated as time-varying and the remaining parameters were estimated as time-invariant. In sub-condition B, the treatment effects () and cross-regressive parameters () were estimated as time-varying, and in sub-condition C all the elements of and were estimated as time-varying. A taxonomy of the parameter types and their status across conditions and model designations (data-generating vs. estimated) is provided in Table 1.
Figure 2:
Mean Time-Varying Parameter Estimates for Simulation 2C
Table 1:
Taxonomy of Simulation Conditions and Parameter Designation
| Data-Generating Model |
Fitted Model |
||||
|---|---|---|---|---|---|
| Parameter Type |
Parameter Type |
||||
| Simulation | Condition | Time-Varying | Time-Invariant | Time-Varying | Time-Invariant |
| 1 | A | ||||
| 1 | B | ||||
| 1 | C | ||||
| 2 | A | ||||
| 2 | B | ||||
| 2 | C | ||||
4.3. Results
4.3.1. Relative Bias for Parameters Generated as Time-Invariant
The percentage of relative bias for the parameters generated as time-invariant across all simulation conditions are given in Table 2. Generally the bias in parameter estimates was small and rarely exceeded 5%, which is often used as a threshold of meaningful parameter bias. For the factor loadings and measurement error variances the bias never exceeded 4%, even in the smallest time series length of T = 70. In simulation 1, where the cross-regressive parameters () were generated as time-varying, bias only exceeded 5% for the exogenous treatment effects and and even here the bias was relatively small at −8% and −6%, respectively.
Table 2:
Mean Percentage of Relative Bias for Parameters Generated as Time-Invariant
| Time Series Length |
||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| T = 70 |
T = 200 |
T = 500 |
||||||||||||||||
| Simulation Condition |
Simulation Condition |
Simulation Condition |
||||||||||||||||
| 1 |
2 |
1 |
2 |
1 |
2 |
|||||||||||||
| Parameter | A | B | C | A | B | C | A | B | C | A | B | C | A | B | C | A | B | C |
| −1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| −4 | −3 | −3 | −3 | −1 | −2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| −1 | −1 | −1 | −1 | −1 | −2 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| −2 | −1 | −2 | −2 | −2 | −2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| . | 0 | −1 | −1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | −1 | 0 | 0 | 0 | 0 | 0 | 0 |
| −3 | −3 | −2 | −2 | −3 | −1 | −1 | 0 | 0 | −1 | −1 | −1 | 0 | 0 | 0 | 0 | 0 | 0 | |
| −2 | −1 | −1 | −2 | −1 | −1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| −2 | −1 | −1 | −2 | −1 | −1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| −2 | −1 | −1 | −2 | −1 | −1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| −1 | −1 | −1 | −2 | −1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| −1 | −1 | −1 | −2 | −1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| −1 | −1 | −1 | −2 | −1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| −6 | −4a | −4a | −7 | −4 | −3a | −1 | −2a | −2a | −1 | −1 | −1a | −1 | −2a | −2a | −1 | −1 | −2a | |
| −4 | −2a | −3a | −6 | −3 | −2a | −1 | −2a | −3a | −1 | −1 | −1a | −1 | −2a | −2a | −1 | −1 | −1a | |
| - | - | - | 16 | 4a | 2a | - | - | - | 0 | 1a | 1a | −1 | −2a | −2a | ||||
| - | - | - | 9 | 4a | 3a | - | - | - | 1 | 1a | 1a | 0 | −1a | 0a | ||||
| 0 | −3 | −3a | - | - | - | −1 | 0 | 0a | - | - | - | 0 | 0 | 3a | - | - | ||
| 1 | 0 | 5a | - | - | - | 0 | 0 | 2a | - | - | - | 0 | 0 | 2a | - | - | ||
Parameter generated as time-invariant but estimated as time-varying.
Note. Unless otherwise noted parameters were generated and estimated as time-invariant. Descriptions of sub-conditions A,B, and C provided in Table 1. Cells containing a single - were generated and estimated as time-varying.
In simulation 2 where the treatment effect parameters, and , were generated as time-varying, estimation of the smaller of the cross-regressive parameters, , and the autoregressive parameter at the shortest time series length showed considerable bias compared to other parameters in the model. In regards to our original question of whether allowing additional parameters to vary across time in the estimated model impacted the parameter recovery, we found no evidence of deleterious effects in terms of parameter bias. Bias in the the parameters generated and estimated as time-invariant did not increase as a function of increasing numbers of time-varying parameters. Similarly, even parameters that were generated as time-invariant but estimated as time-varying showed little to no additional bias compared to the case when they were correctly estimated as time-invariant.
4.3.2. Accuracy of Estimated Time-Varying Parameters
As we did not see major differences across the simulation sub-conditions we only present graphical depictions of the results from sub-condition C, where the most parameters were allowed to vary in time. The true (or data generating) and mean estimated parameter values for all time-varying estimates in simulations 1 and 2 are provided in Figures 1 and 2, respectively. First let us consider simulation 1, where only the cross-regressive parameters, and were generated as time-varying. In Figure 1 it is clear the filtered and smoothed estimates of the latent states and accurately recovered the true data generating trajectories across all examined time series lengths. In addition the smoothed estimates of and also captured the augmented state elements well, with accuracy increasing as time series length increased. The filtered estimates, however, tended to overestimate the magnitude of the true coefficient at the smaller time series lengths. In terms of the parameters which were generated as time-invariant but estimated as time-varying the algorithm appears to have done well in the aggregate in terms of characterizing these parameters as constant. A similar pattern emerged for simulation 2 (see Figure 2), however, the smoothed estimates for the time-varying treatment effects tended to overestimate the parameter prior to the beginning of the intervention, while the filtered estimates better captured this change.
4.3.3. Standard Deviation of Coefficient Estimates
Efficiency of the parameter estimates across all model specifications was assessed using the standard deviation of parameter estimates within each simulation block (see Table 3). Generally, no consistent pattern of changes in parameter variability was observed across the different simulations sub-conditions, indicating there was little impact on parameter variability when allowing additional time-varying parameters in the estimated model, even when those parameters were in fact generated as time-invariant. As was expected across all sub-conditions variability decreased as the time series length increased.
Table 3:
Standard Deviation of Parameters Generated as Time-Invariant
| Time Series Length |
||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| T = 70 |
T = 200 |
T = 500 |
||||||||||||||||
| Simulation Condition |
Simulation Condition |
Simulation Condition |
||||||||||||||||
| 1 |
2 |
1 |
2 |
1 |
2 |
|||||||||||||
| Parameter | A | B | C | A | B | C | A | B | C | A | B | C | A | B | C | A | B | C |
| 0.05 | 0.05 | 0.04 | 0.05 | 0.05 | 0.05 | 0.02 | 0.01 | 0.01 | 0.02 | 0.02 | 0.02 | 0.00 | 0.00 | 0.00 | 0.01 | 0.00 | 0.00 | |
| 0.05 | 0.05 | 0.04 | 0.05 | 0.05 | 0.05 | 0.02 | 0.01 | 0.01 | 0.02 | 0.02 | 0.02 | 0.00 | 0.00 | 0.00 | 0.01 | 0.00 | 0.01 | |
| 0.05 | 0.05 | 0.05 | 0.05 | 0.05 | 0.05 | 0.02 | 0.01 | 0.01 | 0.02 | 0.02 | 0.02 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | |
| 0.05 | 0.04 | 0.04 | 0.05 | 0.05 | 0.04 | 0.01 | 0.01 | 0.01 | 0.02 | 0.02 | 0.02 | 0.00 | 0.00 | 0.00 | 0.01 | 0.00 | 0.00 | |
| 0.05 | 0.05 | 0.05 | 0.05 | 0.05 | 0.05 | 0.01 | 0.01 | 0.01 | 0.02 | 0.02 | 0.02 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | |
| 0.05 | 0.05 | 0.05 | 0.05 | 0.05 | 0.05 | 0.01 | 0.01 | 0.01 | 0.02 | 0.02 | 0.02 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | |
| 0.08 | 0.07 | 0.06 | 0.10 | 0.08 | 0.07 | 0.02 | 0.02 | 0.02 | 0.02 | 0.02 | 0.02 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | |
| 0.08 | 0.07 | 0.06 | 0.10 | 0.08 | 0.07 | 0.02 | 0.02 | 0.02 | 0.02 | 0.02 | 0.02 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | |
| 0.08 | 0.07 | 0.06 | 0.10 | 0.08 | 0.07 | 0.02 | 0.02 | 0.02 | 0.02 | 0.02 | 0.02 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | |
| 0.07 | 0.06 | 0.06 | 0.09 | 0.08 | 0.07 | 0.02 | 0.02 | 0.02 | 0.02 | 0.02 | 0.02 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | |
| 0.07 | 0.07 | 0.06 | 0.09 | 0.08 | 0.07 | 0.02 | 0.02 | 0.02 | 0.02 | 0.02 | 0.02 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | |
| 0.07 | 0.07 | 0.06 | 0.09 | 0.08 | 0.07 | 0.02 | 0.02 | 0.02 | 0.02 | 0.02 | 0.02 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | 0.01 | |
| 0.08 | - | - | 0.12 | 0.10 | - | 0.03 | - | - | 0.03 | 0.02 | - | 0.01 | - | - | 0.01 | 0.01 | - | |
| 0.09 | - | - | 0.13 | 0.10 | - | 0.02 | - | - | 0.02 | 0.03 | - | 0.01 | - | - | 0.01 | 0.01 | - | |
| - | - | - | 0.11 | - | - | - | - | - | 0.03 | - | - | - | - | - | 0.01 | - | - | |
| - | - | - | 0.10 | - | - | - | - | - | 0.02 | - | - | - | - | - | 0.01 | - | - | |
| 0.15 | 0.10 | - | - | - | - | 0.01 | 0.01 | - | - | - | - | 0.01 | 0.00 | - | - | - | - | |
| 0.12 | 0.11 | - | - | - | - | 0.02 | 0.02 | - | - | - | - | 0.01 | 0.00 | - | - | - | - | |
Note. Unless otherwise noted parameters were generated and estimated as time-invariant. Descriptions of sub-conditions A,B, and C provided in Table 1. Cells containing a single - were estimated as time-varying. Standard deviations were rounded to the third decimal place.
4.3.4. Detection of Time-Invariant and Time-Varying Parameters
Finally we consider the accuracy of the smoothed parameter estimates in determining whether a parameter was is time-varying or time-invariant. As mentioned previously this is a conservative criteria as we may reasonably expect the smoothed estimations of a time-invariant parameter to have some small amount of variation around the true value. However, as the purpose of this study was not the evaluation of secondary procedures for determining time-invariance we evaluated the smoothed estimates for this purpose. Smoothed parameter estimates were considered to be time-varying if those estimates had some non-zero variance across the time series length, and time-invariant if the smoothed parameter estimates were constant (with zero variance).
As can be seen from Table 4 the true-time varying parameters were classified as such 100% of the time, even at the smaller sample sizes. Except for the constant treatment effects in simulation 1 the time-invariant parameters were also correctly classified as time-invariant between 80% – 99% of the time, with classification improving at the larger sample sizes. Unlike the other time-invariant parameters the smoothed estimates of the treatment effects () showed some nonzero variance in a larger proportion of replications. However, as can be seen from Figure 1 where the means of the smoothed estimates of and track tightly with the constant data generating values and the small variances for those parameters in Condition 1C (see Table 3) one would likely classify and as time-invariant based on a simple plot of the parameter estimates across time.
Table 4:
Percentage of Accurately Classified Time-Varying and Time-Invariant Parameters Based on Smoothed Estimates
| Time Series Length |
||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| T = 70 |
T = 200 |
T = 500 |
||||||||||||||||
| Simulation Condition |
Simulation Condition |
Simulation Condition |
||||||||||||||||
| 1 |
2 |
1 |
2 |
1 |
2 |
|||||||||||||
| Parameter | A | B | C | A | B | C | A | B | C | A | B | C | A | B | C | A | B | C |
| 100a | 100a | 100a | - | 85 | 87 | 100a | 100a | 100a | - | 93 | 94 | 100a | 100a | 100a | - | 99 | 99 | |
| 100a | 100a | 100a | - | 80 | 83 | 100a | 100a | 100a | - | 93 | 96 | 100a | 100a | 100a | - | 99 | 100 | |
| - | 80 | 78 | - | - | 87 | - | 86 | 87 | - | - | 96 | - | 88 | 93 | - | - | 99 | |
| - | 85 | 87 | - | - | 85 | 81 | 86 | - | - | 94 | - | 80 | 92 | - | - | 99 | ||
| - | - | 17 | 100a | 100a | 100a | - | - | 15 | 100a | 100a | 100a | - | - | 15 | 100a | 100a | 100a | |
| - | - | 19 | 100a | 100a | 100a | - | - | 20 | 100a | 100a | 100a | - | - | 16 | 100a | 100a | 100a | |
Parameter generated as time-varying. All other parameters were generated as time-invariant.
Note. Cells containing a single - were generated and estimated as time-invariant and for this reason misclassification was not possible.
The results for the convenience sample taken here indicate a complex pattern of dependencies among the parameters and constructs of interest across time. Visually, subjects 1, 2, 5, 6, and 7 all show an increasing impact of the treatment on positive affect over time. This, however, does not always translate to concurrent increases in the levels of positive affect, as these changes often coincide with changes in other model parameters. As we did not let the intervention directly impact the parameters themselves, although this is certainly possible using the augmented state vector in 6, it is difficult to ascertain whether the reorganization of dynamics occurring in reflects a re-organization of the system that is inherently self-organizing or a result of external influence. Although the simulation results presented here suggest one is unlikely to observe broad variability in parameter trajectories (as is evident among many of the subjects here) if the parameter is in fact time-invariant, future work should examine the recovery of more complex patterns of parameter change to allow for more confident conclusions to be drawn. The results from this empirical example also point to the utility of looking at the impact of exogenous covariates not only on constructs themselves, but on parameters that may coincide with substantively interesting aspects of the theory governing model construction.
4.3.5. Comparison of Filter Implementations
As expected the square-root version of the second-order EKF provided a number of benefits when compared to the standard SEKF implementation. As we had no reason to believe our results would differ across the two simulations we only compared to two approaches for Simulation 1. The mean relative bias and standard deviation of the parameter estimates obtained from the SEKF are presented in Table 5. In terms of relative bias both approaches performed well, although in aggregate the SR-SEKF obtained lower relative bias across all parameter types for the models considered here. This difference was most pronounced for the structural model parameters (or dynamics) at the smallest sample size. The estimates obtained from SR-SEKF also exhibited less variability, consistent with the notion that square-root filters can reduce the propagation of numerical error across iterations.
Table 5:
Mean Percentage of Relative Bias and Standard Deviation for the SEKF
| Outcome Measure |
|||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Relative Bias |
Standard Deviation |
||||||||||||||||||
| T = 70 |
T = 200 |
T = 500 |
T = 70 |
T = 200 |
T = 500 |
||||||||||||||
| Condition |
Condition |
Condition |
Condition |
Condition |
Condition |
||||||||||||||
| Parameter | 1A | 1B | 1C | 1A | 1B | 1C | 1A | 1B | 1C | 1A | 1B | 1C | 1A | 1B | 1C | 1A | 1B | 1C | |
| −1 | −1 | 0 | 0 | −0 | 0 | 0 | 0 | 0 | 0.04 | 0.04 | 0.04 | 0.02 | 0.02 | 0.02 | 0.01 | 0.01 | 0.01 | ||
| −3 | −4 | −4 | 1 | 1 | 1 | 0 | 0 | 0 | 0.05 | 0.04 | 0.04 | 0.02 | 0.02 | 0.02 | 0.01 | 0.01 | 0.01 | ||
| −2 | −2 | −2 | 0 | 1 | 0 | 0 | 0 | 0 | 0.05 | 0.04 | 0.04 | 0.02 | 0.02 | 0.02 | 0.01 | 0.01 | 0.01 | ||
| −3 | −2 | −3 | 0 | 0 | 0 | 0 | −1 | 0 | 0.05 | 0.04 | 0.04 | 0.02 | 0.02 | 0.02 | 0.01 | 0.01 | 0.01 | ||
| 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0.05 | 0.04 | 0.04 | 0.02 | 0.02 | 0.02 | 0.01 | 0.01 | 0.01 | ||
| −2 | −2 | −1 | 0 | 0 | −1 | 0 | 1 | 0 | 0.05 | 0.05 | 0.04 | 0.02 | 0.02 | 0.02 | 0.01 | 0.01 | 0.01 | ||
| −2 | −1 | −1 | −1 | 0 | 0 | 0 | 0 | 0 | 0.09 | 0.08 | 0.07 | 0.04 | 0.03 | 0.03 | 0.01 | 0.01 | 0.01 | ||
| −2 | −1 | −1 | −1 | 0 | 0 | 0 | 0 | 0 | 0.09 | 0.08 | 0.07 | 0.04 | 0.03 | 0.03 | 0.01 | 0.01 | 0.01 | ||
| −1 | −1 | −1 | 0 | −1 | 0 | 0 | 0 | 0 | 0.09 | 0.08 | 0.07 | 0.04 | 0.03 | 0.03 | 0.01 | 0.01 | 0.01 | ||
| −2 | −1 | −1 | −1 | 0 | 0 | 0 | 0 | 0 | 0.08 | 0.07 | 0.07 | 0.04 | 0.03 | 0.03 | 0.02 | 0.01 | 0.01 | ||
| −2 | −1 | −1 | −1 | −1 | −1 | 0 | 0 | 0 | 0.08 | 0.07 | 0.07 | 0.04 | 0.03 | 0.03 | 0.01 | 0.01 | 0.01 | ||
| −2 | −1 | −1 | −1 | −1 | −0 | −0 | −0 | −0 | 0.08 | 0.07 | 0.07 | 0.04 | 0.03 | 0.04 | 0.01 | 0.01 | 0.01 | ||
| −4 | −4a | −5a | −1 | −2a | −2a | −1 | −1a | −2a | 0.08 | - | - | 0.04 | - | - | 0.02 | - | - | ||
| −6 | −2a | −3a | −2 | −1a | −2a | −1 | −1a | −1a | 0.10 | - | - | 0.04 | - | - | 0.01 | - | - | ||
| −4 | −4 | −2a | −1 | −1 | −1a | 0 | 0 | 1a | 0.17 | 0.14 | - | 0.08 | 0.06 | - | 0.02 | 0.02 | - | ||
| 10 | 4 | 5a | 3 | 2 | 2a | 1 | 1 | 2a | 0.17 | 0.13 | - | 0.07 | 0.05 | - | 0.02 | 0.02 | - | ||
Parameter generated as time-invariant but estimated as time-varying.
Note. Unless otherwise noted parameters were generated and estimated as time-invariant. Descriptions of sub-conditions A,B, and C provided in Table 1. Cells containing a single - were estimated as time-varying.
We also hypothesized the SR-SEKF would bring additional computational benefits when compared to the standard SEKF algorithm. To assess this we recorded the mean number of iterations and the percentage of converged datasets per condition for Simulation 1. These outcome measures can be found in Table 6. Consistent with general results in the KF literature, in aggregate the SR-SEKF required fewer iterations per condition and exhibited a modest increase in the percentage of converged datasets.
Table 6:
Comparison of Computational Efficiency and Convergence Rates for EKF Implementations
| Method |
|||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Second-Order EKF |
Square-Root Second-Order EKF |
||||||||||||||||||
| T = 70 |
T = 200 |
T = 500 |
T = 70 |
T = 200 |
T = 500 |
||||||||||||||
| Condition |
Condition |
Condition |
Condition |
Condition |
Condition |
||||||||||||||
| Measure | A | B | C | A | B | C | A | B | C | A | B | C | A | B | C | A | B | C | |
| Mean Number of Iterations | 63 | 57 | 54 | 40 | 41 | 41 | 30 | 26 | 27 | 57 | 58 | 61 | 40 | 36 | 35 | 27 | 24 | 26 | |
| % of Converged Datasets | 94 | 96 | 93 | 99 | 100 | 98 | 99 | 100 | 99 | 96 | 95 | 95 | 100 | 100 | 100 | 100 | 100 | 100 | |
5. An Empirical Example
We now present an empirical example based on Fredrickson et al. (2017) who examined the impact of meditation practice on the day-to-day emotional experiences of a nonclinical adult sample across an eleven week period. The first two weeks of the data collection period represented a baseline period, followed by six weeks where subjects were involved in a workshop to learn and integrate meditation practice into their daily lives. Following the termination of the intervention data was collected for an additional three weeks. A timeline of the typical intervention time course is given in Figure 3. Each evening participants recorded their experience of daily emotions using the modified Differential Emotions Scale (mDES) (Fredrickson, 2013). The mDES is a 20-item measure containing ten positive emotions and ten negative emotions. For completeness, the full mDES questionnaire is reproduced in the Appendix. For the purpose of our current study we included all 10 indicators for each of the emotion constructs.
Figure 3:
Example Time Course of Study
Although missing data can be handled well within the state space framework the implementation of the SEKF used here was not designed to handle missing data. For this reason we retained subjects with less than 5% missing data and imputed the missing values univariately using the predicted values from a single run of the Kalman Filter. This procedure left us with seven subjects on which to conduct our analysis. For each of these individuals we fit a two factor (positive and negative affect) nonlinear state space model where the autoregressive coefficients, cross-regressive coefficients and treatment effects were all allowed to vary across time. Starting values for each subject were obtained by estimating a time-invariant model using the pseudo-ML estimator. The binary exogenous input was used to indicate whether each timepoint occurred prior to or following the onset of the meditation intervention. Results for the dynamic parameters for each subjects are provided in Figure 4 where the vertical dashed lines indicate the onset of the intervention.
Figure 4:
Results for 7 Subjects
Note. Horizontal dashed line indicates the onset of the intervention. is positive affect and is negative affect.
In Figure 4 the first row gives the trajectory of positive () and negative affect () across the observation period. In this row we should see the impact of the intervention on the two constructs of interest. Large oscillations in and as in the negative affect of Subject 2 indicate periodic swings that may be related to weekly patterns such as a weekend effect. The second row illustrates the potentially time-varying trajectories of the autoregressive coefficients for positive and negative affect. The closer the autoregressive coefficient gets to unity the more persistent the series becomes, meaning the value of the series at its previous time point better and better predicts its current value. A negative autoregressive coefficient (as in Subject 3) indicates a type of oscillation where an observation is likely to be above average if its previous value was below average, and vice versa. The third row details the cross-regressive coefficients, or the lagged influence of negative affect on positive affect () and positive affect on negative affect (). Changes in these coefficient over time indicates increasing or decreasing influence of positive and negative affect on one another. Finally, row four provides time series for the continuing effects of the intervention on positive () and negative affect () across the observation period.
6. Discussion
In this paper we introduced a nonlinear state space model and associated estimation routines based on a square-root second-order Extended Kalman Filter (SR-SEKF). We demonstrated how the state vector of a linear state space model could be augmented to include arbitrarily time-varying parameters when little information about the parametric form of change is available. Through a series of simulation studies we showed that the described algorithm accurately recovers the unobserved states in the case of a bivariate dynamic factor model with time-varying dynamics. We found the point estimates for the time-invariant parameters to exhibit low levels of bias even for the shortest time series lengths of T = 70. For the case of two time-varying parameters we found that increasing the number of theoretically time-varying parameters in the estimated model has very little impact on the accuracy or variability of the estimated parameters. Furthermore, the smoothed estimates of the time-varying parameters themselves provide a reasonably accurate index of the true parameter variability for the models under study. Despite this performance one must always exercise caution when fitting nonlinear models to shorter time series lengths as real-world data is likely to contain more structural specifications than those considered in our synthetic data examples.
In addition to the novel insights gained though this work a number of limitations are also worth discussing. First and foremost we did not evaluate the standard errors generated as a by-product of the likelihood maximization described above. Theoretically, the observed or expected information matrices produced by this procedure could be used to assess the variability of the time-invariant parameter estimates. Alternative procedures for obtaining the standard errors, such as the nonparametric bootstrap, are available and future work should better examine these different options.
Furthermore, significance tests based on the estimated error variances arising from the tuning procedure could provide additional insight into whether a parameter is truly time-varying. Relatedly, we did not explore any post-hoc metrics for determining whether a parameter estimated as time-varying does in fact vary across time. Although it appears that the smoothed parameter estimates themselves and plots of the smoothed estimates across time does provide valuable insights on the time-varyingness of parameters, inferential tests could provide more sensitive diagnostics. Future work should also explore which methods or tests are best suited for determining whether a parameter varies meaningfully across time.
Second, in this paper we examined in some detail the case where multiple time-varying parameters were estimated, however, only a small subset of those estimated parameters were in fact time-varying. It is important to also explore the case where a great diversity and number of parameter types are simultaneously time-varying. This will likely introduce a number of complicating issues related to both model interpretation and parameter identification.
We also did not explore the important concept of stochastic observability for time-varying nonlinear state space models. Intuitively, a system is observable if one can infer its states from its output. More specifically, observability describes the possibility of inferring the current state from present and future measurements of the system. Kalman (1960a, 1960b) was the first to introduce the concept of observability for linear time-invariant systems, however, extensions to the nonlinear stochastic case are currently an active area of research. Tests for stochastic observability will likely provide novel insights into how many, and which types, of parameters can feasibly vary given a specific set of model constraints. Future work should better detail the implications of stochastic observability for the types of models most useful to psychological researchers.
Nonlinear state space models with time-varying parameters provide a natural modeling framework from which psychological researchers can characterize and test complex theories of psychological change. Although applied researchers are increasingly collecting the types of time series data (e.g. intensive longitudinal data) appropriate for this and similar modeling approaches there is still a dearth of practical information on how these methods perform in situations relevant to applied psychological researchers. In this vein we hope our exposition of time-varying parameter state space models and their estimation, along with our empirical evaluations, contribute to bridging this gap.
7. Appendix
Below we have reproduced the modified Differential Emotions Scale (mDES) from Fredrickson (2013, p. 45).
Instructions:
Please think back to how you have felt during the past 24 hours. Using the 0–4 scale below, indicate the greatest amount that you have experienced each of the following feelings where 0 = not at all; 1 = A little bit; 2 = Moderately, 3 = Quite a bit, and 4 = Extremely.
What is the most amused, fun-loving, or silly you felt?
What is the most angry, irritated, or annoyed you felt?
What is the most ashamed, humiliated, or disgraced you felt?
What is the most awe, wonder, or amazement you felt?
What is the most contemptuous, scornful, or disdainful you felt?
What is the most disgust, distaste, or revulsion you felt?
What is the most embarrassed, self-conscious, or blushing you felt?
What is the most grateful, appreciative, or thankful you felt?
What is the most guilty, repentant, or blameworthy you felt?
What is the most hate, distrust, or suspicion you felt?
What is the most hopeful, optimistic, or encouraged you felt?
What is the most inspired, uplifted, or elevated you felt?
What is the most interested, alert, or curious you felt?
What is the most joyful, glad, or happy you felt?
What is the most love, closeness, or trust you felt?
What is the most proud, confident, or self-assured you felt?
What is the most sad, downhearted, or unhappy you felt?
What is the most scared, fearful, or afraid you felt?
What is the most serene, content, or peaceful you felt?
What is the most stressed, nervous, or overwhelmed you felt?
Contributor Information
Zachary F. Fisher, Department of Psychology and Neuroscience, University of North Carolina at Chapel Hill
Sy-Miin Chow, Human Development and Family Studies, University of Pennsylvania.
Peter C. M. Molenaar, Human Development and Family Studies, University of Pennsylvania
Barbara L. Fredrickson, Human Development and Family Studies, University of Pennsylvania
Vladas Pipiras, Department of Statistics, University of North Carolina at Chapel Hill.
Kathleen M. Gates, Department of Psychology and Neuroscience, University of North Carolina at Chapel Hill
References
- Balke NS, & Fomby TB (1997). Threshold Cointegration. International Economic Review, 38(3), 627–645. [Google Scholar]
- Bar-Shalom Y, Kirubarajan T, & Li X-R (2002). Estimation with Applications to Tracking and Navigation. New York, NY, USA: John Wiley & Sons, Inc. [Google Scholar]
- Box GEP, & Jenkins GM (1976). Time series analysis: forecasting and control. Holden-Day. [Google Scholar]
- Bringmann LF, Ferrer E, Hamaker EL, Borsboom D, & Tuerlinckx F. (2018). Modeling Nonstationary Emotion Dynamics in Dyads using a Time-Varying Vector-Autoregressive Model. Multivariate Behavioral Research, 53(3), 293–314. [DOI] [PubMed] [Google Scholar]
- Browne MW, & Zhang G. (2007). Repeated Time Series Models for Learning Data. In Boker SM & Wenger MJ (Eds.), Data Analytic Techniques for Dynamical Systems (1edition ed.). Mahwah, NJ: Psychology Press. [Google Scholar]
- Caner M, & Hansen BE (2001). Threshold Autoregression with a Unit Root. Econometrica, 69(6), 1555–1596. [Google Scholar]
- Chandra KPB, & Gu D. (2019). Nonlinear Filtering: Methods and Applications. Springer International Publishing. [Google Scholar]
- Chow S-M, Ferrer E, & Nesselroade JR (2007). An Unscented Kalman Filter Approach to the Estimation of Nonlinear Dynamical Systems Models. Multivariate Behavioral Research, 42(2), 283–321. [DOI] [PubMed] [Google Scholar]
- Chow S-M, & Zhang G. (2013). Nonlinear Regime-Switching State-Space (RSSS) models. Psychometrika, 78(4), 740–768. [DOI] [PubMed] [Google Scholar]
- Chow S-M, Zu J, Shifren K, & Zhang G. (2011). Dynamic Factor Analysis Models With Time-Varying Parameters. Multivariate Behavioral Research, 46(2), 303–339.Retrieved from 10.1080/00273171.2011.563697 doi: 10.1080/00273171.2011.563697 [DOI] [PubMed] [Google Scholar]
- Cleveland WS (1979). Robust Locally Weighted Regression and Smoothing Scatterplots (Vol. 74) (No. 368). [Google Scholar]
- De Haan-Rietdijk S, Gottman JM, Bergeman CS, & Hamaker EL (2016). Get Over It! A Multilevel Threshold Autoregressive Model for State-Dependent Affect Regulation. Psychometrika, 81(1), 217–241. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Doll RJ, Veltink PH, & Buitenweg JR (2015). Observation of time-dependent psychophysical functions and accounting for threshold drifts. Attention, Perception, & Psychophysics, 77(4), 1440–1447. Retrieved 2019–11-15, from 10.3758/s13414-015-0865-x doi: 10.3758/s13414-015-0865-x [DOI] [PMC free article] [PubMed] [Google Scholar]
- Fredrickson BL (2013, January). Chapter One - Positive Emotions Broaden and Build. In Devine P. & Plant A(Eds.), Advances in Experimental Social Psychology (Vol. 47, pp. 1–53). Academic Press. doi: 10.1016/B978-0-12-407236-7.00001-2 [DOI] [Google Scholar]
- Fredrickson BL, Boulton AJ, Firestine AM, Van Cappellen P, Algoe SB, Brantley MM, ... Salzberg S. (2017). Positive Emotion Correlates of Meditation Practice: a Comparison of Mindfulness Meditation and Loving-Kindness Meditation. Mindfulness, 8(6), 1623–1633. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Fründ I, Haenel NV, & Wichmann FA (2011). Inference for psychometric functions in the presence of nonstationary behavior. Journal of Vision, 11(6). doi: 10.1167/11.6.16 [DOI] [PubMed] [Google Scholar]
- Fuller WA (2009). Measurement Error Models. John Wiley & Sons. [Google Scholar]
- Gelb A. (2001). Applied optimal estimation. Cambridge, Massachusetts: MIT Press. [Google Scholar]
- Grenander U, & Rosenblatt M. (1957). Statistical analysis of stationary time series. New York: Wiley. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Grewal MS, & Andrews AP (2001). Kalman filtering: theory and practice using MATLAB. New York: Wiley. [Google Scholar]
- Hamaker EL, Grasman RPPP, & Kamphuis JH (2010). Regime-switching models to study psychological processes. In Individual pathways of change: Statistical models for analyzing learning and development (pp. 155–168). Washington, DC, US: American Psychological Association. doi: 10.1037/12140-009 [DOI] [Google Scholar]
- Hamaker EL, Zhang Z, & van der Maas HLJ (2009). Using Threshold Autoregressive Models to Study Dyadic Interactions. Psychometrika, 74(4), 727. [Google Scholar]
- Hamilton JD (1989). A New Approach to the Economic Analysis of Nonstationary Time Series and the Business Cycle. Econometrica, 57(2), 357–384. [Google Scholar]
- Harvey AC (1990). Forecasting, Structural Time Series Models and the Kalman Filter. [Google Scholar]
- Haslbeck JMB, Bringmann LF, & Waldorp LJ (2019). A Tutorial on Estimating Time-Varying Vector Autoregressive Models. arXiv:1711.05204 [stat]. [DOI] [PubMed] [Google Scholar]
- Haslbeck JMB, & Waldorp LJ (2019). mgm: Estimating Time-Varying Mixed Graphical Models in High-Dimensional Data. arXiv:1510.06871 [stat]. (arXiv: 1510.06871) [Google Scholar]
- Havlicek M, Friston KJ, Jan J, Brazdil M, & Calhoun VD (2011, June). Dynamic modeling of neuronal responses in fMRI using cubature Kalman filtering. NeuroImage, 56(4), 2109–2128. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Hu L, Zhang ZG, & Hu Y. (2012, August). A time-varying source connectivity approach to reveal human somatosensory information processing. NeuroImage, 62(1), 217–228. [DOI] [PubMed] [Google Scholar]
- Jiang X-Q, & Kitagawa G. (1993). A time varying coefficient vector AR modeling of nonstationary covariance time series. Signal Processing, 33(3), 315–331. [Google Scholar]
- Kalman RE (1960a). Contributions to the theory of optimal control. Bboletin de la Sociedad Matematica Mexicana, 5, 102–119. [Google Scholar]
- Kalman RE (1960b). On the general theory of control systems. IFAC Proceedings Volumes, 1(1), 491–502. [Google Scholar]
- Koval P, & Kuppens P. (2012, April). Changing emotion dynamics: individual differences in the effect of anticipatory social stress on emotional inertia. Emotion, 12(2). [DOI] [PubMed] [Google Scholar]
- Magnus JR (1983). L-structured matrices and linear matrix equations. Linear and Multilinear Algebra, 14(1), 67–88. doi: 10.1080/03081088308817543 [DOI] [Google Scholar]
- Milde T, Leistritz L, Astolfi L, Miltner WHR, Weiss T, Babiloni F, & Witte H. (2010, April). A new Kalman filter approach for the estimation of high-dimensional time-variant multivariate AR models and its application in analysis of laser-evoked brain potentials. NeuroImage, 50(3). [DOI] [PubMed] [Google Scholar]
- Molenaar PCM (1994). Dynamic latent variable models in developmental psychology. In Latent variables analysis: Applications for developmental research (pp. 155–180). Thousand Oaks, CA, US: Sage Publications, Inc. [Google Scholar]
- Molenaar PCM (2017). Equivalent Dynamic Models. Multivariate Behavioral Research, 52(2), 242–258. [DOI] [PubMed] [Google Scholar]
- Molenaar PCM, Beltz AM, Gates KM, & Wilson SJ (2016). State space modeling of time-varying contemporaneous and lagged relations in connectivity maps. NeuroImage, 125, 791–802. doi: 10.1016/j.neuroimage.2015.10.088 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Molenaar PCM, De Gooijer JG, & Schmitz B. (1992). Dynamic factor analysis of nonstationary multivariate time series. Psychometrika, 57(3), 333–349. [Google Scholar]
- Molenaar PCM, & Nesselroade JR (2009, February). The Recoverability of P-technique Factor Analysis. Multivariate Behavioral Research, 44(1), 130–141. doi: 10.1080/00273170802620204 [DOI] [PubMed] [Google Scholar]
- Negro MD, & Otrok C. (2008). Dynamic factor models with time-varying parameters: measuring changes in international business cycles (Tech. Rep. No. 326). Federal Reserve Bank of New York. [Google Scholar]
- Pagan A. (1980). Some identification and estimation results for regression models with stochastically varying coefficients. Journal of Econometrics, 13(3), 341–363. [Google Scholar]
- Park P, & Kailath T. (1995). New square-root algorithms for Kalman filtering. IEEE Transactions on Automatic Control, 40(5). [Google Scholar]
- Patriota AG, Sato JR, & Blas Achic BG (2010, July). Vector autoregressive models with measurement errors for testing Granger causality. Statistical Methodology, 7(4), 478–497. [Google Scholar]
- Priestley MB (1988). Non-linear and non-stationary time series analysis. London: Academic Press. [Google Scholar]
- Raitoharju M, & Piché R. (2019). On Computational Complexity Reduction Methods for Kalman Filter Extensions. IEEE Aerospace and Electronic Systems Magazine, 34(10), 2–19. doi: 10.1109/MAES.2019.2927898 [DOI] [Google Scholar]
- Ruach HE, Tung F, & Striebel CT (1965). Maximum likelihood estimates of linear dynamic systems. AIAA Journal, 3(8), 1445–1450. Retrieved 2019–10-21, from 10.2514/3.3166 doi: 10.2514/3.3166 [DOI] [Google Scholar]
- Schneider R, & Georgakis C. (2013). How To NOT Make the Extended Kalman Filter Fail. Industrial & Engineering Chemistry Research, 52(9), 3354–3362. Retrieved 2019–10-27, from 10.1021/ie300415d doi: 10.1021/ie300415d [DOI] [Google Scholar]
- Staudenmayer J, & Buonaccorsi JP (2005). Measurement Error in Linear Autoregressive Models. Journal of the American Statistical Association, 100(471), 841–852. [Google Scholar]
- Stock J, & Watson MW (2009). Forecasting in dynamic factor models subject to structural instability. Oxford University Press. [Google Scholar]
- Tong H, & Lim KS (1980). Threshold Autoregression, Limit Cycles and Cyclical Data. Journal of the Royal Statistical Society: Series B (Methodological), 42(3), 245–268. [Google Scholar]
- Weiss AA (1985). The Stability of the Ar(1) Process with an Ar(1) Coefficient. Journal of Time Series Analysis, 6(3), 181–186. [Google Scholar]
- Yang M, & Chow S-M (2010). Using State-Space Model with Regime Switching to Represent the Dynamics of Facial Electromyography (EMG) Data. Psychometrika, 75(4), 744–771. [Google Scholar]




