apply.rolling: calculate a function over a rolling window

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Creates a results timeseries of a function applied over a rolling window.

Usage

1
apply.rolling(R, width, trim = TRUE, gap = 12, by = 1, FUN = "mean", ...)

Arguments

R

an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns

width

number of periods to apply rolling function window over

trim

TRUE/FALSE, whether to keep alignment caused by NA's

gap

numeric number of periods from start of series to use to train risk calculation

by

calculate FUN for trailing width points at every by-th time point.

FUN

any function that can be evaluated using a single set of returns (e.g., rolling beta won't work, but Return.annualized will)

...

any other passthru parameters

Details

Wrapper function for rollapply to hide some of the complexity of managing single-column zoo objects.

Value

A timeseries in a zoo object of the calculation results

Author(s)

Peter Carl

See Also

apply
rollapply

Examples

1
2

PerformanceAnalytics documentation built on Feb. 6, 2020, 5:11 p.m.