regul.screen.Rd
Seek for the best combination of the number of observation, the interval between two successive observation and the position of the first observation in the regulated time series to match as much observations of the initial series as possible
a vector with times corresponding to the observations in the irregular initial time series
a vector of the same length as x
, with the weight to give to each observation. A value of 0 indicates to ignore an observation. A value of 1 gives a normal weight to an observation. A higher value gives more importance to the corresponding observation. You can increase weight of observations around major peaks and pits, to make sure they are not lost in the regulated time series. If weight=NULL
(by default), then a weight of 1 is used for all observations
a vector with all time values for the first observation in the regulated time series to be tested
a vector with all the frequencies to be screened
a vector with all time intervals to screen. deltat
is the inverse of frequency
. Only one of these two arguments is required. If both are provided, frequency
supersedes deltat
it is possible to tolerate some differences in the time between two matching observations (in the original irregular series and in the regulated series). If tol=0
both values must be strictly identical; a higher value allows some fuzzy matching. tol
must be a round fraction of deltat
and cannot be higher than it, otherwise, it is adjusted to the closest acceptable value. By default, tol=deltat/5
the type of window to use for the time-tolerance: "left"
, "right"
, "both"
(by default) or "none"
. If tol.type="left"
, corresponding x
values are seeked in a window ]xregul-tol, xregul]. If tol.type="right"
, they are seeked in the window [xregul, xregul+tol[. If tol.type="both"
, then they are seeked in the window ]xregul-tol, xregul+tol]. If several observations are in this window, the closest one is used. Finally, if tol.type="none"
, then all observations in the regulated time series are interpolated (even if exactly matching observations exist!)
Whatever the efficiency of the interpolation procedure used to regulate an irregular time series, a matching, non-interpolated observation is always better than an interpolated one! With very irregular time series, it is often difficult to decide which is the better regular time-scale in order to interpolate as less observations as possible. regul.screen()
tests various combinations of number of observation, interval between two observations and position of the first observation and allows to choose the combination that best matches the original irregular time series. To choose also an optimal value for tol
, use regul.adj()
concurrently.
A list containing:
a vector with the adjusted values of tol
for the various values of deltat
a table indicating the maximum value of n
for all combinations of deltat
and xmin
to avoid any extrapolation
a table indicating the number of matching observations (in the tolerance window) for all combinations of deltat
and xmin
a table indicating the number of exactly matching observations (with a tolerance window equal to zero) for all combinations of deltat
and xmin
data(releve)
# This series is very irregular, and it is difficult
# to choose the best regular time-scale
releve$Day
#> [1] 1 51 108 163 176 206 248 315 339 356 389 449 480 493 501
#> [16] 508 522 554 568 597 613 624 639 676 697 723 751 786 814 842
#> [31] 863 877 891 906 922 940 954 971 983 999 1010 1027 1038 1054 1069
#> [46] 1081 1094 1110 1129 1143 1156 1173 1186 1207 1226 1235 1249 1271 1290 1314
#> [61] 1325
length(releve$Day)
#> [1] 61
intervals <- releve$Day[2:61]-releve$Day[1:60]
intervals
#> [1] 50 57 55 13 30 42 67 24 17 33 60 31 13 8 7 14 32 14 29 16 11 15 37 21 26
#> [26] 28 35 28 28 21 14 14 15 16 18 14 17 12 16 11 17 11 16 15 12 13 16 19 14 13
#> [51] 17 13 21 19 9 14 22 19 24 11
range(intervals)
#> [1] 7 67
mean(intervals)
#> [1] 22.06667
# A combination of xmin=1, deltat=22 and n=61 seems correct
# But is it the best one?
regul.screen(releve$Day, xmin=0:11, deltat=16:27, tol=1.05)
#> $tol
#> d=16 d=17 d=18 d=19 d=20 d=21 d=22 d=23
#> 1.066667 1.062500 1.058824 1.055556 1.052632 1.050000 1.047619 1.045455
#> d=24 d=25 d=26 d=27
#> 1.043478 1.041667 1.040000 1.038462
#>
#> $n
#> d=16 d=17 d=18 d=19 d=20 d=21 d=22 d=23 d=24 d=25 d=26 d=27
#> x=0 83 78 74 70 67 64 61 58 56 54 51 50
#> x=1 83 78 74 70 67 64 61 58 56 53 51 50
#> x=2 83 78 74 70 67 64 61 58 56 53 51 50
#> x=3 83 78 74 70 67 63 61 58 56 53 51 49
#> x=4 83 78 74 70 67 63 61 58 56 53 51 49
#> x=5 83 78 74 70 67 63 61 58 56 53 51 49
#> x=6 83 78 74 70 66 63 60 58 55 53 51 49
#> x=7 83 78 74 70 66 63 60 58 55 53 51 49
#> x=8 83 78 74 70 66 63 60 58 55 53 51 49
#> x=9 83 78 74 70 66 63 60 58 55 53 51 49
#> x=10 83 78 74 70 66 63 60 58 55 53 51 49
#> x=11 83 78 74 70 66 63 60 58 55 53 51 49
#>
#> $nbr.match
#> d=16 d=17 d=18 d=19 d=20 d=21 d=22 d=23 d=24 d=25 d=26 d=27
#> x=0 9 12 13 6 8 5 5 5 10 12 10 12
#> x=1 10 15 12 6 8 9 5 9 11 9 7 12
#> x=2 13 9 11 10 11 11 8 11 14 9 8 13
#> x=3 13 10 10 7 9 12 10 11 13 6 8 7
#> x=4 14 9 8 10 7 9 11 7 11 5 7 9
#> x=5 10 11 6 6 7 6 8 6 8 10 5 5
#> x=6 12 13 4 7 7 1 7 8 5 7 6 5
#> x=7 9 11 5 8 11 4 9 6 6 9 7 2
#> x=8 10 11 9 11 11 14 12 6 4 4 7 5
#> x=9 13 11 9 13 12 19 9 6 4 6 4 3
#> x=10 14 10 13 13 13 17 7 10 4 5 5 7
#> x=11 14 9 14 12 8 9 3 9 5 5 7 6
#>
#> $nbr.exact.match
#> d=16 d=17 d=18 d=19 d=20 d=21 d=22 d=23 d=24 d=25 d=26 d=27
#> x=0 3 7 4 1 2 1 2 2 2 1 2 3
#> x=1 3 3 6 4 3 3 2 1 5 7 3 7
#> x=2 4 5 2 1 3 5 1 6 4 2 2 2
#> x=3 6 1 3 5 5 3 5 4 5 0 3 4
#> x=4 3 4 5 1 1 5 4 1 4 4 3 2
#> x=5 5 4 0 4 1 1 2 2 2 1 1 3
#> x=6 2 3 1 1 5 0 2 3 2 5 1 0
#> x=7 5 6 3 2 2 0 4 3 2 1 4 2
#> x=8 2 2 1 5 4 4 3 0 2 3 2 0
#> x=9 3 3 5 4 5 10 5 3 0 0 1 3
#> x=10 8 6 3 4 3 5 1 3 2 3 1 0
#> x=11 3 1 5 5 5 2 1 4 2 2 3 4
#>
# Now we can tell that xmin=9, deltat=21, n=63, with tol=1.05
# is a much better choice!