Package 'bootStateSpace'

Title: Bootstrap for State Space Models
Description: Provides a streamlined and user-friendly framework for bootstrapping in state space models, particularly when the number of subjects/units (n) exceeds one, a scenario commonly encountered in social and behavioral sciences. For an introduction to state space models in social and behavioral sciences, refer to Chow, Ho, Hamaker, and Dolan (2010) <doi:10.1080/10705511003661553>.
Authors: Ivan Jacob Agaloos Pesigan [aut, cre, cph]
Maintainer: Ivan Jacob Agaloos Pesigan <[email protected]>
License: GPL (>= 3)
Version: 1.0.1
Built: 2025-01-22 19:52:34 UTC
Source: CRAN

Help Index


Estimated Parameter Method for an Object of Class bootstatespace

Description

Estimated Parameter Method for an Object of Class bootstatespace

Usage

## S3 method for class 'bootstatespace'
coef(object, ...)

Arguments

object

Object of Class bootstatespace.

...

additional arguments.

Value

Returns a vector of estimated parameters.

Author(s)

Ivan Jacob Agaloos Pesigan


Confidence Intervals Method for an Object of Class bootstatespace

Description

Confidence Intervals Method for an Object of Class bootstatespace

Usage

## S3 method for class 'bootstatespace'
confint(object, parm = NULL, level = 0.95, type = "pc", ...)

Arguments

object

Object of Class bootstatespace.

parm

a specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered.

level

the confidence level required.

type

Charater string. Confidence interval type, that is, type = "pc" for percentile; type = "bc" for bias corrected.

...

additional arguments.

Value

Returns a matrix of confidence intervals.

Author(s)

Ivan Jacob Agaloos Pesigan


Extract Generic Function

Description

A generic function for extracting elements from objects.

Usage

extract(object, what)

Arguments

object

An object.

what

Character string.

Value

A value determined by the specific method for the object's class.


Extract Method for an Object of Class bootstatespace

Description

Extract Method for an Object of Class bootstatespace

Usage

## S3 method for class 'bootstatespace'
extract(object, what = NULL)

Arguments

object

Object of Class bootstatespace.

what

Character string. What specific matrix to extract. If what = NULL, extract all available matrices.

Value

Returns a list. Each element of the list is a list of bootstrap estimates in matrix format.

Author(s)

Ivan Jacob Agaloos Pesigan


Parametric Bootstrap for the State Space Model (Fixed Parameters)

Description

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 (μη0\boldsymbol{\mu}_{\boldsymbol{\eta} \mid 0}).

sigma0_l

