pcMean-methods: Compute periodic mean

pcMean-methodsR Documentation

Compute periodic mean

Description

Compute periodic mean, generic function.

Usage

pcMean(object, ...)

## S4 method for signature 'numeric'
pcMean(object, nseasons, ...)

## S4 method for signature 'matrix'
pcMean(object, nseasons, ...)

## S4 method for signature 'PeriodicTS'
pcMean(object, ...)

## S4 method for signature 'PeriodicMTS'
pcMean(object, ...)

Arguments

object

an object for which periodic mean makes sense.

nseasons

number of seasons.

...

further arguments for methods.

Details

For univariate periodic time series, pcMean computes the mean for each season and returns a named vector. For multivariate periodic time series, the result is a matrix with one column for each variable.

The methods for "numeric" and "matrix" are equivalent to those for "PeriodicTS" and "PeriodicMTS", respectively. The difference is that the latter two don't need argument nseasons and take the names of the seasons from object.

Argument na.rm = TRUE can be used to omit NA's.

In the univariate case, when length(object) is an integer multiple of the number of seasons the periodic mean is equivalent to computing the row means of matrix(object, nrow = nseasons).

Value

numeric or matrix for the methods described here, see section ‘Details’.

Methods

signature(object = "matrix")
signature(object = "numeric")
signature(object = "PeriodicMTS")
signature(object = "PeriodicTS")
signature(object = "VirtualPeriodicArmaModel")

Author(s)

Georgi N. Boshnakov

See Also

pcApply which applies an arbitrary function by season

Examples

pcMean(pcts(presidents))
pcMean(pcts(presidents), na.rm = TRUE)

pcMean(pcts(dataFranses1996)[2:5], na.rm = TRUE)

pcMean(1:20, nseasons = 4)
m <- matrix(1:20, nrow = 4)
all(apply(m, 1, mean) == pcMean(1:20, nseasons = 4)) # TRUE

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