rangemean.tstat | R Documentation |
Function to perform a range-mean regression, trimmed to avoid outlier distortion. The slope is used in TRAMO to select whether the original series will be transformed into log or maintain in level.
rangemean.tstat(data, period = 0, groupsize = 0, trim = 0)
data |
data to test. |
period |
periodicity of the data. |
groupsize |
number of observations per group (before being trimmed).
The default group size (
|
trim |
number of trimmed observations. |
First, the data is divided into n groups of successive observations of length l (groupsize
).
That is, the first group is formed with the first l observations,
the second group is formed with observations 1+l to 2l, etc.
Then, for each group i, the observations are sorted and the trim
smallest and largest
observations are rejected (to avoid outlier distortion).
With the other observations, the range (noted y_i) and mean (noted m_i) are computed.
Finally, the following regression is performed :
y_t = α + β m_t + u_t.
The function rangemean.tstat
returns the T-statistic associated to β.
If it is significantly higher than 0, log transformation is recommended.
T-Stat of the slope of the range-mean regression.
y = rjd3toolkit::ABS$X0.2.09.10.M # Multiplicative pattern plot(y) period = 12 rm_t = rangemean.tstat(y, period = period, groupsize = period) rm_t # higher than 0 # Can be tested: pt(rm_t, period - 2, lower.tail = FALSE) # Or : 1-rjd3toolkit::cdfT(period-2, rm_t) # Close to 0 rm_t_log = rangemean.tstat(log(y), period = period, groupsize = period) rm_t_log pt(rm_t_log, period - 2, lower.tail = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.