splits
fin-splits.Rd
Searches for outlier splits in a "timeSeries"
object.
Arguments
- x
a
"timeSeries"
object.- sd
-
numeric(1)
; deviations of how many standard deviations to consider too big? Can be fractional. E.g., 5 means that values larger or smaller than five times the standard deviation of the series will be detected. - complement
a logical flag, should the outlier series or its complements be returned?
- ...
arguments to be passed.
Details
This function finds splits in financial price or index series. If a price or index is splitted we observe a big jump of several standard deviations in the returns, which is identified usually as an outlier.
Examples
## Create a Return Series with a Split -
data <- runif(12, -1, 1)
data[6] <- 20
x <- timeSeries(data, timeCalendar(), units="RUNIF")
x
#> GMT
#> RUNIF
#> 2024-01-01 0.02818446
#> 2024-02-01 0.81353192
#> 2024-03-01 0.32781337
#> 2024-04-01 -0.86725243
#> 2024-05-01 0.16026217
#> 2024-06-01 20.00000000
#> 2024-07-01 0.88502200
#> 2024-08-01 -0.99927651
#> 2024-09-01 -0.36096099
#> 2024-10-01 -0.24913208
#> 2024-11-01 0.29574272
#> 2024-12-01 -0.72810981
## Search for the Split:
splits(x, sd=3, complement=TRUE)
#> GMT
#> RUNIF
#> 2024-01-01 0.02818446
#> 2024-02-01 0.81353192
#> 2024-03-01 0.32781337
#> 2024-04-01 -0.86725243
#> 2024-05-01 0.16026217
#> 2024-07-01 0.88502200
#> 2024-08-01 -0.99927651
#> 2024-09-01 -0.36096099
#> 2024-10-01 -0.24913208
#> 2024-11-01 0.29574272
#> 2024-12-01 -0.72810981
splits(x, sd=3, complement=FALSE)
#> GMT
#> RUNIF
#> 2024-06-01 20