Learn R Programming

MARSS (version 3.2)

is.blockdiag: Matrix Utilities

Description

Matrix utilities for MARSS functions in the MARSS-package. These are not exported but can be accessed using the MARSS::: prefix.

Usage

is.blockdiag(x)
is.blockequaltri(x, uniqueblocks=FALSE)
is.blockunconst(x, uniqueblocks=FALSE)
is.identity(x, dim=NULL)
is.diagonal(x, na.rm=FALSE)
is.equaltri(x)
makediag(x, nrow=NA)
takediag(x)
is.design(x, strict=TRUE, dim=NULL, zero.rows.ok=FALSE, zero.cols.ok=FALSE)
is.fixed(x, by.row=FALSE)
is.identity(x, dim=NULL)
vec(x)
unvec(x, dim=NULL)
is.wholenumber(x, tol = .Machine$double.eps^0.5)
Imat(x)
rwishart(nu, V)
mystrsplit(x)
convert.model.mat(param.matrix)
fixed.free.to.formula(fixed,free,dim)
matrix.power(x, n)
sub3D(x,dim1,dim2,t=1)
pinv(x)
pcholinv(x)
is.solvable(A,y=NULL)

Arguments

x, A, y
A matrix (or vector for 'makediag' or string for 'mystrsplit'.).
na.rm
How to treat NAs in the block diag test.
dim
Matrix dimensions. Some functions will take the vec of a matrix. In this case, the optional dim arg specifies the matrix dimensions.
fixed
A fixed matrix per the MARSS specification for fixed matrix syntax.
free
A free matrix per the MARSS specification for free matrix syntax.
nrow
Number of rows.
tol
Tolerance.
uniqueblocks
Must blocks be unique?
t
The time index or third dimension of a 3D matrix
nu, V
Parameters of a Wishart distribution.
param.matrix
The list matrix version of a time-invariant MARSS model.
dim1, dim2
The first and second dimensions of a 3D matrix.
n
An interger for the power function.
zero.rows.ok, zero.cols.ok
Means the design matrix can have all zero rows or columns.
strict
Specifies whether the design matrix must be only 0s and 1s.
by.row
For is.fixed, reports whether is.fixed by row rather than for the whole matrix.

Value

  • 'makediag(x)': a matrix with diagonal x. 'takediag(x)': the diagonal from matrix x.

Details

'is...' tests for various matrix properties. vec(x) creates a column vector from a matrix per the standard vec math function. unvec(c,dim) takes the vector c and creates a matrix with the specified dimensions. Imat(nrow) returns the identity matrix of dimension nrow. fixed.free.to.formula takes a fixed and free pair and constructs a list matrix with formulas in each matrix element. convert.model.mat takes a list matrix with formulas in each element and converts to a fixed/free pair. sub3D returns a 2D matrix after subsetting a 3D matrix on the third (time) dimension. mystrsplit is a customized string splitter used by convert.model.mat. rwishart generates random draws from a wishart distribution. matrix.power is a faster way to get the n-th power of a matrix. pinv is the pseudoinverse based on singular value decomposition PInv=UD^+V' where a diagonal matrix with non-zero diagonal values of D (from svd) replaced with 1/D. pcholinv is the inverse based on the Cholsky decomposition but modified to allow 0s on the diagonal of x (with corresponding 0 row/column). These appear as 0 row/columns in the returned inverse. is.solvable returns information on the solvability of the linear system y=Ax using the SVD decomposition.