Skip to contents

Fit PAR model using sample autocorrelations.

Usage

num2pcpar(x, order, result = NULL, ...)

Arguments

x

time series, a numeric vector.

order

PAR order, a single number or a vector with one entry for each season.

result

what to return, the default is to return the full model, see Details.

...

passed on to calc_peracf.

Details

Computes the periodic autocorrelations and fits a PAR model using the Periodic Levinson-Durbin algorithm.

The order is a vector of non-negative integers, specifying the autoregressive orders for each season. If order is a single number, then all seasons have that order.

mean controls centering in the computation of the autocorrelations. If mean is numeric, then subtract the supplied mean before computing the autocovariances. If mean is TRUE, the default, compute and subtract the sample periodic mean before computing the autocovariances. If mean is FALSE, do not centre the series, i.e. assume that the mean is zero.

If result is NULL, the default, returns the full model. If result = "coef", returns the PAR coefficients only (currently any value of result other than NULL has this effect).

Value

The coefficients of the fitted model or a list with components:

mean

the mean, set as described in Details.

coef

forward prediction coefficients.

scale

standard deviations of the innovations.

Author

Georgi N. Boshnakov

See also

fitPM which uses num2pcpar for calculations

Examples

if (FALSE) {
simts1 <- matrix(rnorm(100), nrow = 4)

num2pcpar(simts1, order = c(3,2,2,2), period = 4 )
num2pcpar(simts1, order = c(3,2,1,2), period = 4 )
pdSafeParOrder(c(3,2,1,2))
pdSafeParOrder(c(3,2,2,1))
num2pcpar(simts1, order = c(3,2,2,1), period = 4 )
num2pcpar(simts1, order = pdSafeParOrder(c(3,2,2,1)), period = 4 )

num2pcpar(simts1, order = c(3,2,1,2), period = 4 )
num2pcpar(simts1, order = c(3,2,1,2), period = 4, mean = rep(0,4) )
num2pcpar(simts1, order = c(3,2,1,2), period = 4, mean = FALSE )
num2pcpar(simts1, order = c(3,2,1,2), period = 4, mean = FALSE )$coef@m -
       num2pcpar(simts1, order = c(3,2,1,2), period = 4 )$coef@m
}