mat.banded: Form a banded matrix from a vector of values

mat.bandedR Documentation

Form a banded matrix from a vector of values

Description

Takes the first value in x and places it down the diagonal of the matrix. Takes the second value in x and places it down the first subdiagonal, both below and above the diagonal of the matrix. The third value is placed in the second subdiagonal and so on, until the bands for which there are elements in x have been filled. All other elements in the matrix will be zero.

Usage

mat.banded(x, nrow, ncol)

Arguments

x

A numeric containing the values for each band from 1 to the length of x.

nrow

The number of rows in the banded matrix being formed.

ncol

The number of columns in the banded matrix being formed.

Value

An nrow \times ncol matrix.

Author(s)

Chris Brien

See Also

mat.cor, mat.corg, mat.ar1, mat.ar2, mat.ar3, mat.sar2, mat.exp, mat.gau, mat.ma1, mat.ma2, mat.arma mat.I, mat.J

Examples

      m <- mat.banded(c(1,0.6,0.5), 5,5)
      m <- mat.banded(c(1,0.6,0.5), 3,4)
      m <- mat.banded(c(1,0.6,0.5), 4,3)


dae documentation built on June 22, 2024, 9:07 a.m.