Learn R Programming

spGARCH (version 0.2.3)

sim.spARCH: Simulation of spatial ARCH models

Description

The function generates n random numbers of a spatial ARCH process for given parameters and weighting schemes.

Usage

sim.spARCH(n = dim(W)[1], rho, alpha, W, b = 2, type = "spARCH", control = list())

Value

The functions returns a vector \(\boldsymbol{y}\).

Arguments

n

number of observations. If length(n) \(> 1\), the length is taken to be the number required. Default dim(W)[1]

rho

spatial dependence parameter rho

alpha

unconditional variance level alpha

W

n times n spatial weight matrix

b

parameter b for logarithmic spatial ARCH (only needed if type = "log-spARCH"). Default 2.

type

type of simulated spARCH process (see details)

control

list of control arguments (see below)

Author

Philipp Otto philipp.otto@glasgow.ac.uk

Control Arguments

  • seed - positive integer to initialize the random number generator (RNG), default value is a random integer in \([1, 10^6]\)

  • silent - if FALSE, current random seed is reported

  • triangular - if TRUE, \(\mathbf{W}\) is a triangular matrix and there are no checks to verify this assumption (default FALSE)

Details

The function simulates n observations \(Y = (Y_1, ..., Y_n)'\) of a spatial ARCH process, i.e., $$ \boldsymbol{Y} = diag(\boldsymbol{h})^{1/2} \boldsymbol{\varepsilon} \, , $$ where \(\boldsymbol{\varepsilon}\) is a spatial White Noise process. The definition of \(\boldsymbol{h}\) depends on the chosen type. The following types are available.

  • type = "spARCH" - simulates \(\boldsymbol{\varepsilon}\) from a truncated normal distribution on the interval \([-a, a]\), such that \(\boldsymbol{h} > 0\) with $$ \boldsymbol{h} = \alpha + \rho \mathbf{W} \boldsymbol{Y}^{(2)} \; \mbox{and} \; a = 1 / ||\rho^2\mathbf{W}^2||_1^{1/4}. $$ Note that the normal distribution is not trunctated (\(a = \infty\)), if \(\mathbf{W}\) is a strictly triangular matrix, as it is ensured that \(\boldsymbol{h} > \boldsymbol{0}\). Generally, it is sufficient that if there exists a permutation such that \(\mathbf{W}\) is strictly triangular. In this case, the process is called oriented spARCH process.

  • type = "log-spARCH" - simulates a logarithmic spARCH process (log-spARCH), i.e., $$ \ln\boldsymbol{h} = \alpha + \rho \mathbf{W} g(\boldsymbol{\varepsilon}) \, . $$ For the log-spARCH process, the errors follow a standard normal distribution. The function \(g_b\) is given by $$ g_b(\boldsymbol{\varepsilon}) = (\ln|\varepsilon(\boldsymbol{s}_1)|^{b}, \ldots, \ln|\varepsilon(\boldsymbol{s}_n)|^{b})' \, . $$

  • type = "complex-spARCH" - allows for complex solutions of \(\boldsymbol{h}^{1/2}\) with $$ \boldsymbol{h} = \alpha + \rho \mathbf{W} \boldsymbol{Y}^{(2)} \, . $$ The errors follow a standard normal distribution.

References

Philipp Otto, Wolfgang Schmid, Robert Garthoff (2018). Generalised Spatial and Spatiotemporal Autoregressive Conditional Heteroscedasticity. Spatial Statistics 26, pp. 125-145. tools:::Rd_expr_doi("10.1016/j.spasta.2018.07.005"), arXiv: tools:::Rd_expr_doi("10.48550/arXiv.1609.00711")

Examples

Run this code
require("spdep")

# 1st example
##############

# parameters

rho <- 0.5
alpha <- 1
d <- 2

nblist <- cell2nb(d, d, type = "queen")
W <- nb2mat(nblist)

# simulation

Y <- sim.spARCH(rho = rho, alpha = alpha, W = W, type = "log-spARCH")

# visualization

image(1:d, 1:d, array(Y, dim = c(d,d)), xlab = expression(s[1]), ylab = expression(s[2]))

# 2nd example
##############

# two spatial weighting matrices W_1 and W_2
# h = alpha + rho_1 W_1 Y^2 + rho_2 W_2 Y^2

W_1 <- W
nblist <- cell2nb(d, d, type = "rook")
W_2 <- nb2mat(nblist)

rho_1 <- 0.3
rho_2 <- 0.7

W <- rho_1 * W_1 + rho_2 * W_2
rho <- 1

Y <- sim.spARCH(n = d^2, rho = rho, alpha = alpha, W = W, type = "log-spARCH")
image(1:d, 1:d, array(Y, dim = c(d,d)), xlab = expression(s[1]), ylab = expression(s[2]))

Run the code above in your browser using DataLab