pcMean-methods | R Documentation |
Compute periodic mean, generic function.
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, ...)
object |
an object for which periodic mean makes sense. |
nseasons |
number of seasons. |
... |
further arguments for methods. |
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)
.
numeric or matrix for the methods described here, see section ‘Details’.
signature(object = "matrix")
signature(object = "numeric")
signature(object = "PeriodicMTS")
signature(object = "PeriodicTS")
signature(object = "VirtualPeriodicArmaModel")
Georgi N. Boshnakov
pcApply
which applies an arbitrary function by season
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.