roc
(Series)
Gross rate of change
Syntax
x = roc(x, ~shift, ...)
Input arguments marked with a
~
sign may be omitted
Input arguments
x
[ Series ]
Input time series.
~shift=-1
[ numeric | "YoY"
| "BoY"
| "EoLY"
]
Time shift (lag or lead) over which the rate of change will be computed, i.e. between time t and t+k; the
shift
specified as"YoY"
,"BoY"
or"EoLY"
means year-on-year changes, changes relative to the beginning of current year, or changes relative to the end of previous year, respectively (these do not work withINTEGER
date frequency).
Output arguments
x
[ TimeSubscriptable ]
Percentage rate of change in the input data.
Options
'OutputFreq='
[ empty | Frequency ]
Convert the rate of change to the requested date frequency; empty means plain rate of change with no conversion.
Description
Examples
Here, x
is a monthly time series. The following command computes the
rate of change between month t and t-1:
roc(x, -1)
The following line computes the rate of change between month t and t-3:
roc(x, -3)
In this example, xm
is a monthly time series and xq
is a quarterly
series. The following pairs of commands are equivalent for calculating
the year-over-year rates of change:
roc(xm, -12)
roc(xm, 'YoY')
and
roc(xq, -4)
roc(xm, 'YoY')