Numeric matrix. Cholesky factorization (t(chol(sigma0))) of the covariance matrix of initial latent variable values (Ση0\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 in n. The number of columns in each matrix should be equal to time.

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 to mu0. If mu0_fixed = FALSE, mu0 is estimated.

sigma0_fixed

Logical. If sigma0_fixed = TRUE, fix the initial covariance matrix to tcrossprod(sigma0_l). If sigma0_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 samples R is a large value.

seed

Random seed.

Details

Type 0

The measurement model is given by

yi,t=ν+Ληi,t+εi,t,withεi,tN(0,Θ)\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 yi,t\mathbf{y}_{i, t}, ηi,t\boldsymbol{\eta}_{i, t}, and εi,t\boldsymbol{\varepsilon}_{i, t} are random variables and ν\boldsymbol{\nu}, Λ\boldsymbol{\Lambda}, and Θ\boldsymbol{\Theta} are model parameters. yi,t\mathbf{y}_{i, t} represents a vector of observed random variables, ηi,t\boldsymbol{\eta}_{i, t} a vector of latent random variables, and εi,t\boldsymbol{\varepsilon}_{i, t} a vector of random measurement errors, at time tt and individual ii. ν\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

εi,t=Θ12zi,t,withzi,tN(0,I)\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 zi,t\mathbf{z}_{i, t} is a vector of independent standard normal random variables and (Θ12)(Θ12)=Θ.\left( \boldsymbol{\Theta}^{\frac{1}{2}} \right) \left( \boldsymbol{\Theta}^{\frac{1}{2}} \right)^{\prime} = \boldsymbol{\Theta} .

The dynamic structure is given by

ηi,t=α+βηi,t1+ζi,t,withζi,tN(0,Ψ)\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 ηi,t\boldsymbol{\eta}_{i, t}, ηi,t1\boldsymbol{\eta}_{i, t - 1}, and ζi,t\boldsymbol{\zeta}_{i, t} are random variables, and α\boldsymbol{\alpha}, β\boldsymbol{\beta}, and Ψ\boldsymbol{\Psi} are model parameters. Here, ηi,t\boldsymbol{\eta}_{i, t} is a vector of latent variables at time tt and individual ii, ηi,t1\boldsymbol{\eta}_{i, t - 1} represents a vector of latent variables at time t1t - 1 and individual ii, and ζi,t\boldsymbol{\zeta}_{i, t} represents a vector of dynamic noise at time tt and individual ii. α\boldsymbol{\alpha} denotes a vector of intercepts, β\boldsymbol{\beta} a matrix of autoregression and cross regression coefficients, and Ψ\boldsymbol{\Psi} the covariance matrix of ζi,t\boldsymbol{\zeta}_{i, t}.

An alternative representation of the dynamic noise is given by

ζi,t=Ψ12zi,t,withzi,tN(0,I)\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 (Ψ12)(Ψ12)=Ψ.\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

yi,t=ν+Ληi,t+εi,t,withεi,tN(0,Θ).\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

ηi,t=α+βηi,t1+Γxi,t+ζi,t,withζi,tN(0,Ψ)\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 xi,t\mathbf{x}_{i, t} represents a vector of covariates at time tt and individual ii, and Γ\boldsymbol{\Gamma} the coefficient matrix linking the covariates to the latent variables.

Type 2

The measurement model is given by

yi,t=ν+Ληi,t+κxi,t+εi,t,withεi,tN(0,Θ)\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

ηi,t=α+βηi,t1+Γxi,t+ζi,t,withζi,tN(0,Ψ).\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) .

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").

Author(s)

Ivan Jacob Agaloos Pesigan

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

# 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)
summary(pb)
confint(pb)
vcov(pb)
coef(pb)
print(pb, type = "bc") # bias-corrected
summary(pb, type = "bc")
confint(pb, type = "bc")

Parametric Bootstrap for the Linear Stochastic Differential Equation Model using a State Space Model Parameterization (Fixed Parameters)

Description

This function simulates data from a linear stochastic differential equation model using a state-space model parameterization 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

