acfs.mcgf: Extract, calculate, or assign mean auto-correlations for an...

View source: R/acfs.R

acfs.mcgfR Documentation

Extract, calculate, or assign mean auto-correlations for an mcgf or mcgf_rs object

Description

Extract, calculate, or assign mean auto-correlations for an mcgf or mcgf_rs object

Usage

## S3 method for class 'mcgf'
acfs(x, lag_max, replace = FALSE, ...)

## S3 method for class 'mcgf_rs'
acfs(x, lag_max, replace = FALSE, ...)

acfs(x) <- value

add_acfs(x, lag_max, ...)

Arguments

x

An mcgf or mcgf_rs object.

lag_max

Maximum lag at which to calculate the acf.

replace

Logical; if TRUE, acfs are recalculated.

...

Additional parameters or attributes.

value

A Vector of mean of auto-correlations for time lags starting from 0.

Details

For mcgf objects, acfs() computes mean auto-correlations for each time lag across locations. The output is a vector of acfs.

For mcgf_rs objects, acfs() computes regime-switching mean auto-correlations for each time lag across locations. The output is a list of vectors of acfs, where each vector in the list corresponds to the acfs for a regime.

acfs<- assigns acfs to x.

add_acfs() adds acfs to x.

Value

acfs() returns (regime-switching) mean auto-correlations. add_acfs() returns the same object with additional attributes of (regime-switching) mean auto-correlations.

Examples

# Calculate acfs for 'sim1'
data(sim1)
sim1_mcgf <- mcgf(sim1$data, dists = sim1$dists)
acfs(sim1_mcgf, lag_max = 5)

# Add acfs to 'sim1_mcgf'
sim1_mcgf <- add_acfs(sim1_mcgf, lag_max = 5)
print(sim1_mcgf, "acfs")

# Calculate acfs for 'sim2'
data(sim2)
sim2_mcgf <- mcgf_rs(sim2$data, dists = sim2$dists, label = sim2$label)
acfs(sim2_mcgf, lag_max = 5)

# Add acfs to 'sim2_mcgf'
sim2_mcgf <- add_acfs(sim2_mcgf, lag_max = 5)
print(sim2_mcgf, "acfs")

mcgf documentation built on June 29, 2024, 9:09 a.m.