Chapter 16 Basic Concepts of Time Series Data Analysis

16.1 Related concepts

       The purpose of time series data is to predict the future through the past. The following data all belong to time series data:

        (1) Remote sensing data;

        (2) Meteorological data;

        (3) Financial data (stocks, futures, foreign exchange)

        (4) Economic data (GDP)

        The time series model is the trend model (Trend Model), which mainly includes the following two categories:

        (1) Linear Trend Model

y_t = b_0+b_1t+\varepsilon

        (2)Log-Linear Trend Model

y_t = e^{b0+b_1t}

ln(y_t) = b_0+b_1t+\varepsilon t

        So can time data be directly brought into the modeling process? Obviously it can't be done.

16.2 Case analysis

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import tushare as ts

if __name__ == '__main__':
    token = "e2aad62befd01005a6bce9947c12055478bd1906cd48f850f7c5d5a0"
    pro = ts.pro_api(token)
    df = pro.daily(ts_code="002758.SZ", start_date="20220401", end_date="20220501")
    # 将日期设置为dataframe的行索引
    df.index=pd.to_datetime(df.trade_date)
    # 获取每日的收盘价
    our_df = df.close

(1) The covariance of the AF (Autocovariace Function) time series and its lag term: Assume that X is a random variable, E is the mathematical expectation, and u is the mean, that is, there is:

AF_k=E[(X_t-\mu_t)(X_{t-k}-\mu_{t-k})]=Cov(X_t,X_{t-k})

Guess you like

Origin blog.csdn.net/qq_36171491/article/details/124829257