Learn R Programming

fastmatrix (version 0.6)

Fast Computation of some Matrices Useful in Statistics

Description

Small set of functions to fast computation of some matrices and operations useful in statistics and econometrics. Currently, there are functions for efficient computation of duplication, commutation and symmetrizer matrices with minimal storage requirements. Some commonly used matrix decompositions (LU and LDL), basic matrix operations (for instance, Hadamard, Kronecker products and the Sherman-Morrison formula) and iterative solvers for linear systems are also available. In addition, the package includes a number of common statistical procedures such as the sweep operator, weighted mean and covariance matrix using an online algorithm, linear regression (using Cholesky, QR, SVD, sweep operator and conjugate gradients methods), ridge regression (with optimal selection of the ridge parameter considering several procedures), omnibus tests for univariate normality, functions to compute the multivariate skewness, kurtosis, the Mahalanobis distance (checking the positive defineteness), and the Wilson-Hilferty transformation of gamma variables. Furthermore, the package provides interfaces to C code callable by another C code from other R packages.

Copy Link

Version

Install

install.packages('fastmatrix')

Monthly Downloads

2,208

Version

0.6

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Felipe Osorio

Last Published

July 7th, 2025

Functions in fastmatrix (0.6)

duplication

Duplication matrix
corAR1

AR(1) correlation structure
helmert

Helmert matrix
dupl.info

Compact information to construct the duplication matrix
dupl.prod

Matrix multiplication envolving the duplication matrix
is.lower.tri

Check if a matrix is lower or upper triangular
harris.test

Test for variance homogeneity of correlated variables
frank

Frank matrix
geomean

Geometric mean
krylov

Computes a Krylov matrix
matrix.inner

Compute the inner product between two rectangular matrices
hadamard

Hadamard product of two matrices
lu

The LU factorization of a square matrix
JarqueBera.test

Jarque-Bera test for univariate normality
kronecker.prod

Kronecker product on matrices
lu2inv

Inverse from LU factorization
matrix.polynomial

Evaluates a real general matrix polynomial
kurtosis

Mardia's multivariate skewness and kurtosis coefficients
matrix.sqrt

Matrix square root
ldl

The LDL decomposition
ols.fit

Fitter functions for linear models
lu-methods

Reconstruct the L, U, or X matrices from an LU object
symm.prod

Matrix multiplication envolving the symmetrizer matrix
power.method

Power method to approximate dominant eigenvalue and eigenvector
minkowski

Computes the p-norm of a vector
moments

Central moments
symm.info

Compact information to construct the symmetrizer matrix
equilibrate

Equilibration of a rectangular or symmetric matrix
ols.fit-methods

Fit a linear model
vec

Vectorization of a matrix
ols

Fit linear regression model
scaled.condition

Scaled condition number
mchol

The modified Cholesky factorization
matrix.norm

Compute the norm of a rectangular matrix
sherman.morrison

Sherman-Morrison formula
sweep.operator

Gauss-Jordan sweep operator for symmetric matrices
mediancenter

Mediancenter
ridge

Ridge regression
symmetrizer

Symmetrizer matrix
seidel

Solve linear systems using the Gauss-Seidel method
rmnorm

Multivariate normal random deviates
rball

Generation of deviates uniformly distributed in a unitary ball
rsphere

Generation of deviates uniformly located on a spherical surface
wilson.hilferty

Wilson-Hilferty transformation
whitening

Whitening transformation
vech

Vectorization the lower triangular part of a square matrix
WH.normal

Wilson-Hilferty transformation for chi-squared variates
comm.info

Compact information to construct the commutation matrix
asSymmetric

Force a matrix to be symmetric
bezier

Computation of Bezier curve
circulant

Form a symmetric circulant matrix
ccc

Lin's concordance correlation coefficient
cg

Solve linear systems using the conjugate gradients method
dupl.cross

Matrix crossproduct envolving the duplication matrix
comm.prod

Matrix multiplication envolving the commutation matrix
array.mult

Array multiplication
Mahalanobis

Mahalanobis distance
corCS

Compound symmetry correlation structure
cov.MSSD

Mean Square Successive Difference (MSSD) estimator of the covariance matrix
cov.weighted

Weighted covariance matrices
cholupdate

Rank 1 update to Cholesky factorization
commutation

Commutation matrix
bracket.prod

Bracket product
hankel

Form a symmetric Hankel matrix
jacobi

Solve linear systems using the Jacobi method