The measurement model is given by \[\begin{equation}
\mathbf{y}_{i, t}
=
\boldsymbol{\nu}
+
\boldsymbol{\Lambda}
\boldsymbol{\eta}_{i, t}
+
\boldsymbol{\varepsilon}_{i, t},
\quad
\mathrm{with}
\quad
\boldsymbol{\varepsilon}_{i, t}
\sim
\mathcal{N}
\left(
\mathbf{0},
\boldsymbol{\Theta}
\right)
\end{equation}\] where \(\mathbf{y}_{i, t}\), \(\boldsymbol{\eta}_{i, t}\), and \(\boldsymbol{\varepsilon}_{i, t}\) are random variables and \(\boldsymbol{\nu}\), \(\boldsymbol{\Lambda}\), and \(\boldsymbol{\Theta}\) are model parameters. \(\mathbf{y}_{i, t}\) represents a vector of observed random variables, \(\boldsymbol{\eta}_{i, t}\) a vector of latent random variables, and \(\boldsymbol{\varepsilon}_{i, t}\) a vector of random measurement errors, at time \(t\) and individual \(i\). \(\boldsymbol{\nu}\) denotes a vector of intercepts, \(\boldsymbol{\Lambda}\) a matrix of factor loadings, and \(\boldsymbol{\Theta}\) the covariance matrix of \(\boldsymbol{\varepsilon}\).
An alternative representation of the measurement error is given by \[\begin{equation}
\boldsymbol{\varepsilon}_{i, t}
=
\boldsymbol{\Theta}^{\frac{1}{2}}
\mathbf{z}_{i, t},
\quad
\mathrm{with}
\quad
\mathbf{z}_{i, t}
\sim
\mathcal{N}
\left(
\mathbf{0},
\mathbf{I}
\right)
\end{equation}\] where \(\mathbf{z}_{i, t}\) is a vector of independent standard normal random variables and \(\left( \boldsymbol{\Theta}^{\frac{1}{2}} \right) \left( \boldsymbol{\Theta}^{\frac{1}{2}} \right)^{\prime} = \boldsymbol{\Theta}\) .
The dynamic structure is given by \[\begin{equation}
\mathrm{d} \boldsymbol{\eta}_{i, t}
=
\boldsymbol{\Phi}
\left(
\boldsymbol{\eta}_{i, t}
-
\boldsymbol{\mu}
\right)
\mathrm{d}t
+
\boldsymbol{\Sigma}^{\frac{1}{2}}
\mathrm{d}
\mathbf{W}_{i, t}
\end{equation}\] where \(\boldsymbol{\mu}\) is the long-term mean or equilibrium level, \(\boldsymbol{\Phi}\) is the rate of mean reversion, determining how quickly the variable returns to its mean, \(\boldsymbol{\Sigma}\) is the matrix of volatility or randomness in the process, and \(\mathrm{d}\boldsymbol{W}\) is a Wiener process or Brownian motion, which represents random fluctuations.
Data Generation
Notation
Let \(t = 1000\) be the number of time points and \(n = 5\) be the number of individuals.
Let the measurement model intecept vector \(\boldsymbol{\nu}\) be given by
Visualizing the Dynamics Without Measurement Error and Process Noise (n = 5 with Different Initial Condition)
Using the SimSSMOUFixed Function from the simStateSpace Package to Simulate Data
library(simStateSpace)sim<-SimSSMOUFixed( n =n, time =time, delta_t =delta_t, mu0 =mu0, sigma0_l =sigma0_l, mu =mu, phi =phi, sigma_l =sigma_l, nu =nu, lambda =lambda, theta_l =theta_l, type =0)data<-as.data.frame(sim)head(data)
id time y1 y2
Min. :1 Min. : 0.00 Min. :-2.25375 Min. :-2.75152
1st Qu.:2 1st Qu.:24.98 1st Qu.:-0.41569 1st Qu.:-0.47639
Median :3 Median :49.95 Median : 0.04509 Median : 0.08626
Mean :3 Mean :49.95 Mean : 0.03947 Mean : 0.05358
3rd Qu.:4 3rd Qu.:74.92 3rd Qu.: 0.50782 3rd Qu.: 0.61048
Max. :5 Max. :99.90 Max. : 2.74461 Max. : 3.02675
y3
Min. :-2.34092
1st Qu.:-0.44476
Median : 0.02716
Mean : 0.01476
3rd Qu.: 0.48321
Max. : 2.34972