Learn R Programming

timeSeries (version 4041.111)

periodical: End-of-Period series, stats, and benchmarks

Description

Computes periodical statistics back to a given period.

Usage

endOfPeriodSeries(x, 
    nYearsBack = c("1y", "2y", "3y", "5y", "10y", "YTD"))

endOfPeriodStats(x, nYearsBack = c("1y", "2y", "3y", "5y", "10y", "YTD")) endOfPeriodBenchmarks(x, benchmark = ncol(x), nYearsBack = c("1y", "2y", "3y", "5y", "10y", "YTD"))

Value

for endOfPeriodSeries, a "timeSeries",

for endOfPeriodStats, a data frame,

for endOfPeriodBenchmarks - currently NULL (invisibly), the function is unfinished.

Arguments

x

an end-of-month recorded multivariate "timeSeries" object. One of the columns holds the benchmark series specified by argument benchmark,

nYearsBack

a period string. How long back should the series be treated? Options include values from 1 year to 10 years, and year-to-date: "1y", "2y", "3y", "5y", "10y", "YTD".

benchmark

an integer giving the position of the benchmark series in x. By default this is the last column of x.

Details

endOfPeriodSeries extract the data for the last few years, as specified by argument nYearsBack.

endOfPeriodStats computes basic exploratory statistics for the last few years in the data.

endOfPeriodBenchmarks returns benchmarks back to a given period.

x must be end of month data. Such series can be created using functions like align, alignDailySeries, daily2monthly.

Examples

Run this code
## load series: column 1:3 Swiss market, column 8 (4) benchmark
x <- 100 * LPP2005REC[, c(1:3, 8)]
colnames(x)
x <- daily2monthly(x)
x
   
## Get the Monthly Series - 
endOfPeriodSeries(x, nYearsBack="1y")
   
## Compute the Monthly Statistics
endOfPeriodStats(x, nYearsBack="1y")
   
## Compute the Benchmark
endOfPeriodBenchmarks(x, benchmark=4) 

Run the code above in your browser using DataLab