Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions time_series_analysis/inhom_iema.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,29 @@
"metadata": {},
"source": [
"# Iterated Exponential Moving Average on Inhomogeneous Time Series\n",
"This notebook calculates an Iterative Exponential Moving Average on a simulated Inhomogeneous Timer Series for 3 Values of $\\tau$ at once.\n",
"This notebook calculates an Iterative Exponential Moving Average on a simulated Inhomogeneous Timer Series for three rates of decay ($\\tau$) at once.\n",
"\n",
"See the NAG Library for Python documentation for the further details on this function: https://www.nag.com/numeric/py/nagdoc_latest/naginterfaces.library.tsa.html#naginterfaces.library.tsa.inhom_iema"
"The `inhom_iema` routine is using a decay kernel of the following form:\n",
"\n",
"$$\n",
"\\frac{e^{-t_i/\\tau}}{\\tau}\n",
"$$\n",
"\n",
"This gives rise to the following iterative formula of the Exponential Moving Average (EMA) operator:\n",
"\n",
"$$\n",
"\\text{EMA}[\\tau;z](t_i)=\\mu\\text{EMA}[\\tau;z](t_{i-1})+(\\nu-\\mu)z_{i-1}+(1-\\nu)z_i\n",
"$$\n",
"\n",
"where $t$ is the inhomogenous (although ordered) points in time, $z$ is the set of observations, and:\n",
"\n",
"$$\n",
"\\mu = e^{\\alpha} \\;\\; \\text{and} \\;\\; \\alpha = \\frac{t_i - t_{i-1}}{\\tau}\n",
"$$\n",
"\n",
"The value of $\\nu$ depends on the method of interpolation chosen.\n",
"\n",
"See the NAG Library for Python documentation for the further details on this function: [NAG Library for Python docs](https://www.nag.com/numeric/py/nagdoc_latest/naginterfaces.library.tsa.html#naginterfaces.library.tsa.inhom_iema)"
]
},
{
Expand Down Expand Up @@ -69,7 +89,13 @@
"\n",
"* `tau` - the decay parameter. this script will calculate the IEMA for 3 $\\tau$ values at once\n",
"* `sinit` - the first two elements represent an initial point in time and a corresponding observation, while the additional elements after represent initial values for the EMA for the total number of iterations you require (e.g. if sinit has 3 elements, there will only be one iteration)\n",
"* `inter` - select the interpolation method for the first and subsequent iterations, respectively; see docs for more info"
"* `inter` - select the interpolation method for the first and subsequent iterations, respectively; see docs for more info\n",
" \n",
" 1) Previous point: $\\nu = 1$\n",
" \n",
" 2) Linear: $\\nu = (1-\\mu) / \\alpha$\n",
" \n",
" 3) Next point: $\\nu = \\mu$"
]
},
{
Expand Down