sar.eq.bootstrap {qfa}R Documentation

Bootstrap Simulation of SAR Coefficients for Testing Equality of Granger-Causality in Two Samples

Description

This function simulates bootstrap samples of selected spline autoregression (SAR) coefficients for testing equality of Granger-causality in two samples based on their SAR models under H0: effect in each sample equals the average effect.

Usage

sar.eq.bootstrap(
  y.qser,
  fit,
  fit2,
  index = c(1, 2),
  nsim = 1000,
  method = c("ar", "sar"),
  n.cores = 1,
  mthreads = FALSE,
  seed = 1234567
)

Arguments

y.qser

matrix or array of QSER from qser() or qspec.sar()$qser

fit

object of SAR model from qser2sar() or qspec.sar()$fit

fit2

object of SAR model for the other sample

index

a pair of component indices for multiple time series or a sequence of lags for single time series (default = c(1,2))

nsim

number of bootstrap samples (default = 1000)

method

method of residual calculation: "ar" (default) or "sar"

n.cores

number of cores for parallel computing (default = 1)

mthreads

if TRUE, multithread BLAS is enabled when available (default = FALSE, required for parallel computing)

seed

seed for random sampling (default = 1234567)

Value

array of simulated bootstrap samples of selected SAR coefficients

Examples

y11 <- stats::arima.sim(list(order=c(1,0,0), ar=0.5), n=64)
y21 <- stats::arima.sim(list(order=c(1,0,0), ar=-0.5), n=64)
y12 <- stats::arima.sim(list(order=c(1,0,0), ar=0.5), n=64)
y22 <- stats::arima.sim(list(order=c(1,0,0), ar=-0.5), n=64)
tau <- seq(0.1,0.9,0.05)
y1.sar <- qspec.sar(cbind(y11,y21),tau=tau,p=1)
y2.sar <- qspec.sar(cbind(y12,y22),tau=tau,p=1)
A1.sim <- sar.eq.bootstrap(y1.sar$qser,y1.sar$fit,y2.sar$fit,index=c(1,2),nsim=5)
A2.sim <- sar.eq.bootstrap(y2.sar$qser,y2.sar$fit,y1.sar$fit,index=c(1,2),nsim=5)

[Package qfa version 2.1 Index]