pclsdf: Fit PAR models using least squares

View source: R/pcls.R

pclsdfR Documentation

Fit PAR models using least squares

Description

Fit PAR models using least squares. The model may contain intercepts and linear trends, seasonal or non-seasonal.

Usage

pclsdf(x, d, lags = integer(0), sintercept = TRUE, sslope = FALSE,
       intercept = FALSE, slope = FALSE, xreg, contrasts = NULL,
       seasonof1st = NULL, coefonly = FALSE)

Arguments

x

time series, a numeric vector.

d

period, an integer.

lags

an integer vector, typically 1:p, where p is the order of the autoregression. The same lags are used for all seasons.

sintercept

if TRUE include seasonal intercepts.

sslope

if TRUE include seasonal linear trend.

intercept

if TRUE include non-seasonal intercept.

slope

if TRUE include non-seasonal linear trend.

xreg

additional regressors, not used currently.

contrasts

contrasts to use for the seasons factor variable.

seasonof1st

season of the first observation in the time series, see Details.

coefonly

if TRUE, return only the parameters of the fitted model, otherwise include also the object returned by lm.

Details

This function fits PAR models by the method of least squares. Seasonal intercepts are included by default. Non-seasonal intercepts are available, as well as seasonal and non-seasonal linear trend. Separate arguments are provided, so that any combination of seasonal and non-seasonal intercepts and slopes can be specified.

If coefonly is TRUE, pclsdf returns only the estimated parameters, otherwise it includes additional statistical information, see section Note for the current details.

Value

A list with the components listed below. Some components are present only if included in the model specification.

par

the PAR coefficients, a matrix with a row for each season.

sintercept

(if specified) seasonal intercepts, a numeric vector.

sigma2hat

innovation variances.

formula.char

the formula used in the call of lm, a character string.

fit

(if coefonly = FALSE) the fitted object obtained from lm.

Note

Currently, pclsdf prepares a model formula according to the specification and calls lm to do the fitting. Component "fit" in the result (available when coefonly = FALSE) contains the raw fitted object returned by lm. Statistical inference based on this object would, in general, not be justified for correlated data.

todo: currently some of the parameters are returned only via the fitted object from lm.

Author(s)

Georgi N. Boshnakov

See Also

pclspiar,

Examples

## data(dataFranses1996)
cu <- pcts(dataFranses1996[ , "CanadaUnemployment"])
cu <- window(cu, start = availStart(cu), end = availEnd(cu))

pclsdf(cu, 4, 1:2, sintercept = TRUE)

pclsdf(austres, 4, lags = 1:3)
pclsdf(austres, 4, lags = 1:3, sintercept = TRUE)
pclsdf(austres, 4, lags = 1:3, sintercept = TRUE, sslope = TRUE)

x <- rep(1:4,10)
pclsdf(x, 4, lags = 1:3, sintercept = TRUE, sslope = TRUE)

## this is for the version when contrasts arg. was passed on directly to lm.
## tmp1 <- pclsdf(austres, 4, lags = 1, sintercept = FALSE, sslope = TRUE,
##                contrasts = list(Season = "contr.sum" ))

GeoBosh/pcts documentation built on Dec. 8, 2023, 9:57 p.m.