predict_momentum_pocket: Predicts momentum using a regularized pocket algorithm

Description Usage Arguments Value

View source: R/momentum_prediction.R

Description

See regularized_pocket() for a description of the algorithm used. Either uses the weight_elimination constant given or cross-validates at each trading period to choose one of the selected. If there is at least one cv asset, then each stage runs once with previous weights and once from linear regression weights, then picks whichever does best on cv error

Usage

1
2
3
4
5
6
7
8
predict_momentum_pocket(
  data,
  feature_colname,
  weight_elimination,
  maxit,
  momentum_colname = "momentum",
  max_cv_window = NULL
)

Arguments

data

A tibble of class @eval{AGG_WINDOW_CLASS_NAME} as returned from aggregate_price_and_mean_windows, with an added column of column name momentum_colname holding the momentum.

feature_colname

The column name of the features to use. Should be a list column, each list entry holding a double vector.

weight_elimination

A double vector, at each stage picks the one which has performed best in the past cv window (or all of the past, whichever is selected)

maxit

the maximum number of iterations

momentum_colname

The name of the column holding the true momentum values (as a string), defaults to "momentum". Should be (possibly negative) momentum values (see evaluate_momentum_at_window)

max_cv_window

If NULL then checks over all past error, otherwise only checks the past max_cv_window time steps to determine error.

Value

A tibble like data but with a pocket_prediction pocket_error, and pocket_weight_elimination, columns holding the absolute value momentum prediction, whether it was an error, and the elimination weight used.


benSepanski/pfselect documentation built on May 1, 2020, 1:57 p.m.