Skip to contents

The rolling_beta() is a generic S3 function that builds upon 'type-safe'-esque workflows limited to classes in in base R, and the package-wide dependencies. Ie. class in, class out.

Usage

rolling_beta(x, y, n = 10)

Arguments

x, y

((double), (double)). A pair of vectors.

n

(integer). An integer of length 1.

Value

A double vector with the same length of x

Author

Serkan Korkmaz

Examples

## load Bitcoin (BTC)
## series
data(BTC, package = "talib")

## calculate the rolling statistic
## between Open and Close
output <- talib::rolling_beta(x = BTC[[1]], y = BTC[[4]])

## display the results
utils::tail(output)
#> [1] 0.167234235 0.141477872 0.212146797 0.004301746 0.069313219 0.054557930