Time-Series Analysis
Table of Contents
Regression, Classification, Dimension Reduction,
Based on snapshot-type data
We will focus on linear difference equations (LDE), a surprisingly rich topic both theoretically and practivally.
For example,
$$ y[0]=1,\quad y[1]=\frac{1}{2},\quad y[2]=\frac{1}{4},\quad \cdots $$or by closed-form expression,
$$y[n]=\left(\frac{1}{2}\right)^n,\quad n≥0 $$or with a difference equation and an initial condition,
$$y[n]=\frac{1}{2}y[n−1],\quad y[0]=1$$High order homogeneous LDE
$$y[n]=\alpha_1 y[n−1] + \alpha_2 y [n−2] + \cdots + \alpha_k y[n-k]$$A series is stationary if there is no systematic change in mean and variance over time
A series is non-stationary if mean and variance change over time
Formally
Informally
Q-Q Plot
Non-linear trends
Seasonal trends
Some series may exhibit seasonal trends
For example, weather pattern, employment, inflation, etc.
Combining Linear, Quadratic, and Seasonal Trends
One solution is to apply repeated differencing to the series
For example, first remove seasonal trend. Then remove linear trend
Inspect model fit by examining residuals Q-Q plot
$$p(q_0,q_1,\cdots,q_T ) = p(q_0) \; p(q_1 \mid q_0) \; p( q_2 \mid q_1 q_0 ) \; p( q_3 \mid q_2 q_1 q_0 ) \cdots$$
$$p(q_0,q_1,\cdots,q_T ) = p(q_0) \; p(q_1 \mid q_0) \; p( q_2 \mid q_1 ) \; p( q_3 \mid q_2 ) \cdots$$
For a Markov state 𝑠 and successor state 𝑠′, the state transition probability is defined by
State transition matrix $P$ defines transition probabilities from all states $s$ to all successor states $s'$.
Example: MC episodes
import numpy as np
P = [[0, 0, 1],
[1/2, 1/2, 0],
[1/3, 2/3, 0]]
print(P[1][:])
a = np.random.choice(3,1,p = P[1][:])
print(a)
# sequential processes
# sequence generated by Markov chain
# S1 = 0, S2 = 1, S3 = 2
# starting from 0
x = 0
S = []
S.append(x)
for i in range(50):
x = np.random.choice(3,1,p = P[x][:])[0]
S.append(x)
print(S)
Observation emitted from state
Forward: sequence of observations can be generated
A, B, C ?
Continuous State space model
Weakness
%%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')