Description Usage Arguments Details Value Author(s) References See Also Examples
Computation of after-before differences around key days using using data K days before and after each key day.
1 | after.minus.before(data, operator)
|
data |
either a KDD object, a KDD.yearly.average object, or a matrix with an odd number of rows corresponding built as the |
operator |
a character string specifying the transformation of the raw values, must be one of |
If operator = "dmv"
(difference of mean values), the raw values y_{i-K},…,y_{i+K} of the time series are used to compute the difference:
D_i=≤ft(\frac{1}{K}∑_{k=1}^K y_{i+k}\right) - ≤ft(\frac{1}{K}∑_{k=1}^K y_{i-k}\right)=\frac{1}{K}∑_{k=1}^K (y_{i+k}-y_{i-k}),
where i is the date of the key day, K is the number of days considered after and before the key day (specified when data
is provided).
If operator = "dmpiv"
(difference of means of positive indicator values), the raw values y_{i-K},…,y_{i+K} are used to compute the difference:
D_i=≤ft(\frac{1}{K}∑_{k=1}^K 1(y_{i+k}>0)\right) - ≤ft(\frac{1}{K}∑_{k=1}^K 1(y_{i-k}>0)\right)=\frac{1}{K}∑_{k=1}^K \{1(y_{i+k}>0)-1(y_{i-k}>0)\},
where 1(\cdot) is the indicator function.
If operator = "dmgiv"
(difference of means of greater indicator values), the raw values y_{i-K},…,y_{i+K} are used to compute the difference:
D_i=≤ft(\frac{1}{K}∑_{k=1}^K 1(y_{i+k}>y_{i-k})\right) - ≤ft(\frac{1}{K}∑_{k=1}^K 1(y_{i-k}>y_{i+k})\right).
A numeric vector providing for each key day the value of the after-before difference.
Samuel Soubeyrand Samuel.Soubeyrand@avignon.inra.fr, Cindy E. Morris, E. Keith Bigg.
Soubeyrand, S., Morris, C. E. and Bigg, E. K. (2014). Analysis of fragmented time directionality in time series to elucidate feedbacks in climate data. Environmental Modelling and Software 61: 78-86.
KDD, KDD.yearly.average, kdd.from.raw.data, rain.site.6008
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #### load data for site 6008 (Callagiddy station)
data(rain.site.6008)
#### build KDD objects from raw data (site 6008: Callagiddy station)
## using a threshold value equal to 25
KDD=kdd.from.raw.data(raw.data=rain.site.6008,keyday.threshold=25,nb.days=20,
col.series=5,col.date=c(2,3,4),na.rm=TRUE,filter=NULL)
#### compute and plot after-before differences of KDD
par(mfrow=c(2,2), mar=c(5.1,4.1,4.1,4.1))
## using option dmpiv (difference of means of positive indicator values)
amb1=after.minus.before(KDD,"dmpiv")
plot(KDD["day"],amb1,type="l",xlab="Day",ylab="After-Before")
abline(h=0,lty="dashed",col="grey")
plot(KDD["day"],cumsum(amb1),type="l",xlab="Day",ylab="Cumul After-Before")
abline(h=0,lty="dashed",col="grey")
## using option dmv (difference of means of values)
amb2=after.minus.before(KDD,"dmv")
plot(KDD["day"],amb2,type="l",xlab="Day",ylab="After-Before")
abline(h=0,lty="dashed",col="grey")
plot(KDD["day"],cumsum(amb2),type="l",xlab="Day",ylab="Cumul After-Before")
abline(h=0,lty="dashed",col="grey")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.