应用时间序列分析(1)基本概念

本系列为《时间序列分析及应用 R 语言》一书的整理。

1. 时间序列与随机过程

  随机变量序列 $\{Y_t: t = 0, \pm 1, \pm 2, \pm 3, \cdots \}$ 称为一个随机过程,以之作为观测时间序列的模型。该过程的完整概率结构是由所有 $Y$ 的有限联合分布构成的分布族决定的。联合分布中的大部分信息可以用过均值、方差和协方差来描述,无需直接处理这些多元分布。因此可以把注意力集中在对一阶和二阶矩的研究上。如果 $Y$ 的联合分布是多元正态分布,则所有的联合分布都可以由一阶和二阶矩完全确定。

2. 期望

  对于连续随机变量 $X$,其概率密度函数为 $f(x)$,定义 $X$ 的期望为:

\begin{equation}
E[X] = \int_{-\infty}^{\infty} xf(x) \mathrm{d}x \tag{1}
\end{equation}

期望通常记做 $\mu$。上式中,要求 $\int_{-\infty}^{\infty} |x|f(x) \mathrm{d}x < \infty$。

3. 方差

  随机变量 $X$ 的方差定义为

\begin{equation}
\mathrm{Var}(X) = E\{[X – E(X)]^2\} \tag{2}
\end{equation}

方差通常记做 $\sigma^2$ 使用下式计算方差通常会更方便:

\begin{equation}
\mathrm{Var}(X) = E(X^2) – [E(X)]^2 \tag{3}
\end{equation}

  方差具有如下性质:

\begin{equation}
\mathrm{Var}(X) \geq 0 \\
\mathrm{Var}(a + bX) = b^2 \mathrm{Var}(X)
\end{equation}

如果 $X$ 和 $Y$ 独立,则

\begin{equation}
\mathrm{Var}(X + Y) = \mathrm{Var}(X) + \mathrm{Var}(Y)
\end{equation}

  方差的平方根称为标准差,记做 $\sigma$。

  随机变量 $(X – \mu_X)(\sigma_X)$ 称为 $X$ 的标准化形式,标准化随机变量的均值为 $0$,标准差为 $1$。

4. 均值

  对随机过程 $\{Y_t: t = 0, \pm 1, \pm 2, \pm 3, \cdots \}$,均值函数的定义为:

\begin{equation}
\mu_t = E(Y_t), \quad t = 0, \pm 1, \pm 2, \cdots \tag{4}
\end{equation}

$\mu_t$ 是过程在 $t$ 时刻的期望值,一般地,不同时刻 $\mu_t$ 可取不同的值。

5. 自协方差函数

  自协方差函数 $\gamma_{t, s}$ 的定义为:

\begin{equation}
\gamma_{t, s} = \mathrm{Cov}(Y_t, Y_s), \quad t, s = 0, \pm 1, \pm 2, \cdots \tag{5}
\end{equation}

其中

\begin{equation}
\mathrm{Cov}(Y_t, Y_s) = E[(Y_t – \mu_t)(Y_s – \mu_s)] \tag{6}
\end{equation}

  协方差具有如下性质:

\begin{equation}
\mathrm{Cov}(a + bX, c + dY) = bd \mathrm{Cov}(X, Y) \\
\mathrm{Var}(X + Y) = \mathrm{Var}(X) + \mathrm{Var}(Y) + 2\mathrm{Cov}(X, Y) \\
\mathrm{Cov}(X + Y, Z) = \mathrm{Cov}(X, Z) + \mathrm{Cov}(Y, Z) \\
\mathrm{Cov}(X, X) = \mathrm{Var}(X) \\
\mathrm{Cov}(X, Y) = \mathrm{Cov}(Y, X)
\end{equation}

如果 $X$ 与 $Y$ 相互独立,则

\begin{equation}
\mathrm{Cov}(X, Y) = 0
\end{equation}

  若 $c_1, c_2, \cdots, c_m$ 和 $d_1, d_2, \cdots, d_n$ 表示常数,$t_1, t_2, \cdots, t_m$ 和 $s_1, s_2, \cdots, s_n$ 表示时点,则有

\begin{equation}
\mathrm{Cov} \bigg[ \sum_{i=1}^m c_i Y_{t_i}, \sum_{j=1}^n d_j Y_{s_j}\bigg] = \sum_{i=1}^m \sum_{j=1}^n c_i d_j \mathrm{Cov}(Y_{t_i}, Y_{s_j}) \tag{7}
\end{equation}

特殊地,有

\begin{equation}
\mathrm{Var}\bigg[ \sum_{i=1}^n c_i Y_{t_i} \bigg] = \sum_{i=1}^n c_i^2 \mathrm{Var}(Y_{t_i}) + 2 \sum_{i=2}^n \sum_{j=1}^{i-1} c_i c_j \mathrm{Cov}(Y_{t_i}, Y_{t_j}) \tag{8}
\end{equation}

6. 自相关函数

  自相关函数 $\rho_{t, s}$ 的定义为:

\begin{equation}
\rho_{t, s} = \mathrm{Corr}(Y_t, Y_s), \quad t, s = 0, \pm 1, \pm 2, \cdots \tag{9}
\end{equation}

其中

\begin{equation}
\mathrm{Corr}(Y_t, Y_s) = \frac{\mathrm{Cov}(Y_t, Y_s)}{\sqrt{\mathrm{Var}(Y_t) \mathrm{Var}(Y_s)}} = \frac{\gamma_{t, s}}{\sqrt{\gamma_{t, t} \gamma_{s, s}}} \tag{10}
\end{equation}

  相关系数具有如下性质:

\begin{equation}
-1 \leq \mathrm{Corr}(X, Y) \leq 1 \\
\mathrm{Corr}(a + bX, c + dY) = \mathrm{sign}(bd) \mathrm{Corr}(X, Y)
\end{equation}

其中 $\mathrm{sign}$ 为符号函数

\begin{align}
\mathrm{sign}(x) = \begin{cases}
1 & x > 0 \\
0 & x = 0 \\
-1 & x < 0
\end{cases}
\end{align}

$\mathrm{Corr}(X, Y) = \pm 1$ 的充要条件是,存在常数 $a$ 和 $b$,使得 $P(Y = aX + b) = 1$。

  协方差和相关系数都是随机变量间(线性)相关关系的度量,相关系数没有量纲。协方差和相关系数间有如下关系:

\begin{align}
&\gamma_{t, t} = \mathrm{Var}(Y_t) & \rho_{t, t} = 1 \\
&\gamma_{t, s} = \gamma_{s, t} & \rho_{t, s} = \rho_{s, t} \\
&|\gamma_{t, s}| \leq \sqrt{\gamma_{t, t}\gamma_{s, s}} & |\rho_{t, s}| \leq 1
\end{align}

  $\rho_{t, s}$ 的值接近 $\pm 1$ 时,说明(线性)相关程度强;而接近 $0$ 时,说明(线性)相关程度弱。若 $\rho_{t, s} = 0$,则称 $Y_t$ 和 $Y_s$ 不相关。注意这里的相关性仅指线性关系,不相关的两个随机变量不一定独立,独立的两个随机变量一定不相关。