Convert between periodic centering and intercepts
permean2intercept.Rd
Convert a periodic mean to periodic intercept and vice versa.
Arguments
- mean
periodic mean, numeric.
- coef
PAR coefficients, matrix.
- order
PAR order, vector of positive integers.
- nseasons
number of seasons, a.k.a. period.
- intercept
periodic intercepts, numeric.
Details
A PAR model can be written in mean corrected or intercept form.
permean2intercept
calculates the intercepts from the means,
while intercept2permean
does the inverse (means from
intercepts).
No check is made for periodic stationarity of the model. Converting from mean corrected to intercept form allways succeeds and in fact the means do not need to be means. In the opposite direction there may be problems due to unit roots and similar features.
Examples
mu <- c(1, 2)
pm1 <- PeriodicArModel(matrix(c(0.5, 0.5), nrow = 2), order = rep(1, 2), sigma2 = 1, mean = mu)
cc <- permean2intercept(mu, pm1@ar@coef, c(1,1))
cc
#> [1] 0.0 1.5
intercept2permean(cc, pm1@ar@coef, c(1,1))
#> [1] 1 2
d <- 4
mu <- 1:d
co <- rep(0.5, d)
pm1 <- PeriodicArModel(matrix(co, nrow = d), order = rep(1, d), sigma2 = 1, mean = mu)
cc <- permean2intercept(mu, pm1@ar@coef, order = rep(1, d))
cc
#> [1] -1.0 1.5 2.0 2.5
intercept2permean(cc, pm1@ar@coef, order = rep(1, d) )
#> [1] 1 2 3 4