Skip to contents

Compute exceedances of a threshold for a time series

Usage

exceedances(x, ...)

# Default S3 method
exceedances(x, ...)

# S3 method for class 'nhpp'
exceedances(x, ...)

# S3 method for class 'ts'
exceedances(x, ...)

# S3 method for class 'double'
exceedances(x, threshold = mean(x, na.rm = TRUE), ...)

Arguments

x

a numeric vector coercible into a stats::ts object

...

arguments passed to methods

threshold

A value above which to exceed. Default is the mean()

Value

An ordered integer vector giving the indices of the values of x that exceed the threshold.

Examples

# Retrieve exceedances of the series mean
fit_nhpp(DataCPSim, tau = 826) |> 
  exceedances()
#>   [1]   20   51   60  221  226  233  271  308  354  415  488  548  553  556  557
#>  [16]  561  562  566  571  575  581  583  589  590  596  598  604  605  609  613
#>  [31]  614  615  618  619  621  623  628  629  633  634  642  645  646  647  649
#>  [46]  654  655  656  657  659  663  666  668  671  672  677  678  680  681  687
#>  [61]  688  694  697  698  704  705  706  708  711  713  716  717  719  722  725
#>  [76]  727  728  729  733  738  741  746  748  749  753  755  761  763  765  768
#>  [91]  771  774  777  780  784  785  790  791  792  794  798  803  809  810  813
#> [106]  817  822  823  824  825  826  828  830  831  832  833  834  836  837  838
#> [121]  839  840  841  842  843  844  845  846  848  849  850  851  852  853  854
#> [136]  856  857  858  859  860  861  862  863  864  865  866  867  868  870  871
#> [151]  872  875  876  877  878  879  880  881  882  883  884  885  886  887  888
#> [166]  889  890  891  892  893  894  895  896  897  898  899  900  901  903  904
#> [181]  905  907  908  910  911  912  914  915  916  918  919  920  921  923  924
#> [196]  926  928  929  930  931  932  933  934  935  936  937  938  939  940  941
#> [211]  943  944  945  946  947  948  949  950  951  953  954  955  957  959  960
#> [226]  961  962  963  964  966  967  968  969  970  971  972  973  974  975  976
#> [241]  977  978  979  980  981  982  983  984  985  986  987  988  989  990  991
#> [256]  992  993  994  995  996  997  998  999 1000 1001 1002 1003 1004 1005 1006
#> [271] 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021
#> [286] 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036
#> [301] 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
#> [316] 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066
#> [331] 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081
#> [346] 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096

# Retrieve exceedances of a supplied threshold
fit_nhpp(DataCPSim, tau = 826, threshold = 200) |> 
  exceedances()
#>  [1]  953  973  982  988  998  999 1003 1007 1018 1032 1033 1039 1041 1049 1055
#> [16] 1058 1064 1066 1070 1087 1089