Learn R Programming

FluxPoint (version 0.1.2)

random_Phi: Randomly generate an autoregressive coefficient matrix \(\Phi\)

Description

Generates a \(p \times p\) autoregressive coefficient matrix \(\Phi\) for the VAR(1) component in the proposed model. The diagonal entries are randomly chosen from {0.5, -0.5}, and a specified number of off-diagonal elements are randomly assigned nonzero values to introduce cross-dependence among variables.

Usage

random_Phi(p, num_nonzero)

Value

A numeric \(p \times p\) matrix representing the autoregressive coefficient matrix \(\Phi\) with random diagonal entries in {0.5, -0.5} and approximately `num_nonzero` nonzero off-diagonal elements.

Arguments

p

Integer. Dimension of the square matrix (\(p\) variables).

num_nonzero

Integer. Target number of nonzero off-diagonal entries in \(\Phi\).

Details

The diagonal elements are sampled independently from the set \(\{0.5, -0.5\}\). Nonzero off-diagonal entries are then placed at random positions until the total number of nonzero off-diagonal elements reaches at least num_nonzero. Each nonzero off-diagonal element has magnitude 0.1 or 0.2 with equal probability and a randomly assigned sign. The resulting matrix \(\Phi\) governs the temporal dependence of the stationary VAR(1) process $$\boldsymbol{\epsilon}_t = \Phi \boldsymbol{\epsilon}_{t-1} + \boldsymbol{\nu}_t.$$