Learn R Programming

pcts (version 0.15.8)

pcarma_unvec: Functions for work with a simple list specification of pcarma models

Description

Handle a simple list specification of pcarma models. Functions to convert to and from a representation appropriate for handing on to optimisation functions.

Usage

pcarma_prepare(model, type)
pcarma_unvec(model)
pcarma_tovec(model)

Value

for pcarma_unvec, a list with components:

p

autoregressive orders, numeric vector

q

moving average orders, numeric vector

si2

innovation variances

phi

autoregressive parameters

theta

moving average parameters

for pcarma_tovec, a list with components:

p

autoregressive order

q

moving average order

param

parameters of the model, a numeric vector. TODO: give the order of the parameters in the vector!

for pcarma_prepare, a list as pcarma_unvec, see also Details.

Arguments

model

specification of a pcarma model, a list, see Details.

type

not used.

Author

Georgi N. Boshnakov

Details

These functions work with a specification of a pcarma model as a list with components period, p, q, param, phi, theta and si2, see also section `Values'. The functions do not necessarily need or examine all these components.

Argument model is a list with components as accepted by pcarma_prepare. Details are below but the guiding rule is that there are sensible defaults for absent components.

pcarma_prepare gives a standard representation of model, in the sense that it ensures that the model has components period, p and q, such that p and q are vectors of length period. pcarma_prepare does not examine any other components of the model. (TODO: do the same for the innovation variance?)

If model$period is NULL, pcarma_prepare sets it to the length of the longer of model$p and model$q. If model$p is a scalar it is extended with rep(model$p, period). Missing or NULL model$p is equivalent to model$p = 0. model$q is processed analogously.

The net effect is that period, p and q will be set as expected as long as period is given or at least one of the other two is of length equal to the period. A warning is issued if period <= 1 (it is all too easy to give scalar values for p and q and forget to set the period, in which case period will be deduced to be one).

A number of functions (including pcarma_tovec and pcarma_unvec) dealing with the list representation of pcarma models start by calling pcarma_prepare to avoid the need for handling all possible cases.

pcarma_tovec returns a list with components p, q and param, where param is a numeric vector containing the pcarma parameters and the innovations variances and thus is suitable for optimisation functions. Notice that it is component param that is a vector. The reason that pcarma_tovec returns a list, is that the caller may need to do further work before calling a generic optimisation function. For exampe, it may wish to dop the variances from the vector.

pcarma_unvec(model) performs the inverse operation. It takes a list like that produced by pcarma_tovec and converts it to a detailed list containing the components of the model.