Create returnPrediction S3 object

create_return_prediction(data, label)

Arguments

data

Data that will be used for prediction

label

Column name of the actual return

Value

returnPrediction S3 object

Examples

# Initialize the returnPrediction object
data <- tibble::tibble(
  stock_id = 1:100,
  date = seq.Date(Sys.Date(), by = "day", length.out = 100),
  return_label = runif(100)
)
# Create the returnPrediction object
rp <- create_return_prediction(data, "return_label")
# Check the initial setup
print(rp)
#> $models
#> list()
#> 
#> $predictions
#> # A tibble: 100 × 2
#>    stock_id date      
#>       <int> <date>    
#>  1        1 2024-05-22
#>  2        2 2024-05-23
#>  3        3 2024-05-24
#>  4        4 2024-05-25
#>  5        5 2024-05-26
#>  6        6 2024-05-27
#>  7        7 2024-05-28
#>  8        8 2024-05-29
#>  9        9 2024-05-30
#> 10       10 2024-05-31
#> # ℹ 90 more rows
#> 
#> $actual_returns
#> # A tibble: 100 × 3
#>    stock_id date       actual_return
#>       <int> <date>             <dbl>
#>  1        1 2024-05-22         0.806
#>  2        2 2024-05-23         0.814
#>  3        3 2024-05-24         0.404
#>  4        4 2024-05-25         0.218
#>  5        5 2024-05-26         0.418
#>  6        6 2024-05-27         0.669
#>  7        7 2024-05-28         0.508
#>  8        8 2024-05-29         0.660
#>  9        9 2024-05-30         0.512
#> 10       10 2024-05-31         0.836
#> # ℹ 90 more rows
#> 
#> $errors
#> # A tibble: 100 × 2
#>    stock_id date      
#>       <int> <date>    
#>  1        1 2024-05-22
#>  2        2 2024-05-23
#>  3        3 2024-05-24
#>  4        4 2024-05-25
#>  5        5 2024-05-26
#>  6        6 2024-05-27
#>  7        7 2024-05-28
#>  8        8 2024-05-29
#>  9        9 2024-05-30
#> 10       10 2024-05-31
#> # ℹ 90 more rows
#> 
#> attr(,"class")
#> [1] "returnPrediction"