A list,



1. Descriptive analysis of time series



2 time series prediction procedures









3. Prediction of stationary series











4. Prediction of trend-type series







Decomposition prediction of compound sequences



Ii. Source code

clear
syms a b;
c=[a b]'; A = [89677992, 15109, 655120, 333135, 823159, 878182, 321209, 407246, 619300, 670]. B=cumsum(A); % original data sum n=length(A); for i=1:(n-1) C(i)=(B(i)+B(i+1))/2; End % calculates the value of the undetermined parameter D=A; D(1)=[]; D=D';
E=[-C;ones(1,n- 1)];
c=inv(E*E')*E*D;
c=c';
a=c(1); b=c(2); % Predicted subsequent data F=[]; F(1)=A(1);
for i=2:(n+10)
    F(i)=(A(1)-b/a)/exp(a*(i- 1))+b/a ; end G=[]; G(1)=A(1);
for i=2:(n+10)
    G(i)=F(i)-F(i- 1); End Y=xlsread('sdata'.'Sheet1'.'E1:E227'); N = length(Y); %% Raw data visualization figure(1)
plot(Y); xlim([1,N])
set(gca,'XTick'[1:18:N])
title('Original stock price')
ylabel('元'%% ARIMA model = ARIMA ('Constant'.0.'D'.1.'Seasonality'.12.'MALags'.1.'SMALags'.12)
Y0 = Y(1:13);
[fit,VarCov] = estimate(model,Y(14:end),'Y0',Y0); Y1 = Y(1:100);
Y2 = Y(101:end);

Yf1 = forecast(fit,100.'Y0',Y1);

figure(2)
plot(1:N,Y,'b'.'LineWidth'.2)

hold on
plot(101:200,Yf1,'k--'.'LineWidth'.1.5)
xlim([0.200])
title('Prediction Error')
legend('Observed'.'Forecast'.'Location'.'NorthWest')Hold off %% to predict future stock trends.= forecast(fit,60.'Y0',Y);
upper = Yf + 1.96*sqrt(YMSE);
lower = Yf - 1.96*sqrt(YMSE);
Copy the code

3. Operation results



Fourth, note

Version: 2014 a