当前位置:网站首页>[Time series model] AR model (principle analysis + MATLAB code)
[Time series model] AR model (principle analysis + MATLAB code)
2022-08-02 16:33:00 【Zhi Zhao】
目录
前言
Time series analysis methods include frequency domain analysis methods and time domain analysis methods.The time domain analysis method is to reveal the development law of time series from the perspective of sequence autocorrelation,The commonly used models are as follows:
自回归(AutoRegressive,AR)模型
移动平均(Moving Average,MA)模型
自回归移动平均(AutoRegressive Moving Average,ARMA)模型
差分自回归移动平均(AutoRegressive Integrated Moving Average,ARIMA)模型
一、ARAnalysis of the principle of the model
1.1 AR模型原理
A discrete time series for a set of observations X X X={ x 1 , x 2 , . . . x N − 1 , x N x_{1},x_{2},...x_{N-1},x_{N} x1,x2,...xN−1,xN},The value of each time series is not only related to the previous values,Also related to the resulting interference,Therefore, the time series can be represented by a linear difference equation:
x i = φ 1 x i − 1 + φ 2 x i − 2 + . . . + φ n x i − n + a i − θ 1 a i − 1 − θ 2 a i − 2 − . . . − θ m a i − m x_{i}=φ_{1}x_{i-1}+φ_{2}x_{i-2}+...+φ_{n}x_{i-n}+a_{i}-θ_{1}a_{i-1}-θ_{2}a_{i-2}-...-θ_{m}a_{i-m} xi=φ1xi−1+φ2xi−2+...+φnxi−n+ai−θ1ai−1−θ2ai−2−...−θmai−m
式中, i = 1 , 2 , . . . , N . i=1,2,...,N. i=1,2,...,N., a i 为 模 型 残 差 a_{i}为模型残差 ai为模型残差.
When the moving average coefficient θ j = 0 ( j = 1 , 2 , . . . , m . ) θ_{j}=0(j=1,2,...,m.) θj=0(j=1,2,...,m.)时,That is, there is no moving average part,上式变为:
x i = φ 1 x i − 1 + φ 2 x i − 2 + . . . + φ n x i − n + a i x_{i}=φ_{1}x_{i-1}+φ_{2}x_{i-2}+...+φ_{n}x_{i-n}+a_{i} xi=φ1xi−1+φ2xi−2+...+φnxi−n+ai
Call this expression n n n阶自回归模型 A R ( n ) AR(n) AR(n).
1.2 模型的参数估计
ARThe parameter estimation of the model is based on the known observational data ,Estimate constant coefficients according to a method φ i φ_{i} φi 和 σ a 2 σ_{a}^2 σa2 这 n + 1 n+1 n+1 个参数.There are two types of parameter estimation methods:直接法和间接法.Direct methods include least squares estimation methods、解Yuler-WalkerEquations etc;Indirect methods includeLUD法、Burg法等.Due to the high accuracy of parameter estimation using the least squares method、It has the advantages of simplicity and unbiased estimation,Therefore, the least squares method is used to solve itAR模型参数.
1.3 The order method of the model
ARThe determination of the model order has a great influence on the accuracy of the model prediction,When the model order is less than the optimal model order,Time series can have an overly smooth effect,As a result, the amount of information it carries is greatly reduced;When the model order is greater than the optimal model order,Some noise still exists,This increases the error of the model fitting,影响预测的准确性.
Model ordering is usually based on the closeness of the model fitting to the original data to determine the use of the best criterion function,When modeling, the quality of the model is determined according to the value of the criterion function.
(1)AIC
赤池信息量准则(Akaike Information Criterion,AIC)It is the Japanese scholar Akaike Hiroshi1973年提出,并成功应用于ARModel ordering and selection.This criterion is based on the concept of entropy,It can measure the goodness of model fit.Akaike Hiroji pointed outA time series can be divided into several locally stable periods,Available every time period AR模型来拟合.
AIC准则函数定义为:
A I C ( k ) = 2 k − 2 l n ( L ) AIC(k)=2k-2ln(L) AIC(k)=2k−2ln(L)
其中, k k k是参数的数量,is the order of the model; L L L为似然函数.
(2)BIC
当训练模型时,增加参数的数量,That is to increase the complexity of the model,Thereby increasing the likelihood function,However, the model can also overfit.为了解决这个问题,Schwarz 于1978The Bayesian Information Criterion was proposed in 2007(Bayes Information Criterion,BIC),Also known as Bayesian Information Criterion.
BIC准则函数定义为:
B I C ( k ) = k l n ( n ) − 2 l n ( L ) BIC(k)=kln(n)-2ln(L) BIC(k)=kln(n)−2ln(L)
其中, k k k是参数的数量,is the order of the model; n n n为样本个数; L L L为似然函数.
k l n ( n ) kln(n) kln(n)为惩罚项,在样本数量较多的情况下,It can effectively prevent the problem of excessive model complexity caused by excessive model accuracy,The phenomenon of the curse of dimensionality is avoided.
二、MATLAB代码
1、Call the linear predictor functionlpc计算模型的参数
clc;
clear;
close all;
randn('state',0);
noise = randn(50000,1); % Normalized white Gaussian noise
x = filter(1,[1 1/2 1/3 1/4],noise);
x = x(45904:50000);
a = lpc(x,3);
est_x = filter([0 -a(2:end)],1,x); % Estimated signal
e = x - est_x; % Prediction error
[acs,lags] = xcorr(e,'coeff'); % ACS of prediction error
% Compare the predicted signal to the original signal
figure;
plot(1:97,x(4001:4097),1:97,est_x(4001:4097),'--');
title('Original Signal vs. LPC Estimate');
xlabel('Sample Number'); ylabel('Amplitude'); grid on;
legend('Original Signal','LPC Estimate')
% Look at the autocorrelation of the prediction error.
figure;
plot(lags,acs);
title('Autocorrelation of the Prediction Error');
xlabel('Lags'); ylabel('Normalized Value'); grid on;
2、利用 Yule-Walker to calculate the parameters of the model
clc;
clear;
close all;
% Estimate model order using decay of reflection coefficients.
rng default;
y=filter(1,[1 -0.75 0.5],0.2*randn(1024,1));
% Create AR(2) process
[ar_coeffs,NoiseVariance,reflect_coeffs] = aryule(y,10);
% Fit AR(10) model
stem(reflect_coeffs);
axis([-0.05 10.5 -1 1]);
title('Reflection Coefficients by Lag');
xlabel('Lag');ylabel('Reflection Coefficent');
3、利用 Burg to calculate the parameters of the model
clc;
clear;
close all;
% Estimate input noise variance for AR(4) model.
A = [1 -2.7607 3.8106 -2.6535 0.9238];
% Generate noise standard deviations
rng default;
noise_stdz = rand(1,50)+0.5;
% Generate column vectors that have corresponding standard deviation
x = bsxfun(@times,noise_stdz,randn(1024,50));
% filter each column using the AR model.
y = filter(1,A,x);
% Compute the estimated coefficients and deviations for each column
[ar_coeffs,NoiseVariance]=arburg(y,4);
% Display the mean value of each estimated polynomial coefficient
estimatedA = mean(ar_coeffs);
% Compare actual vs. estimated variances
plot(noise_stdz.^2,NoiseVariance,'k*');
xlabel('Input Noise Variance');
ylabel('Estimated Noise Variance');
三、AR相关论文
(1)Recognition method of arrival time of rock acoustic emission signal based on de-noising:In the study of time difference location of rock acoustic emission source, Signal arrival time is important information.Rock acoustic emission signals are complex, Contains a lot of impulse interference and random noise, Arrival times are poorly readable.针对以上问题, Firstly, median filtering and singular value decomposition are performed on the original acoustic emission signal, Eliminate some impulse interference and random noise; Secondly, wavelet packet decomposition and soft threshold denoising are performed, The main components of the signal are preserved, 提高信噪比, Improve readability of arrival times; Finally, a time series model of signal and noise is combined( AutoRegressive, AR 模型) , 第 1 time to calculate the Akaike Information Criterion K 值( Akaike Information Criterion, AIC( K) 值) , Get the arrival time window, in this window 2 次计算 AIC( K) 值, The automatic identification of arrival time is realized, Computation under the entire signal sequence is avoidedARThe order and degree of the model.
(2)基于CEEMDAN和ARResearch on the feature extraction method of rock mass acoustic emission signal:The acoustic emission signal for rocks is non-stationary、It is difficult to effectively extract feature parameters due to the complexity of features,An empirical decomposition algorithm based on adaptive complete ensemble is proposed(CEEMDAN)和AR模型的特征提取方法,Taking red sandstone as the research object,用CEEMDANDecompose the signal of its rupture phase,Use the correlation coefficient method to select effectiveIMF分量,And perform energy normalization processing,to eliminate the influence of other factors on the model.By calculating the signal at each stageAR模型的AIC值,Build the best order modelAR(5),The accuracy of the model is verified by comparative experiments,并将提取的5阶ARModel coefficients as eigenvectors,It provides a basis and method for the subsequent prediction of rock instability.
参考文献:
[1] Xian Xiaodong,袁 双,Ji Songlin. Recognition method of arrival time of rock acoustic emission signal based on de-noising[J]. 煤炭学报, 2015, 40(S1) : 100-106.
[2] Dai Congcong, 罗小燕, Shao Fan, Huang Xiaoyong, Xu Sixiang.基于CEEMDAN和ARResearch on the feature extraction method of rock mass acoustic emission signal[J]. Chemical minerals and processing, 2018, 47(06) : 20-24.
边栏推荐
- 解决跨域的方法 --- Proxy
- Principles of permutation entropy, fuzzy entropy, approximate entropy, sample entropy and approximate entropy implemented by MATLAB
- Jenkins 参数化构建(Extended Choice Parameter)
- 网络运维系列:GoDaddy Shell DDNS配置
- mongodb连接本地服务失败的问题
- smart_rtmpd 的 VOD 接口使用说明
- 假的服务器日志(给history内容增加ip、用户等内容)
- 【滤波器】最小均方(LMS)自适应滤波器
- 华为Mux VLAN 二层流量隔离
- 【数据读写】csv文件与xls/xlsx文件
猜你喜欢
随机推荐
nvm详细安装步骤以及使用(window10系统)
LAMP环境 源码编译安装(Apache 2.4.52 +mysql 8.0.28+php 8.1.3)
Xshell 使用删除键乱码问题
DOM —— 事件机制及事件链
Template Series - Dichotomous
SQL在MySQL中是如何执行的
华为Mux VLAN 二层流量隔离
【面经】被虐了之后,我翻烂了equals源码,总结如下
APP版本更新通知流程测试要点
在命令行或者pycharm安装库时出现:ModuleNotFoundError: No module named ‘pip‘ 解决方法
Scala的基础语法(小试牛刀)
【路由器与交换机的作用与特点 】
Mysql理解MVCC与BufferPool缓存机制
Scala的安装和IDEA的使用(初入茅庐)
H3C 交换机配置端口组、DHCP、DHCP中继、管理用户
假的服务器日志(给history内容增加ip、用户等内容)
makefile——rule概览
【软件测试】基础篇
Spark的概念、特点、应用场景
abstract和接口的基础知识