PBSSMLinSDEFixed(
  R,
  path,
  prefix,
  n,
  time,
  delta_t = 0.1,
  mu0,
  sigma0_l,
  iota,
  phi,
  sigma_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 (Δt\Delta_t).

mu0

Numeric vector. Mean of initial latent variable values (μη0\boldsymbol{\mu}_{\boldsymbol{\eta} \mid 0}).

sigma0_l

Numeric matrix. Cholesky factorization (t(chol(sigma0))) of the covariance matrix of initial latent variable values (Ση0\boldsymbol{\Sigma}_{\boldsymbol{\eta} \mid 0}).

iota

Numeric vector. An unobserved term that is constant over time (ι\boldsymbol{\iota}).

phi

Numeric matrix. The drift matrix which represents the rate of change of the solution in the absence of any random fluctuations (Φ\boldsymbol{\Phi}).

sigma_l

Numeric matrix. Cholesky factorization (t(chol(sigma))) of the covariance matrix of volatility or randomness in the process (Σ\boldsymbol{\Sigma}).

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 in n. The number of columns in each matrix should be equal to time.

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 to mu0. If mu0_fixed = FALSE, mu0 is estimated.

sigma0_fixed

Logical. If sigma0_fixed = TRUE, fix the initial covariance matrix to tcrossprod(sigma0_l). If sigma0_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 samples R is a large value.

seed

Random seed.

Details

Type 0

The measurement model is given by

yi,t=ν+Ληi,t+εi,t,withεi,tN(0,Θ)\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 yi,t\mathbf{y}_{i, t}, ηi,t\boldsymbol{\eta}_{i, t}, and εi,t\boldsymbol{\varepsilon}_{i, t} are random variables and ν\boldsymbol{\nu}, Λ\boldsymbol{\Lambda}, and Θ\boldsymbol{\Theta} are model parameters. yi,t\mathbf{y}_{i, t} represents a vector of observed random variables, ηi,t\boldsymbol{\eta}_{i, t} a vector of latent random variables, and εi,t\boldsymbol{\varepsilon}_{i, t} a vector of random measurement errors, at time tt and individual ii. ν\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

εi,t=Θ12zi,t,withzi,tN(0,I)\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 zi,t\mathbf{z}_{i, t} is a vector of independent standard normal random variables and (Θ12)(Θ12)=Θ.\left( \boldsymbol{\Theta}^{\frac{1}{2}} \right) \left( \boldsymbol{\Theta}^{\frac{1}{2}} \right)^{\prime} = \boldsymbol{\Theta} .

The dynamic structure is given by

dηi,t=(ι+Φηi,t)dt+Σ12dWi,t\mathrm{d} \boldsymbol{\eta}_{i, t} = \left( \boldsymbol{\iota} + \boldsymbol{\Phi} \boldsymbol{\eta}_{i, t} \right) \mathrm{d}t + \boldsymbol{\Sigma}^{\frac{1}{2}} \mathrm{d} \mathbf{W}_{i, t}

where ι\boldsymbol{\iota} is a term which is unobserved and constant over time, Φ\boldsymbol{\Phi} is the drift matrix which represents the rate of change of the solution in the absence of any random fluctuations, Σ\boldsymbol{\Sigma} is the matrix of volatility or randomness in the process, and dW\mathrm{d}\boldsymbol{W} is a Wiener process or Brownian motion, which represents random fluctuations.

Type 1

The measurement model is given by

yi,t=ν+Ληi,t+εi,t,withεi,tN(0,Θ).\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

dηi,t=(ι+Φηi,t)dt+Γxi,t+Σ12dWi,t\mathrm{d} \boldsymbol{\eta}_{i, t} = \left( \boldsymbol{\iota} + \boldsymbol{\Phi} \boldsymbol{\eta}_{i, t} \right) \mathrm{d}t + \boldsymbol{\Gamma} \mathbf{x}_{i, t} + \boldsymbol{\Sigma}^{\frac{1}{2}} \mathrm{d} \mathbf{W}_{i, t}

where xi,t\mathbf{x}_{i, t} represents a vector of covariates at time tt and individual ii, and Γ\boldsymbol{\Gamma} the coefficient matrix linking the covariates to the latent variables.

Type 2

The measurement model is given by

yi,t=ν+Ληi,t+κxi,t+εi,t,withεi,tN(0,Θ)\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

dηi,t=(ι+Φηi,t)dt+Γxi,t+Σ12dWi,t.\mathrm{d} \boldsymbol{\eta}_{i, t} = \left( \boldsymbol{\iota} + \boldsymbol{\Phi} \boldsymbol{\eta}_{i, t} \right) \mathrm{d}t + \boldsymbol{\Gamma} \mathbf{x}_{i, t} + \boldsymbol{\Sigma}^{\frac{1}{2}} \mathrm{d} \mathbf{W}_{i, t} .

State Space Parameterization

The state space parameters as a function of the linear stochastic differential equation model parameters are given by

βΔtli=exp(ΔtΦ)\boldsymbol{\beta}_{\Delta t_{{l_{i}}}} = \exp{ \left( \Delta t \boldsymbol{\Phi} \right) }

αΔtli=Φ1(βIp)ι\boldsymbol{\alpha}_{\Delta t_{{l_{i}}}} = \boldsymbol{\Phi}^{-1} \left( \boldsymbol{\beta} - \mathbf{I}_{p} \right) \boldsymbol{\iota}

vec(ΨΔtli)=[(ΦIp)+(IpΦ)][exp([(ΦIp)+(IpΦ)]Δt)Ip×p]vec(Σ)\mathrm{vec} \left( \boldsymbol{\Psi}_{\Delta t_{{l_{i}}}} \right) = \left[ \left( \boldsymbol{\Phi} \otimes \mathbf{I}_{p} \right) + \left( \mathbf{I}_{p} \otimes \boldsymbol{\Phi} \right) \right] \left[ \exp \left( \left[ \left( \boldsymbol{\Phi} \otimes \mathbf{I}_{p} \right) + \left( \mathbf{I}_{p} \otimes \boldsymbol{\Phi} \right) \right] \Delta t \right) - \mathbf{I}_{p \times p} \right] \mathrm{vec} \left( \boldsymbol{\Sigma} \right)

where pp is the number of latent variables and Δt\Delta t is the time interval.

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 ("PBSSMLinSDEFixed").

method

Bootstrap method used ("parametric").

Author(s)

Ivan Jacob Agaloos Pesigan

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: PBSSMFixed(), PBSSMOUFixed(), PBSSMVARFixed()

Examples

# prepare parameters
## number of individuals
n <- 5
## time points
time <- 50
delta_t <- 0.10
## dynamic structure
p <- 2
mu0 <- c(-3.0, 1.5)
sigma0 <- 0.001 * diag(p)
sigma0_l <- t(chol(sigma0))
iota <- c(0.317, 0.230)
phi <- matrix(
  data = c(
    -0.10,
    0.05,
    0.05,
    -0.10
  ),
  nrow = p
)
sigma <- matrix(
  data = c(
    2.79,
    0.06,
    0.06,
    3.27
  ),
  nrow = p
)
sigma_l <- t(chol(sigma))
## measurement model
k <- 2
nu <- rep(x = 0, times = k)
lambda <- diag(k)
theta <- 0.001 * diag(k)
theta_l <- t(chol(theta))

path <- tempdir()

pb <- PBSSMLinSDEFixed(
  R = 10L, # use at least 1000 in actual research
  path = path,
  prefix = "lse",
  n = n,
  time = time,
  delta_t = delta_t,
  mu0 = mu0,
  sigma0_l = sigma0_l,
  iota = iota,
  phi = phi,
  sigma_l = sigma_l,
  nu = nu,
  lambda = lambda,
  theta_l = theta_l,
  type = 0,
  ncores = 1, # consider using multiple cores
  seed = 42
)
print(pb)
summary(pb)
confint(pb)
vcov(pb)
coef(pb)
print(pb, type = "bc") # bias-corrected
summary(pb, type = "bc")
confint(pb, type = "bc")

Parametric Bootstrap for the Ornstein–Uhlenbeck Model using a State Space Model Parameterization (Fixed Parameters)

Description

This function simulates data from a Ornstein–Uhlenbeck (OU) model using a state-space model parameterization 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

PBSSMOUFixed(
  R,
  path,
  prefix,
  n,
  time,
  delta_t = 0.1,
  mu0,
  sigma0_l,
  mu,
  phi,
  sigma_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 (Δt\Delta_t).

mu0

Numeric vector. Mean of initial latent variable values (μη0\boldsymbol{\mu}_{\boldsymbol{\eta} \mid 0}).

sigma0_l

Numeric matrix. Cholesky factorization (t(chol(sigma0))) of the covariance matrix of initial latent variable values (Ση0\boldsymbol{\Sigma}_{\boldsymbol{\eta} \mid 0}).

mu

Numeric vector. The long-term mean or equilibrium level (μ\boldsymbol{\mu}).

phi

Numeric matrix. The drift matrix which represents the rate of change of the solution in the absence of any random fluctuations (Φ\boldsymbol{\Phi}). It also represents the rate of mean reversion, determining how quickly the variable returns to its mean.

sigma_l

Numeric matrix. Cholesky factorization (t(chol(sigma))) of the covariance matrix of volatility or randomness in the process (Σ\boldsymbol{\Sigma}).

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 in n. The number of columns in each matrix should be equal to time.

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 to mu0. If mu0_fixed = FALSE, mu0 is estimated.

sigma0_fixed

Logical. If sigma0_fixed = TRUE, fix the initial covariance matrix to tcrossprod(sigma0_l). If sigma0_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 samples R is a large value.

seed

Random seed.

Details

Type 0

The measurement model is given by

yi,t=ν+Ληi,t+εi,t,withεi,tN(0,Θ)\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 yi,t\mathbf{y}_{i, t}, ηi,t\boldsymbol{\eta}_{i, t}, and εi,t\boldsymbol{\varepsilon}_{i, t} are random variables and ν\boldsymbol{\nu}, Λ\boldsymbol{\Lambda}, and Θ\boldsymbol{\Theta} are model parameters. yi,t\mathbf{y}_{i, t} represents a vector of observed random variables, ηi,t\boldsymbol{\eta}_{i, t} a vector of latent random variables, and εi,t\boldsymbol{\varepsilon}_{i, t} a vector of random measurement errors, at time tt and individual ii. ν\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

εi,t=Θ12zi,t,withzi,tN(0,I)\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 zi,t\mathbf{z}_{i, t} is a vector of independent standard normal random variables and (Θ12)(Θ12)=Θ.\left( \boldsymbol{\Theta}^{\frac{1}{2}} \right) \left( \boldsymbol{\Theta}^{\frac{1}{2}} \right)^{\prime} = \boldsymbol{\Theta} .

The dynamic structure is given by

dηi,t=Φ(ηi,tμ)dt+Σ12dWi,t\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}

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 dW\mathrm{d}\boldsymbol{W} is a Wiener process or Brownian motion, which represents random fluctuations.

Type 1

The measurement model is given by

yi,t=ν+Ληi,t+εi,t,withεi,tN(0,Θ).\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

dηi,t=Φ(ηi,tμ)dt+Γxi,t+Σ12dWi,t\mathrm{d} \boldsymbol{\eta}_{i, t} = \boldsymbol{\Phi} \left( \boldsymbol{\eta}_{i, t} - \boldsymbol{\mu} \right) \mathrm{d}t + \boldsymbol{\Gamma} \mathbf{x}_{i, t} + \boldsymbol{\Sigma}^{\frac{1}{2}} \mathrm{d} \mathbf{W}_{i, t}

where xi,t\mathbf{x}_{i, t} represents a vector of covariates at time tt and individual ii, and Γ\boldsymbol{\Gamma} the coefficient matrix linking the covariates to the latent variables.

Type 2

The measurement model is given by

yi,t=ν+Ληi,t+κxi,t+εi,t,withεi,tN(0,Θ)\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

dηi,t=Φ(ηi,tμ)dt+Γxi,t+Σ12dWi,t.\mathrm{d} \boldsymbol{\eta}_{i, t} = \boldsymbol{\Phi} \left( \boldsymbol{\eta}_{i, t} - \boldsymbol{\mu} \right) \mathrm{d}t + \boldsymbol{\Gamma} \mathbf{x}_{i, t} + \boldsymbol{\Sigma}^{\frac{1}{2}} \mathrm{d} \mathbf{W}_{i, t} .

The OU model as a linear stochastic differential equation model

The OU model is a first-order linear stochastic differential equation model in the form of

dηi,t=(ι+Φηi,t)dt+Σ12dWi,t\mathrm{d} \boldsymbol{\eta}_{i, t} = \left( \boldsymbol{\iota} + \boldsymbol{\Phi} \boldsymbol{\eta}_{i, t} \right) \mathrm{d}t + \boldsymbol{\Sigma}^{\frac{1}{2}} \mathrm{d} \mathbf{W}_{i, t}

where μ=Φ1ι\boldsymbol{\mu} = - \boldsymbol{\Phi}^{-1} \boldsymbol{\iota} and, equivalently ι=Φμ\boldsymbol{\iota} = - \boldsymbol{\Phi} \boldsymbol{\mu}.

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 ("PBSSMOUFixed").

method

Bootstrap method used ("parametric").

Author(s)

Ivan Jacob Agaloos Pesigan

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: PBSSMFixed(), PBSSMLinSDEFixed(), PBSSMVARFixed()

Examples

# prepare parameters
## number of individuals
n <- 5
## time points
time <- 50
delta_t <- 0.10
## dynamic structure
p <- 2
mu0 <- c(-3.0, 1.5)
sigma0 <- 0.001 * diag(p)
sigma0_l <- t(chol(sigma0))
mu <- c(5.76, 5.18)
phi <- matrix(
  data = c(
    -0.10,
    0.05,
    0.05,
    -0.10
  ),
  nrow = p
)
sigma <- matrix(
  data = c(
    2.79,
    0.06,
    0.06,
    3.27
  ),
  nrow = p
)
sigma_l <- t(chol(sigma))
## measurement model
k <- 2
nu <- rep(x = 0, times = k)
lambda <- diag(k)
theta <- 0.001 * diag(k)
theta_l <- t(chol(theta))

path <- tempdir()

pb <- PBSSMOUFixed(
  R = 10L, # use at least 1000 in actual research
  path = path,
  prefix = "ou",
  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,
  ncores = 1, # consider using multiple cores
  seed = 42
)
print(pb)
summary(pb)
confint(pb)
vcov(pb)
coef(pb)
print(pb, type = "bc") # bias-corrected
summary(pb, type = "bc")
confint(pb, type = "bc")

Parametric Bootstrap for the Vector Autoregressive Model (Fixed Parameters)

Description

This function simulates data from a vector autoregressive model using a state-space model parameterization 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

PBSSMVARFixed(
  R,
  path,
  prefix,
  n,
  time,
  mu0,
  sigma0_l,
  alpha,
  beta,
  psi_l,
  type = 0,
  x = NULL,
  gamma = 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.

mu0

Numeric vector. Mean of initial latent variable values (μη0\boldsymbol{\mu}_{\boldsymbol{\eta} \mid 0}).

sigma0_l

Numeric matrix. Cholesky factorization (t(chol(sigma0))) of the covariance matrix of initial latent variable values (Ση0\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}).

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 in n. The number of columns in each matrix should be equal to time.

gamma

Numeric matrix. Matrix linking the covariates to the latent variables at current time point (Γ\boldsymbol{\Gamma}).

mu0_fixed

Logical. If mu0_fixed = TRUE, fix the initial mean vector to mu0. If mu0_fixed = FALSE, mu0 is estimated.

sigma0_fixed

Logical. If sigma0_fixed = TRUE, fix the initial covariance matrix to tcrossprod(sigma0_l). If sigma0_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 samples R is a large value.

seed

Random seed.

Details

Type 0

The measurement model is given by

yi,t=ηi,t\mathbf{y}_{i, t} = \boldsymbol{\eta}_{i, t}

where yi,t\mathbf{y}_{i, t} represents a vector of observed variables and ηi,t\boldsymbol{\eta}_{i, t} a vector of latent variables for individual ii and time tt. Since the observed and latent variables are equal, we only generate data from the dynamic structure.

The dynamic structure is given by

ηi,t=α+βηi,t1+ζi,t,withζi,tN(0,Ψ)\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 ηi,t\boldsymbol{\eta}_{i, t}, ηi,t1\boldsymbol{\eta}_{i, t - 1}, and ζi,t\boldsymbol{\zeta}_{i, t} are random variables, and α\boldsymbol{\alpha}, β\boldsymbol{\beta}, and Ψ\boldsymbol{\Psi} are model parameters. Here, ηi,t\boldsymbol{\eta}_{i, t} is a vector of latent variables at time tt and individual ii, ηi,t1\boldsymbol{\eta}_{i, t - 1} represents a vector of latent variables at time t1t - 1 and individual ii, and ζi,t\boldsymbol{\zeta}_{i, t} represents a vector of dynamic noise at time tt and individual ii. α\boldsymbol{\alpha} denotes a vector of intercepts, β\boldsymbol{\beta} a matrix of autoregression and cross regression coefficients, and Ψ\boldsymbol{\Psi} the covariance matrix of ζi,t\boldsymbol{\zeta}_{i, t}.

An alternative representation of the dynamic noise is given by

ζi,t=Ψ12zi,t,withzi,tN(0,I)\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 (Ψ12)(Ψ12)=Ψ.\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

yi,t=ηi,t.\mathbf{y}_{i, t} = \boldsymbol{\eta}_{i, t} .

The dynamic structure is given by

ηi,t=α+βηi,t1+Γxi,t+ζi,t,withζi,tN(0,Ψ)\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 xi,t\mathbf{x}_{i, t} represents a vector of covariates at time tt and individual ii, and Γ\boldsymbol{\Gamma} the coefficient matrix linking the covariates to the latent variables.

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 ("PBSSMVARFixed").

method

Bootstrap method used ("parametric").

Author(s)

Ivan Jacob Agaloos Pesigan

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: PBSSMFixed(), PBSSMLinSDEFixed(), PBSSMOUFixed()

Examples

# prepare parameters
## number of individuals
n <- 5
## time points
time <- 50
## 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))

path <- tempdir()

pb <- PBSSMVARFixed(
  R = 10L, # use at least 1000 in actual research
  path = path,
  prefix = "var",
  n = n,
  time = time,
  mu0 = mu0,
  sigma0_l = sigma0_l,
  alpha = alpha,
  beta = beta,
  psi_l = psi_l,
  type = 0,
  ncores = 1, # consider using multiple cores
  seed = 42
)
print(pb)
summary(pb)
confint(pb)
vcov(pb)
coef(pb)
print(pb, type = "bc") # bias-corrected
summary(pb, type = "bc")
confint(pb, type = "bc")

Print Method for an Object of Class bootstatespace

Description

Print Method for an Object of Class bootstatespace

Usage

## S3 method for class 'bootstatespace'
print(x, alpha = NULL, type = "pc", digits = 4, ...)

Arguments

x

Object of Class bootstatespace.

alpha

Numeric vector. Significance level α\alpha. If alpha = NULL, use the argument alpha used in x.

type

Charater string. Confidence interval type, that is, type = "pc" for percentile; type = "bc" for bias corrected.

digits

Digits to print.

...

additional arguments.

Value

Prints a matrix of estimates, standard errors, number of bootstrap replications, and confidence intervals.

Author(s)

Ivan Jacob Agaloos Pesigan


Summary Method for an Object of Class bootstatespace

Description

Summary Method for an Object of Class bootstatespace

Usage

## S3 method for class 'bootstatespace'
summary(object, alpha = NULL, type = "pc", digits = 4, ...)

Arguments

object

Object of Class bootstatespace.

alpha

Numeric vector. Significance level α\alpha. If alpha = NULL, use the argument alpha used in object.

type

Charater string. Confidence interval type, that is, type = "pc" for percentile; type = "bc" for bias corrected.

digits

Digits to print.

...

additional arguments.

Value

Returns a matrix of estimates, standard errors, number of bootstrap replications, and confidence intervals.

Author(s)

Ivan Jacob Agaloos Pesigan


Sampling Variance-Covariance Matrix Method for an Object of Class bootstatespace

Description

Sampling Variance-Covariance Matrix Method for an Object of Class bootstatespace

Usage

## S3 method for class 'bootstatespace'
vcov(object, ...)

Arguments

object

Object of Class bootstatespace.

...

additional arguments.

Value

Returns the variance-covariance matrix of estimates.

Author(s)

Ivan Jacob Agaloos Pesigan