Estimate the periodicity of a time-series-like object by calculating the median time between observations in days.
A simple wrapper to quickly estimate the periodicity
of a given data. Returning an object of type
This calculates the median number of days between observations as a difftime object, the numerical difference, the units of measurement, and the derived scale of the data as a string.
The time index currently must be of either
POSIX class, or coercible to such.
The only list item of note is the
This is an estimate of the periodicity of the data
in common terms - e.g. 7 day dialy data is best
described as ‘weekly’, and would be returned as
scale values are:
‘minute’,‘hourly’, ‘daily’,‘weekly’, ‘monthly’,‘quarterly’, and ‘yearly’.
An object containing a list containing the
frequency, units, and suitable scale.
This function is only a good estimate for the underlying periodicity. If the series is too short, or has no real periodicity, the return values will obviously be wrong. That said, it is quite robust and used internally within xts.
Jeffrey A. Ryan
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.