## Loading required package: xts
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## Loading required package: TTR
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
## 
## ######################### Warning from 'xts' package ##########################
## #                                                                             #
## # The dplyr lag() function breaks how base R's lag() function is supposed to  #
## # work, which breaks lag(my_xts). Calls to lag(my_xts) that you type or       #
## # source() into this session won't work correctly.                            #
## #                                                                             #
## # Use stats::lag() to make sure you're not using dplyr::lag(), or you can add #
## # conflictRules('dplyr', exclude = 'lag') to your .Rprofile to stop           #
## # dplyr from breaking base R's lag() function.                                #
## #                                                                             #
## # Code in packages is not affected. It's protected by R's namespace mechanism #
## # Set `options(xts.warn_dplyr_breaks_lag = FALSE)` to suppress this warning.  #
## #                                                                             #
## ###############################################################################
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:xts':
## 
##     first, last
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## Loading required package: ggplot2
## Loading required package: lattice
## [1] "SPY"
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning in geom_text(aes(x = which.max(accuracy), y = max(accuracy), label = paste("Max:", : All aesthetics have length 1, but the data has 20 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
##   a single row.

## Confusion Matrix and Statistics
## 
##           Reference
## Prediction   -1    0    1
##         -1  879    3  431
##         0     0    0    0
##         1   542   21 1225
## 
## Overall Statistics
##                                           
##                Accuracy : 0.6785          
##                  95% CI : (0.6617, 0.6949)
##     No Information Rate : 0.534           
##     P-Value [Acc > NIR] : < 2.2e-16       
##                                           
##                   Kappa : 0.3545          
##                                           
##  Mcnemar's Test P-Value : 5.423e-08       
## 
## Statistics by Class:
## 
##                      Class: -1 Class: 0 Class: 1
## Sensitivity             0.6186 0.000000   0.7397
## Specificity             0.7417 1.000000   0.6104
## Pos Pred Value          0.6695      NaN   0.6851
## Neg Pred Value          0.6969 0.992261   0.6717
## Prevalence              0.4582 0.007739   0.5340
## Detection Rate          0.2835 0.000000   0.3950
## Detection Prevalence    0.4234 0.000000   0.5766
## Balanced Accuracy       0.6801 0.500000   0.6751

##           Sensitivity Specificity Precision Recall    F1
## Class: -1       0.619       0.742     0.669  0.619 0.643
## Class: 0        0.000       1.000        NA  0.000    NA
## Class: 1        0.740       0.610     0.685  0.740 0.711