lbhitrate: Compute Rolling Hit Rate From LBStart to LBEnd Compute...

Description Usage Arguments Examples

View source: R/lbhitrate.R

Description

Compute Rolling Hit Rate From LBStart to LBEnd Compute Rolling Hit Rate From LBStart to LBEnd.

Usage

1
lbhitrate(data, x, lbstart = 63, lbend = 0, position = "longshort")

Arguments

data

An 'xts' object containing log growths.

x

An 'xts' object containing predictions.

lbstart

The start of the lookback window.

lbend

The end of the lookback window.

position

Character for whether to return

  • All "longshort" bets (-1, 0, 1 for all non-NA)

  • Only "long" bets (0, 1 for all non-NA)

  • Only "short" bets (-1, 0 for all non-NA)

  • "alwayslong" (1 for all non-NA obs)

  • "alwaysshort" (-1 for all non-NA obs)

Examples

1
2
3
4
5
growth <- diff(log(stocks))
signal <- rollAR(growth, rep(1/9,9))

# Rolling 126-day long-short hitrate
lbhitrate(growth, signal, 126, 0, "longshort")

jmuhlenkamp/conditionalAR documentation built on Dec. 24, 2018, 6:55 a.m.