Parametric Bootstrap for the State Space Model (Fixed Parameters)
Source:R/bootStateSpace-pb-ssm-fixed.R
PBSSMFixed.Rd
This function simulates data from
a state-space model
and fits the model using the dynr
package.
The process is repeated R
times.
It assumes that the parameters remain constant
across individuals and over time.
At the moment, the function only supports
type = 0
.
Usage
PBSSMFixed(
R,
path,
prefix,
n,
time,
delta_t = 1,
mu0,
sigma0_l,
alpha,
beta,
psi_l,
nu,
lambda,
theta_l,
type = 0,
x = NULL,
gamma = NULL,
kappa = NULL,
mu0_fixed = FALSE,
sigma0_fixed = FALSE,
alpha_level = 0.05,
optimization_flag = TRUE,
hessian_flag = FALSE,
verbose = FALSE,
weight_flag = FALSE,
debug_flag = FALSE,
perturb_flag = FALSE,
xtol_rel = 1e-07,
stopval = -9999,
ftol_rel = -1,
ftol_abs = -1,
maxeval = as.integer(-1),
maxtime = -1,
ncores = NULL,
seed = NULL
)
Arguments
- R
Positive integer. Number of bootstrap samples.
- path
Path to a directory to store bootstrap samples and estimates.
- prefix
Character string. Prefix used for the file names for the bootstrap samples and estimates.
- n
Positive integer. Number of individuals.
- time
Positive integer. Number of time points.
- delta_t
Numeric. Time interval. The default value is
1.0
with an option to use a numeric value for the discretized state space model parameterization of the linear stochastic differential equation model.- mu0
Numeric vector. Mean of initial latent variable values (\(\boldsymbol{\mu}_{\boldsymbol{\eta} \mid 0}\)).
- sigma0_l
Numeric matrix. Cholesky factorization (
t(chol(sigma0))
) of the covariance matrix of initial latent variable values (\(\boldsymbol{\Sigma}_{\boldsymbol{\eta} \mid 0}\)).- alpha
Numeric vector. Vector of constant values for the dynamic model (\(\boldsymbol{\alpha}\)).
- beta
Numeric matrix. Transition matrix relating the values of the latent variables at the previous to the current time point (\(\boldsymbol{\beta}\)).
- psi_l
Numeric matrix. Cholesky factorization (
t(chol(psi))
) of the covariance matrix of the process noise (\(\boldsymbol{\Psi}\)).- nu
Numeric vector. Vector of intercept values for the measurement model (\(\boldsymbol{\nu}\)).
- lambda
Numeric matrix. Factor loading matrix linking the latent variables to the observed variables (\(\boldsymbol{\Lambda}\)).
- theta_l
Numeric matrix. Cholesky factorization (
t(chol(theta))
) of the covariance matrix of the measurement error (\(\boldsymbol{\Theta}\)).- type
Integer. State space model type. See Details for more information.
- x
List. Each element of the list is a matrix of covariates for each individual
i
inn
. The number of columns in each matrix should be equal totime
.- gamma
Numeric matrix. Matrix linking the covariates to the latent variables at current time point (\(\boldsymbol{\Gamma}\)).
- kappa
Numeric matrix. Matrix linking the covariates to the observed variables at current time point (\(\boldsymbol{\kappa}\)).
- mu0_fixed
Logical. If
mu0_fixed = TRUE
, fix the initial mean vector tomu0
. Ifmu0_fixed = FALSE
,mu0
is estimated.- sigma0_fixed
Logical. If
sigma0_fixed = TRUE
, fix the initial covariance matrix totcrossprod(sigma0_l)
. Ifsigma0_fixed = FALSE
,sigma0
is estimated.- alpha_level
Numeric vector. Significance level \(\alpha\).
- optimization_flag
a flag (TRUE/FALSE) indicating whether optimization is to be done.
- hessian_flag
a flag (TRUE/FALSE) indicating whether the Hessian matrix is to be calculated.
- verbose
a flag (TRUE/FALSE) indicating whether more detailed intermediate output during the estimation process should be printed
- weight_flag
a flag (TRUE/FALSE) indicating whether the negative log likelihood function should be weighted by the length of the time series for each individual
- debug_flag
a flag (TRUE/FALSE) indicating whether users want additional dynr output that can be used for diagnostic purposes
- perturb_flag
a flag (TRUE/FLASE) indicating whether to perturb the latent states during estimation. Only useful for ensemble forecasting.
- xtol_rel
Stopping criteria option for parameter optimization. See
dynr::dynr.model()
for more details.- stopval
Stopping criteria option for parameter optimization. See
dynr::dynr.model()
for more details.- ftol_rel
Stopping criteria option for parameter optimization. See
dynr::dynr.model()
for more details.- ftol_abs
Stopping criteria option for parameter optimization. See
dynr::dynr.model()
for more details.- maxeval
Stopping criteria option for parameter optimization. See
dynr::dynr.model()
for more details.- maxtime
Stopping criteria option for parameter optimization. See
dynr::dynr.model()
for more details.- ncores
Positive integer. Number of cores to use. If
ncores = NULL
, use a single core. Consider using multiple cores when number of bootstrap samplesR
is a large value.- seed
Random seed.
Value
Returns an object
of class bootstatespace
which is a list with the following elements:
- call
Function call.
- args
Function arguments.
- thetahatstar
Sampling distribution of \(\boldsymbol{\hat{\theta}}\).
- vcov
Sampling variance-covariance matrix of \(\boldsymbol{\hat{\theta}}\).
- est
Vector of estimated \(\boldsymbol{\hat{\theta}}\).
- fun
Function used ("PBSSMFixed").
- method
Bootstrap method used ("parametric").
Details
Type 0
The measurement model is given by $$ \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) $$ 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 $$ \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) $$ 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 $$ \boldsymbol{\eta}_{i, t} = \boldsymbol{\alpha} + \boldsymbol{\beta} \boldsymbol{\eta}_{i, t - 1} + \boldsymbol{\zeta}_{i, t}, \quad \mathrm{with} \quad \boldsymbol{\zeta}_{i, t} \sim \mathcal{N} \left( \mathbf{0}, \boldsymbol{\Psi} \right) $$ where \(\boldsymbol{\eta}_{i, t}\), \(\boldsymbol{\eta}_{i, t - 1}\), and \(\boldsymbol{\zeta}_{i, t}\) are random variables, and \(\boldsymbol{\alpha}\), \(\boldsymbol{\beta}\), and \(\boldsymbol{\Psi}\) are model parameters. Here, \(\boldsymbol{\eta}_{i, t}\) is a vector of latent variables at time \(t\) and individual \(i\), \(\boldsymbol{\eta}_{i, t - 1}\) represents a vector of latent variables at time \(t - 1\) and individual \(i\), and \(\boldsymbol{\zeta}_{i, t}\) represents a vector of dynamic noise at time \(t\) and individual \(i\). \(\boldsymbol{\alpha}\) denotes a vector of intercepts, \(\boldsymbol{\beta}\) a matrix of autoregression and cross regression coefficients, and \(\boldsymbol{\Psi}\) the covariance matrix of \(\boldsymbol{\zeta}_{i, t}\).
An alternative representation of the dynamic noise is given by $$ \boldsymbol{\zeta}_{i, t} = \boldsymbol{\Psi}^{\frac{1}{2}} \mathbf{z}_{i, t}, \quad \mathrm{with} \quad \mathbf{z}_{i, t} \sim \mathcal{N} \left( \mathbf{0}, \mathbf{I} \right) $$ where \( \left( \boldsymbol{\Psi}^{\frac{1}{2}} \right) \left( \boldsymbol{\Psi}^{\frac{1}{2}} \right)^{\prime} = \boldsymbol{\Psi} . \)
Type 1
The measurement model is given by $$ \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) . $$
The dynamic structure is given by $$ \boldsymbol{\eta}_{i, t} = \boldsymbol{\alpha} + \boldsymbol{\beta} \boldsymbol{\eta}_{i, t - 1} + \boldsymbol{\Gamma} \mathbf{x}_{i, t} + \boldsymbol{\zeta}_{i, t}, \quad \mathrm{with} \quad \boldsymbol{\zeta}_{i, t} \sim \mathcal{N} \left( \mathbf{0}, \boldsymbol{\Psi} \right) $$ where \(\mathbf{x}_{i, t}\) represents a vector of covariates at time \(t\) and individual \(i\), and \(\boldsymbol{\Gamma}\) the coefficient matrix linking the covariates to the latent variables.
Type 2
The measurement model is given by $$ \mathbf{y}_{i, t} = \boldsymbol{\nu} + \boldsymbol{\Lambda} \boldsymbol{\eta}_{i, t} + \boldsymbol{\kappa} \mathbf{x}_{i, t} + \boldsymbol{\varepsilon}_{i, t}, \quad \mathrm{with} \quad \boldsymbol{\varepsilon}_{i, t} \sim \mathcal{N} \left( \mathbf{0}, \boldsymbol{\Theta} \right) $$ where \(\boldsymbol{\kappa}\) represents the coefficient matrix linking the covariates to the observed variables.
The dynamic structure is given by $$ \boldsymbol{\eta}_{i, t} = \boldsymbol{\alpha} + \boldsymbol{\beta} \boldsymbol{\eta}_{i, t - 1} + \boldsymbol{\Gamma} \mathbf{x}_{i, t} + \boldsymbol{\zeta}_{i, t}, \quad \mathrm{with} \quad \boldsymbol{\zeta}_{i, t} \sim \mathcal{N} \left( \mathbf{0}, \boldsymbol{\Psi} \right) . $$
References
Chow, S.-M., Ho, M. R., Hamaker, E. L., & Dolan, C. V. (2010). Equivalence and differences between structural equation modeling and state-space modeling techniques. Structural Equation Modeling: A Multidisciplinary Journal, 17(2), 303–332. doi:10.1080/10705511003661553
See also
Other Bootstrap for State Space Models Functions:
PBSSMLinSDEFixed()
,
PBSSMOUFixed()
,
PBSSMVARFixed()
Examples
# \donttest{
# prepare parameters
set.seed(42)
## number of individuals
n <- 5
## time points
time <- 50
delta_t <- 1
## dynamic structure
p <- 3
mu0 <- rep(x = 0, times = p)
sigma0 <- 0.001 * diag(p)
sigma0_l <- t(chol(sigma0))
alpha <- rep(x = 0, times = p)
beta <- 0.50 * diag(p)
psi <- 0.001 * diag(p)
psi_l <- t(chol(psi))
## measurement model
k <- 3
nu <- rep(x = 0, times = k)
lambda <- diag(k)
theta <- 0.001 * diag(k)
theta_l <- t(chol(theta))
path <- tempdir()
pb <- PBSSMFixed(
R = 10L, # use at least 1000 in actual research
path = path,
prefix = "ssm",
n = n,
time = time,
delta_t = delta_t,
mu0 = mu0,
sigma0_l = sigma0_l,
alpha = alpha,
beta = beta,
psi_l = psi_l,
nu = nu,
lambda = lambda,
theta_l = theta_l,
type = 0,
ncores = 1, # consider using multiple cores
seed = 42
)
print(pb)
#> Call:
#> PBSSMFixed(R = 10L, path = path, prefix = "ssm", n = n, time = time,
#> delta_t = delta_t, mu0 = mu0, sigma0_l = sigma0_l, alpha = alpha,
#> beta = beta, psi_l = psi_l, nu = nu, lambda = lambda, theta_l = theta_l,
#> type = 0, ncores = 1, seed = 42)
#>
#> Parametric bootstrap confidence intervals.
#> type = "pc"
#> est se R 2.5% 97.5%
#> beta_1_1 0.500 0.2556 10 0.1627 0.9432
#> beta_2_1 0.000 0.1011 10 -0.1649 0.1286
#> beta_3_1 0.000 0.1535 10 -0.2590 0.2353
#> beta_1_2 0.000 0.1033 10 -0.2115 0.0959
#> beta_2_2 0.500 0.1432 10 0.3345 0.7640
#> beta_3_2 0.000 0.0693 10 -0.1540 0.0468
#> beta_1_3 0.000 0.1674 10 -0.4192 0.0627
#> beta_2_3 0.000 0.0980 10 -0.1156 0.1599
#> beta_3_3 0.500 0.2063 10 0.2255 0.7774
#> psi_1_1 0.001 0.0007 10 0.0001 0.0021
#> psi_2_2 0.001 0.0006 10 0.0002 0.0020
#> psi_3_3 0.001 0.0008 10 0.0002 0.0021
#> theta_1_1 0.001 0.0005 10 0.0000 0.0016
#> theta_2_2 0.001 0.0004 10 0.0001 0.0015
#> theta_3_3 0.001 0.0007 10 0.0000 0.0017
#> mu0_1_1 0.000 0.0215 10 -0.0357 0.0194
#> mu0_2_1 0.000 0.0158 10 -0.0217 0.0178
#> mu0_3_1 0.000 0.0195 10 -0.0176 0.0381
#> sigma0_1_1 0.001 0.0007 10 0.0000 0.0018
#> sigma0_2_2 0.001 0.0022 10 0.0000 0.0061
#> sigma0_3_3 0.001 0.0017 10 0.0000 0.0044
summary(pb)
#> Call:
#> PBSSMFixed(R = 10L, path = path, prefix = "ssm", n = n, time = time,
#> delta_t = delta_t, mu0 = mu0, sigma0_l = sigma0_l, alpha = alpha,
#> beta = beta, psi_l = psi_l, nu = nu, lambda = lambda, theta_l = theta_l,
#> type = 0, ncores = 1, seed = 42)
#> est se R 2.5% 97.5%
#> beta_1_1 0.500 0.2556 10 0.1627 0.9432
#> beta_2_1 0.000 0.1011 10 -0.1649 0.1286
#> beta_3_1 0.000 0.1535 10 -0.2590 0.2353
#> beta_1_2 0.000 0.1033 10 -0.2115 0.0959
#> beta_2_2 0.500 0.1432 10 0.3345 0.7640
#> beta_3_2 0.000 0.0693 10 -0.1540 0.0468
#> beta_1_3 0.000 0.1674 10 -0.4192 0.0627
#> beta_2_3 0.000 0.0980 10 -0.1156 0.1599
#> beta_3_3 0.500 0.2063 10 0.2255 0.7774
#> psi_1_1 0.001 0.0007 10 0.0001 0.0021
#> psi_2_2 0.001 0.0006 10 0.0002 0.0020
#> psi_3_3 0.001 0.0008 10 0.0002 0.0021
#> theta_1_1 0.001 0.0005 10 0.0000 0.0016
#> theta_2_2 0.001 0.0004 10 0.0001 0.0015
#> theta_3_3 0.001 0.0007 10 0.0000 0.0017
#> mu0_1_1 0.000 0.0215 10 -0.0357 0.0194
#> mu0_2_1 0.000 0.0158 10 -0.0217 0.0178
#> mu0_3_1 0.000 0.0195 10 -0.0176 0.0381
#> sigma0_1_1 0.001 0.0007 10 0.0000 0.0018
#> sigma0_2_2 0.001 0.0022 10 0.0000 0.0061
#> sigma0_3_3 0.001 0.0017 10 0.0000 0.0044
confint(pb)
#> 2.5 % 97.5 %
#> beta_1_1 1.626566e-01 0.943187625
#> beta_2_1 -1.649366e-01 0.128602513
#> beta_3_1 -2.590191e-01 0.235339527
#> beta_1_2 -2.115189e-01 0.095917751
#> beta_2_2 3.344581e-01 0.764011522
#> beta_3_2 -1.539633e-01 0.046832519
#> beta_1_3 -4.192253e-01 0.062713408
#> beta_2_3 -1.155608e-01 0.159944872
#> beta_3_3 2.254559e-01 0.777431680
#> psi_1_1 9.826323e-05 0.002141036
#> psi_2_2 2.209297e-04 0.002044133
#> psi_3_3 1.776410e-04 0.002123510
#> theta_1_1 3.124256e-12 0.001573813
#> theta_2_2 1.272953e-04 0.001472064
#> theta_3_3 2.516683e-12 0.001725308
#> mu0_1_1 -3.570665e-02 0.019411810
#> mu0_2_1 -2.165274e-02 0.017832927
#> mu0_3_1 -1.755279e-02 0.038134516
#> sigma0_1_1 2.884978e-13 0.001846362
#> sigma0_2_2 3.379446e-21 0.006122529
#> sigma0_3_3 6.439289e-14 0.004418048
vcov(pb)
#> beta_1_1 beta_2_1 beta_3_1 beta_1_2
#> beta_1_1 6.533223e-02 -4.892502e-03 4.434204e-04 2.584880e-03
#> beta_2_1 -4.892502e-03 1.022457e-02 -1.285054e-02 -2.874452e-03
#> beta_3_1 4.434204e-04 -1.285054e-02 2.357017e-02 3.462465e-03
#> beta_1_2 2.584880e-03 -2.874452e-03 3.462465e-03 1.068070e-02
#> beta_2_2 -1.917220e-03 6.318208e-03 -7.631873e-03 -1.063096e-02
#> beta_3_2 -9.238484e-04 9.573481e-04 -2.282590e-03 -9.384263e-04
#> beta_1_3 -1.631705e-02 6.876483e-03 -1.129819e-02 9.816551e-04
#> beta_2_3 1.380578e-02 -1.618225e-04 -1.499778e-03 2.305538e-03
#> beta_3_3 5.333069e-03 -3.993522e-03 3.349283e-03 7.611216e-03
#> psi_1_1 -1.695797e-04 6.795878e-06 5.856309e-06 -5.605841e-06
#> psi_2_2 1.064620e-05 -2.040384e-05 2.746069e-05 4.240714e-05
#> psi_3_3 -7.632148e-05 1.718862e-05 -1.434953e-05 -1.271601e-05
#> theta_1_1 1.321908e-04 -9.522526e-06 -5.320303e-06 2.583021e-06
#> theta_2_2 -1.787805e-05 1.247195e-05 -1.087854e-05 -2.869378e-05
#> theta_3_3 9.768817e-05 -1.801930e-05 1.100342e-05 1.457112e-05
#> mu0_1_1 3.074668e-03 -9.919380e-04 3.518734e-04 9.576441e-04
#> mu0_2_1 -2.537954e-03 2.203528e-04 5.306683e-05 -5.500862e-05
#> mu0_3_1 -2.678580e-03 5.422391e-04 1.229654e-05 -2.839870e-04
#> sigma0_1_1 -5.707850e-05 2.478245e-05 -5.533134e-06 -4.066630e-05
#> sigma0_2_2 -2.840790e-04 -3.243701e-07 2.506603e-05 -1.449269e-04
#> sigma0_3_3 -1.784925e-04 -6.746114e-05 5.641729e-05 3.581213e-05
#> beta_2_2 beta_3_2 beta_1_3 beta_2_3
#> beta_1_1 -1.917220e-03 -9.238484e-04 -1.631705e-02 1.380578e-02
#> beta_2_1 6.318208e-03 9.573481e-04 6.876483e-03 -1.618225e-04
#> beta_3_1 -7.631873e-03 -2.282590e-03 -1.129819e-02 -1.499778e-03
#> beta_1_2 -1.063096e-02 -9.384263e-04 9.816551e-04 2.305538e-03
#> beta_2_2 2.051400e-02 3.027703e-03 1.158091e-02 -4.152647e-03
#> beta_3_2 3.027703e-03 4.799100e-03 8.838937e-04 1.252695e-03
#> beta_1_3 1.158091e-02 8.838937e-04 2.801958e-02 -5.241715e-03
#> beta_2_3 -4.152647e-03 1.252695e-03 -5.241715e-03 9.600205e-03
#> beta_3_3 -2.080218e-02 9.603971e-04 -1.757538e-02 1.564136e-02
#> psi_1_1 1.144514e-06 -7.120163e-07 3.805336e-05 -3.420922e-05
#> psi_2_2 -7.150714e-05 -7.577085e-06 -4.660790e-05 2.162676e-05
#> psi_3_3 6.620606e-05 -1.789972e-06 8.938601e-05 -6.430443e-05
#> theta_1_1 2.703048e-06 -5.206255e-06 -2.263280e-05 2.019187e-05
#> theta_2_2 4.849494e-05 2.280593e-06 3.292302e-05 -2.020231e-05
#> theta_3_3 -5.853384e-05 3.885636e-07 -7.965013e-05 5.941341e-05
#> mu0_1_1 -1.726918e-03 -1.489813e-04 -1.293152e-03 1.005562e-03
#> mu0_2_1 1.433180e-05 5.677906e-04 1.301728e-04 -2.170207e-04
#> mu0_3_1 1.090520e-03 1.800958e-04 1.583044e-03 -2.040271e-04
#> sigma0_1_1 4.705749e-05 -3.094374e-07 9.229273e-06 5.862384e-06
#> sigma0_2_2 1.774061e-04 1.654498e-05 1.072799e-04 -5.391496e-05
#> sigma0_3_3 -8.726443e-05 -2.769356e-05 1.710784e-05 -1.031826e-04
#> beta_3_3 psi_1_1 psi_2_2 psi_3_3
#> beta_1_1 5.333069e-03 -1.695797e-04 1.064620e-05 -7.632148e-05
#> beta_2_1 -3.993522e-03 6.795878e-06 -2.040384e-05 1.718862e-05
#> beta_3_1 3.349283e-03 5.856309e-06 2.746069e-05 -1.434953e-05
#> beta_1_2 7.611216e-03 -5.605841e-06 4.240714e-05 -1.271601e-05
#> beta_2_2 -2.080218e-02 1.144514e-06 -7.150714e-05 6.620606e-05
#> beta_3_2 9.603971e-04 -7.120163e-07 -7.577085e-06 -1.789972e-06
#> beta_1_3 -1.757538e-02 3.805336e-05 -4.660790e-05 8.938601e-05
#> beta_2_3 1.564136e-02 -3.420922e-05 2.162676e-05 -6.430443e-05
#> beta_3_3 4.257860e-02 -7.173644e-06 8.382611e-05 -1.501124e-04
#> psi_1_1 -7.173644e-06 4.604387e-07 1.296426e-09 1.665908e-07
#> psi_2_2 8.382611e-05 1.296426e-09 3.109041e-07 -2.567570e-07
#> psi_3_3 -1.501124e-04 1.665908e-07 -2.567570e-07 6.310119e-07
#> theta_1_1 -8.598973e-06 -3.462260e-07 -1.215671e-08 -7.923548e-08
#> theta_2_2 -6.431497e-05 1.828432e-08 -2.187735e-07 2.179041e-07
#> theta_3_3 1.259605e-04 -2.304052e-07 2.214667e-07 -5.509069e-07
#> mu0_1_1 2.005304e-03 -8.472259e-06 5.501769e-06 -7.383944e-06
#> mu0_2_1 5.446704e-04 7.097892e-06 8.860079e-07 -6.600987e-07
#> mu0_3_1 -4.826952e-04 7.957369e-06 -2.552742e-06 3.129514e-06
#> sigma0_1_1 1.618549e-06 1.271673e-07 -1.354422e-07 3.695267e-08
#> sigma0_2_2 -1.032026e-04 7.445604e-07 -6.673824e-07 5.215311e-07
#> sigma0_3_3 -6.184073e-05 5.331454e-07 1.464423e-07 3.221839e-07
#> theta_1_1 theta_2_2 theta_3_3 mu0_1_1
#> beta_1_1 1.321908e-04 -1.787805e-05 9.768817e-05 3.074668e-03
#> beta_2_1 -9.522526e-06 1.247195e-05 -1.801930e-05 -9.919380e-04
#> beta_3_1 -5.320303e-06 -1.087854e-05 1.100342e-05 3.518734e-04
#> beta_1_2 2.583021e-06 -2.869378e-05 1.457112e-05 9.576441e-04
#> beta_2_2 2.703048e-06 4.849494e-05 -5.853384e-05 -1.726918e-03
#> beta_3_2 -5.206255e-06 2.280593e-06 3.885636e-07 -1.489813e-04
#> beta_1_3 -2.263280e-05 3.292302e-05 -7.965013e-05 -1.293152e-03
#> beta_2_3 2.019187e-05 -2.020231e-05 5.941341e-05 1.005562e-03
#> beta_3_3 -8.598973e-06 -6.431497e-05 1.259605e-04 2.005304e-03
#> psi_1_1 -3.462260e-07 1.828432e-08 -2.304052e-07 -8.472259e-06
#> psi_2_2 -1.215671e-08 -2.187735e-07 2.214667e-07 5.501769e-06
#> psi_3_3 -7.923548e-08 2.179041e-07 -5.509069e-07 -7.383944e-06
#> theta_1_1 2.876069e-07 -8.989565e-09 1.403556e-07 6.688178e-06
#> theta_2_2 -8.989565e-09 1.698276e-07 -1.902346e-07 -3.628896e-06
#> theta_3_3 1.403556e-07 -1.902346e-07 5.010858e-07 8.485310e-06
#> mu0_1_1 6.688178e-06 -3.628896e-06 8.485310e-06 4.636515e-04
#> mu0_2_1 -6.406365e-06 -1.208342e-06 -1.196712e-06 -2.147625e-04
#> mu0_3_1 -6.377624e-06 1.406503e-06 -4.629364e-06 -3.445786e-04
#> sigma0_1_1 -1.246015e-07 1.368014e-07 -7.740760e-08 -4.132591e-06
#> sigma0_2_2 -5.198438e-07 5.460939e-07 -6.070267e-07 -1.697032e-05
#> sigma0_3_3 -2.871752e-07 -1.081965e-07 -3.207816e-07 -2.813377e-06
#> mu0_2_1 mu0_3_1 sigma0_1_1 sigma0_2_2
#> beta_1_1 -2.537954e-03 -2.678580e-03 -5.707850e-05 -2.840790e-04
#> beta_2_1 2.203528e-04 5.422391e-04 2.478245e-05 -3.243701e-07
#> beta_3_1 5.306683e-05 1.229654e-05 -5.533134e-06 2.506603e-05
#> beta_1_2 -5.500862e-05 -2.839870e-04 -4.066630e-05 -1.449269e-04
#> beta_2_2 1.433180e-05 1.090520e-03 4.705749e-05 1.774061e-04
#> beta_3_2 5.677906e-04 1.800958e-04 -3.094374e-07 1.654498e-05
#> beta_1_3 1.301728e-04 1.583044e-03 9.229273e-06 1.072799e-04
#> beta_2_3 -2.170207e-04 -2.040271e-04 5.862384e-06 -5.391496e-05
#> beta_3_3 5.446704e-04 -4.826952e-04 1.618549e-06 -1.032026e-04
#> psi_1_1 7.097892e-06 7.957369e-06 1.271673e-07 7.445604e-07
#> psi_2_2 8.860079e-07 -2.552742e-06 -1.354422e-07 -6.673824e-07
#> psi_3_3 -6.600987e-07 3.129514e-06 3.695267e-08 5.215311e-07
#> theta_1_1 -6.406365e-06 -6.377624e-06 -1.246015e-07 -5.198438e-07
#> theta_2_2 -1.208342e-06 1.406503e-06 1.368014e-07 5.460939e-07
#> theta_3_3 -1.196712e-06 -4.629364e-06 -7.740760e-08 -6.070267e-07
#> mu0_1_1 -2.147625e-04 -3.445786e-04 -4.132591e-06 -1.697032e-05
#> mu0_2_1 2.500344e-04 1.978200e-04 -5.841757e-07 4.433364e-06
#> mu0_3_1 1.978200e-04 3.792046e-04 4.564303e-06 1.815494e-05
#> sigma0_1_1 -5.841757e-07 4.564303e-06 5.591436e-07 1.204200e-06
#> sigma0_2_2 4.433364e-06 1.815494e-05 1.204200e-06 4.685236e-06
#> sigma0_3_3 7.156246e-06 -2.122177e-06 -8.071715e-07 -5.062892e-07
#> sigma0_3_3
#> beta_1_1 -1.784925e-04
#> beta_2_1 -6.746114e-05
#> beta_3_1 5.641729e-05
#> beta_1_2 3.581213e-05
#> beta_2_2 -8.726443e-05
#> beta_3_2 -2.769356e-05
#> beta_1_3 1.710784e-05
#> beta_2_3 -1.031826e-04
#> beta_3_3 -6.184073e-05
#> psi_1_1 5.331454e-07
#> psi_2_2 1.464423e-07
#> psi_3_3 3.221839e-07
#> theta_1_1 -2.871752e-07
#> theta_2_2 -1.081965e-07
#> theta_3_3 -3.207816e-07
#> mu0_1_1 -2.813377e-06
#> mu0_2_1 7.156246e-06
#> mu0_3_1 -2.122177e-06
#> sigma0_1_1 -8.071715e-07
#> sigma0_2_2 -5.062892e-07
#> sigma0_3_3 2.937108e-06
coef(pb)
#> beta_1_1 beta_2_1 beta_3_1 beta_1_2 beta_2_2 beta_3_2 beta_1_3
#> 0.500 0.000 0.000 0.000 0.500 0.000 0.000
#> beta_2_3 beta_3_3 psi_1_1 psi_2_2 psi_3_3 theta_1_1 theta_2_2
#> 0.000 0.500 0.001 0.001 0.001 0.001 0.001
#> theta_3_3 mu0_1_1 mu0_2_1 mu0_3_1 sigma0_1_1 sigma0_2_2 sigma0_3_3
#> 0.001 0.000 0.000 0.000 0.001 0.001 0.001
print(pb, type = "bc") # bias-corrected
#> Call:
#> PBSSMFixed(R = 10L, path = path, prefix = "ssm", n = n, time = time,
#> delta_t = delta_t, mu0 = mu0, sigma0_l = sigma0_l, alpha = alpha,
#> beta = beta, psi_l = psi_l, nu = nu, lambda = lambda, theta_l = theta_l,
#> type = 0, ncores = 1, seed = 42)
#>
#> Parametric bootstrap confidence intervals.
#> type = "bc"
#> est se R 2.5% 97.5%
#> beta_1_1 0.500 0.2556 10 0.2865 0.9969
#> beta_2_1 0.000 0.1011 10 -0.1682 0.1064
#> beta_3_1 0.000 0.1535 10 -0.2993 0.1344
#> beta_1_2 0.000 0.1033 10 -0.2115 0.0959
#> beta_2_2 0.500 0.1432 10 0.3230 0.7018
#> beta_3_2 0.000 0.0693 10 -0.0957 0.0532
#> beta_1_3 0.000 0.1674 10 -0.1853 0.0634
#> beta_2_3 0.000 0.0980 10 -0.1285 0.1437
#> beta_3_3 0.500 0.2063 10 0.2299 0.7827
#> psi_1_1 0.001 0.0007 10 0.0000 0.0015
#> psi_2_2 0.001 0.0006 10 0.0001 0.0019
#> psi_3_3 0.001 0.0008 10 0.0002 0.0021
#> theta_1_1 0.001 0.0005 10 0.0004 0.0017
#> theta_2_2 0.001 0.0004 10 0.0004 0.0016
#> theta_3_3 0.001 0.0007 10 0.0000 0.0018
#> mu0_1_1 0.000 0.0215 10 -0.0357 0.0194
#> mu0_2_1 0.000 0.0158 10 -0.0217 0.0178
#> mu0_3_1 0.000 0.0195 10 -0.0187 0.0283
#> sigma0_1_1 0.001 0.0007 10 0.0000 0.0019
#> sigma0_2_2 0.001 0.0022 10 0.0000 0.0068
#> sigma0_3_3 0.001 0.0017 10 0.0000 0.0042
summary(pb, type = "bc")
#> Call:
#> PBSSMFixed(R = 10L, path = path, prefix = "ssm", n = n, time = time,
#> delta_t = delta_t, mu0 = mu0, sigma0_l = sigma0_l, alpha = alpha,
#> beta = beta, psi_l = psi_l, nu = nu, lambda = lambda, theta_l = theta_l,
#> type = 0, ncores = 1, seed = 42)
#> est se R 2.5% 97.5%
#> beta_1_1 0.500 0.2556 10 0.2865 0.9969
#> beta_2_1 0.000 0.1011 10 -0.1682 0.1064
#> beta_3_1 0.000 0.1535 10 -0.2993 0.1344
#> beta_1_2 0.000 0.1033 10 -0.2115 0.0959
#> beta_2_2 0.500 0.1432 10 0.3230 0.7018
#> beta_3_2 0.000 0.0693 10 -0.0957 0.0532
#> beta_1_3 0.000 0.1674 10 -0.1853 0.0634
#> beta_2_3 0.000 0.0980 10 -0.1285 0.1437
#> beta_3_3 0.500 0.2063 10 0.2299 0.7827
#> psi_1_1 0.001 0.0007 10 0.0000 0.0015
#> psi_2_2 0.001 0.0006 10 0.0001 0.0019
#> psi_3_3 0.001 0.0008 10 0.0002 0.0021
#> theta_1_1 0.001 0.0005 10 0.0004 0.0017
#> theta_2_2 0.001 0.0004 10 0.0004 0.0016
#> theta_3_3 0.001 0.0007 10 0.0000 0.0018
#> mu0_1_1 0.000 0.0215 10 -0.0357 0.0194
#> mu0_2_1 0.000 0.0158 10 -0.0217 0.0178
#> mu0_3_1 0.000 0.0195 10 -0.0187 0.0283
#> sigma0_1_1 0.001 0.0007 10 0.0000 0.0019
#> sigma0_2_2 0.001 0.0022 10 0.0000 0.0068
#> sigma0_3_3 0.001 0.0017 10 0.0000 0.0042
confint(pb, type = "bc")
#> 2.5 % 97.5 %
#> beta_1_1 2.865140e-01 0.996913972
#> beta_2_1 -1.681965e-01 0.106357315
#> beta_3_1 -2.993036e-01 0.134425625
#> beta_1_2 -2.115189e-01 0.095917751
#> beta_2_2 3.229898e-01 0.701814986
#> beta_3_2 -9.572536e-02 0.053242497
#> beta_1_3 -1.853209e-01 0.063398680
#> beta_2_3 -1.284541e-01 0.143676250
#> beta_3_3 2.298664e-01 0.782746723
#> psi_1_1 5.292005e-07 0.001546135
#> psi_2_2 1.337401e-04 0.001858861
#> psi_3_3 1.540076e-04 0.002069710
#> theta_1_1 4.351684e-04 0.001661737
#> theta_2_2 3.720811e-04 0.001564831
#> theta_3_3 7.356208e-12 0.001796755
#> mu0_1_1 -3.570665e-02 0.019411810
#> mu0_2_1 -2.165274e-02 0.017832927
#> mu0_3_1 -1.867286e-02 0.028251855
#> sigma0_1_1 8.120570e-11 0.001893493
#> sigma0_2_2 9.878043e-21 0.006782330
#> sigma0_3_3 1.756386e-14 0.004185875
# }