ols function for return prediction

ols_pred(train_data, test_data, config = list(), fast = TRUE)

Arguments

train_data

data frame with stock_id, date, return_label and features

test_data

data frame with stock_id, date and features

config

empty list, as ols does not need any configuration

fast

logical, if TRUE, use fastLm from RcppArmadillo, else use lm from base R

Value

tibble with stock_id, date and pred_return matching the test_data

Examples

if (FALSE) {
data(data_ml)
train_data_ex <- data_ml[1:100,c(1,2,96,5:10)]
test_data_ex <- data_ml[101:150,c(1,2,5:10)]
ols_pred(train_data_ex, test_data_ex, config=list(), fast=TRUE)
ols_pred(train_data_ex, test_data_ex, config=list(), fast=FALSE)
}