temporal_autocor: Compute the temporal autocorrelation of a matrix

View source: R/temporal_weights.R

temporal_autocorR Documentation

Compute the temporal autocorrelation of a matrix

Description

This function computes the temporal autocorrelation of a given matrix using a specified window size and optionally inverts the correlation matrix.

Usage

temporal_autocor(X, window = 3, inverse = FALSE)

Arguments

X

A numeric matrix for which to compute the temporal autocorrelation

window

integer, the window size for computing the autocorrelation, must be between 1 and ncol(X) (default is 3)

inverse

logical, whether to compute the inverse of the correlation matrix (default is FALSE)

Value

A sparse symmetric matrix representing the computed temporal autocorrelation

Examples

# Create an example matrix
X <- matrix(rnorm(50), nrow = 10, ncol = 5)

# Compute the temporal autocorrelation
result <- temporal_autocor(X, window = 2)


bbuchsbaum/graphweights documentation built on April 4, 2024, 7:19 p.m.