createSparseMatrix: Create Sparse Matrix

Description Usage Arguments Value Examples

View source: R/createSparseMatrix.R

Description

Creates a sparse square matrix with a given sparsity and distribution.

Usage

1
2
3
4
5
6
7
8
createSparseMatrix(
  N,
  sparsity,
  method = "normal",
  stationary = FALSE,
  p = 1,
  ...
)

Arguments

N

the dimension of the square matrix

sparsity

the density of non zero elements

method

the method used to generate the entries of the matrix. Possible values are "normal" (default) or "bimodal".

stationary

should the spectral radius of the matrix be smaller than 1? Possible values are TRUE or FALSE. Default is FALSE.

p

normalization constant (used for VAR of order greater than 1, default = 1)

...

other options for the matrix (you can specify the mean mu_mat and the standard deviation sd_mat).

Value

An NxN sparse matrix.

Examples

1
2
3
4
M <- createSparseMatrix(
  N = 30, sparsity = 0.05, method = "normal",
  stationary = TRUE
)

sparsevar documentation built on April 18, 2021, 9:08 a.m.