sl2acfbase {lagged} | R Documentation |
Convert between vector and season-lag representations
Description
Convert between vector and season-lag representations of autocovariances of multivariate and periodically correlated time series.
Usage
sl2acfbase(mat, maxlag, fullblocks = FALSE)
acfbase2sl(acf)
sl2vecacf(mat, maxlag, fullblocks = FALSE)
Arguments
acf |
an acf as returned by base R |
mat |
a matrix containing autocovariances in season-lag arrangement. |
maxlag |
maximal lag, a positive integer. |
fullblocks |
if TRUE, keep full blocks only. |
Details
These functions rearrange autocovariances and autocorrelations between
the native season-lag arrangement in package “pcts” and the vector
representations of the corresponding mutivariate models (vector of
seasons representation of periodic models). Variable s
is taken
be season s
and vice versa in the opposite direction.
“acfbase” in the names of the functions refers to the representation
returned by base function acf
.
acfbase2sl
rearranges a multivariate acf in season-lag form.
sl2acfbase
rearranges a season-lag form into the multivariate
form used by base function acf
.
sl2vecacf
is similar to sl2acfbase
but the result is
such that the lag is in the third dimension and r[ , , k]
is
Cov(X_{t}, X_{t-k})
(not its transpose). See also the examples
below and in acf2Lagged
.
Value
for acfbase2sl
, a matrix.
for sl2acfbase
and sl2vecacf
, an array.
Author(s)
Georgi N. Boshnakov
Examples
## use a character matrix to illustrate the positions of the elements
matsl <- rbind(paste0("Ra", 0:3), paste0("Rb", 0:3))
matsl
## convert to what I consider "standard" vec format R(k)=EX_tX_{t-k}'
sl2vecacf(matsl)
## convert to the format from acf() (R(k) is the transposed from mine).
sl2acfbase(matsl)
identical(sl2vecacf(matsl), aperm(sl2acfbase(matsl), c(3, 2, 1))) # TRUE
## by default the conversion is lossles;
## so this contains all values from the original and some NA's:
sl2acfbase(matsl)
## the orignal, matsl, can be restored:
acfbase2sl(sl2acfbase(matsl))
identical(acfbase2sl(sl2acfbase(matsl)), matsl) # TRUE
## this drops some values (if necessary) to keep complete block only
sl2acfbase(matsl, fullblocks = TRUE)