cor_stat_rs: Calculate general stationary correlation.

View source: R/cor_stat_rs.R

cor_stat_rsR Documentation

Calculate general stationary correlation.

Description

Calculate general stationary correlation.

Usage

cor_stat_rs(
  n_regime,
  base_ls,
  lagrangian_ls,
  par_base_ls,
  par_lagr_ls,
  lambda_ls,
  h_ls,
  h1_ls,
  h2_ls,
  u_ls,
  base_fixed = FALSE
)

Arguments

n_regime

Integer, number of regimes.

base_ls

List of base model, sep or fs for now. Or list of correlation matrices/arrays.

lagrangian_ls

List of Lagrangian model, lagr_tri or lagr_askey for now.

par_base_ls

List of parameters for the base model, used only when base_fixed = FALSE.

par_lagr_ls

List of parameters for the Lagrangian model. Used only when lagrangian_ls is not none.

lambda_ls

List of weight of the Lagrangian term, \lambda\in[0, 1].

h_ls

List of Euclidean distance matrix or array, used only when base_fixed = FALSE.

h1_ls

List of horizontal distance matrix or array, same dimension as h_ls. Used only when lagrangian_ls is not none.

h2_ls

List of vertical distance matrix or array, same dimension as h_ls. Used only when lagrangian_ls is not none.

u_ls

List of time lag, same dimension as h_ls.

base_fixed

Logical; if TRUE, base_ls is the list of correlation.

Details

It gives a list of general stationary correlation for n_regime regimes. See cor_stat for the model details. Model parameters are lists of length 1 or n_regime. When length is 1, same values are used for all regimes. If base_fixed = TRUE, the base is a list of correlation and par_base_ls and h_ls are not used.

Value

Correlations for the general stationary model. Same dimension of base_ls if base_fixed = TRUE.

See Also

Other correlation functions: cor_cauchy(), cor_exp(), cor_fs(), cor_lagr_askey(), cor_lagr_exp(), cor_lagr_tri(), cor_sep(), cor_stat()

Examples

# Fit general stationary model with sep base.
par_s <- list(nugget = 0.5, c = 0.01, gamma = 0.5)
par_t <- list(a = 1, alpha = 0.5)
par_base <- list(par_s = par_s, par_t = par_t)
h1 <- array(c(0, 5, -5, 0), dim = c(2, 2, 3))
h2 <- array(c(0, 8, -8, 0), dim = c(2, 2, 3))
h <- sqrt(h1^2 + h2^2)
u <- array(rep(c(1, 2, 3), each = 4), dim = c(2, 2, 3))
cor_stat_rs(
    n_regime = 2,
    base_ls = list("sep"),
    lagrangian_ls = list("none", "lagr_tri"),
    par_base_ls = list(par_base),
    par_lagr_ls = list(NULL, list(v1 = 10, v2 = 20)),
    lambda_ls = list(0, 0.2),
    h_ls = list(h),
    h1_ls = list(NULL, h1),
    h2_ls = list(NULL, h2),
    u_ls = list(u, u + 1)
)

# Fit general stationary model given fs as the base model.
h1 <- array(c(0, 5, -5, 0), dim = c(2, 2, 3))
h2 <- array(c(0, 8, -8, 0), dim = c(2, 2, 3))
h <- sqrt(h1^2 + h2^2)
u <- array(rep(c(0.1, 0.2, 0.3), each = 4), dim = c(2, 2, 3))
fit_base <- cor_fs(
    nugget = 0.5, c = 0.01, gamma = 0.5, a = 1, alpha = 0.5,
    beta = 0.0, h = h, u = u
)
par_lagr <- list(v1 = 5, v2 = 10)
cor_stat_rs(
    n_regime = 2,
    par_lagr_ls = list(par_lagr),
    h1_ls = list(h1),
    h2_ls = list(h2),
    u_ls = list(u, u + 1),
    lambda_ls = list(0, 0.8),
    base_ls = list(fit_base),
    lagrangian = list("lagr_tri", "lagr_askey"),
    base_fixed = TRUE
)


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