Page 332 - 数学建模算法与应用
P. 332

Mathematical Modeling Algorithms and Applications
             数学建模算法与应用


                  [aic, bic] = aicbic(LLFX, num, m3);
                  % 输出拟合结果

                  fprintf(‘GARCH Model Parameters:\n’);
                  disp(coeffX);
                  fprintf(‘AIC = %f, BIC = %f\n’, aic, bic);
                  % 预测 w 的未来值

                  [sigmaForecast, w_Forecast] = garchpred(coeffX, w, n);
                  % 计算 y 的预测值
                  yhat = y(m2) + cumsum(w_Forecast);



                  % 更新 x 的预测值
                  for j = 1:n

                      x(m1 + j) = yhat(j) + x(m1 + j - s);
                  end
                  % 获取复原后的预测值

                  x_hat = x(m1 + 1:end);
                  % 将预测值恢复到原始数据的尺度
                  x0_hat = exp(x_hat + sigmaForecast.^2 / 2);

                  % 检查恢复过程
                  x0_hat_check = exp(x_hat);
                  % 显示预测结果

                  disp(‘Predicted Values (x0_hat):’);
                  disp(x0_hat);
                  % 显示检查结果
                  disp(‘Check Values (x0_hat_check):’);

                  disp(x0_hat_check);
                  % 绘制预测结果
                  figure;

                  plot(linspace(49, 61 + n/m1*12, m1 + n), [x0; x0_hat], ‘-o’);



             322
   327   328   329   330   331   332   333   334   335   336   337