aggregate.weeks.to.months: Aggregate a weekly time series to monthly

Description Usage Arguments Value Author(s) See Also Examples

Description

Aggregate measurements from a weekly time series into a monthly time series.

Usage

1
2
3
4
   AggregateWeeksToMonths(weekly.series,
                          membership.fraction = NULL,
                          trim.left = TRUE,
                          trim.right = NULL)

Arguments

weekly.series

A numeric vector or matrix of class zoo giving the weekly time series to be aggregated. The index must be convertible to class Date.

membership.fraction

A optional numeric vector corresponding to weekly.series, giving the fraction of each week's observation attributable to the month containing the week's first day. If missing, then weeks will be split across months in proportion to the number of days in each month.

trim.left

Logical indicating whether the first observation in the monthly aggregate should be removed.

trim.right

Logical indicating whether the final observation in the monthly aggregate should be removed.

Value

A zoo-matrix (if weekly.series is a matrix) or vector (otherwise) containing the aggregated values of weekly.series.

Author(s)

Steven L. Scott steve.the.bayesian@gmail.com

See Also

AggregateTimeSeries

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  week.ending <- as.Date(c("2011-11-05",
                           "2011-11-12",
                           "2011-11-19",
                           "2011-11-26",
                           "2011-12-03",
                           "2011-12-10",
                           "2011-12-17",
                           "2011-12-24",
                           "2011-12-31"))

  weekly.values <- zoo(rnorm(length(week.ending)), week.ending)
  monthly.values <- AggregateWeeksToMonths(weekly.values)

michelletran/bsts documentation built on March 29, 2020, 12:58 a.m.