<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd">
<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article">
 <front>
  <journal-meta>
   <journal-id journal-id-type="publisher-id">
    jcc
   </journal-id>
   <journal-title-group>
    <journal-title>
     Journal of Computer and Communications
    </journal-title>
   </journal-title-group>
   <issn pub-type="epub">
    2327-5219
   </issn>
   <issn publication-format="print">
    2327-5227
   </issn>
   <publisher>
    <publisher-name>
     Scientific Research Publishing
    </publisher-name>
   </publisher>
  </journal-meta>
  <article-meta>
   <article-id pub-id-type="doi">
    10.4236/jcc.2025.132009
   </article-id>
   <article-id pub-id-type="publisher-id">
    jcc-140769
   </article-id>
   <article-categories>
    <subj-group subj-group-type="heading">
     <subject>
      Articles
     </subject>
    </subj-group>
    <subj-group subj-group-type="Discipline-v2">
     <subject>
      Computer Science 
     </subject>
     <subject>
       Communications
     </subject>
    </subj-group>
   </article-categories>
   <title-group>
    A Hybrid Air Quality Prediction Method Based on VAR and Random Forest
   </title-group>
   <contrib-group>
    <contrib contrib-type="author" xlink:type="simple">
     <name name-style="western">
      <surname>
       Minghao
      </surname>
      <given-names>
       Yi
      </given-names>
     </name>
    </contrib>
    <contrib contrib-type="author" xlink:type="simple">
     <name name-style="western">
      <surname>
       Fuming
      </surname>
      <given-names>
       Lin
      </given-names>
     </name>
    </contrib>
   </contrib-group> 
   <aff id="affnull">
    <addr-line>
     aCollege of Mathematical and Statistics, Sichuan University of Science and Engineering, Zigong, China
    </addr-line> 
   </aff> 
   <pub-date pub-type="epub">
    <day>
     11
    </day> 
    <month>
     02
    </month>
    <year>
     2025
    </year>
   </pub-date> 
   <volume>
    13
   </volume> 
   <issue>
    02
   </issue>
   <fpage>
    142
   </fpage>
   <lpage>
    154
   </lpage>
   <history>
    <date date-type="received">
     <day>
      23,
     </day>
     <month>
      January
     </month>
     <year>
      2025
     </year>
    </date>
    <date date-type="published">
     <day>
      21,
     </day>
     <month>
      January
     </month>
     <year>
      2025
     </year> 
    </date> 
    <date date-type="accepted">
     <day>
      21,
     </day>
     <month>
      February
     </month>
     <year>
      2025
     </year> 
    </date>
   </history>
   <permissions>
    <copyright-statement>
     © Copyright 2014 by authors and Scientific Research Publishing Inc. 
    </copyright-statement>
    <copyright-year>
     2014
    </copyright-year>
    <license>
     <license-p>
      This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/
     </license-p>
    </license>
   </permissions>
   <abstract>
    To improve the efficiency of air quality analysis and the accuracy of predictions, this paper proposes a composite method based on Vector Autoregressive (VAR) and Random Forest (RF) models. In the theoretical section, the model introduction and estimation algorithms are provided. In the empirical analysis section, global air quality data from 2022 to 2024 are used, and the proposed method is applied. Specifically, principal component analysis (PCA) is first conducted, and then VAR and Random Forest methods are used for prediction on the reduced-dimensional data. The results show that the RMSE of the hybrid model is 45.27, significantly lower than the 49.11 of the VAR model alone, verifying its superiority. The stability and predictive performance of the model are effectively enhanced.
   </abstract>
   <kwd-group> 
    <kwd>
     Var Model
    </kwd> 
    <kwd>
      Principal Component Analysis
    </kwd> 
    <kwd>
      Random Forest Model
    </kwd>
   </kwd-group>
  </article-meta>
 </front>
 <body>
  <sec id="s1">
   <title>1. Introduction</title>
   <p>With the rapid development of the global economy and the acceleration of urbanization, environmental issues have become increasingly prominent. Among these, air pollution has emerged as a major global challenge. Air pollution not only poses serious threats to human health but also exerts profound impacts on global climate change. According to a report by the World Health Organization (WHO), approximately 90% of the global population lives in environments with substandard air quality. Health issues caused by air pollution, such as respiratory and cardiovascular diseases, have become urgent public health problems that governments worldwide need to address <xref ref-type="bibr" rid="scirp.140769-1">
     [1]
    </xref>.</p>
   <p>In recent years, with the rapid advancement of data technologies, the use of big data and statistical methods for comprehensive analysis and prediction of air quality has become an essential tool for environmental protection and policy-making <xref ref-type="bibr" rid="scirp.140769-2">
     [2]
    </xref>. However, existing methods still face significant limitations:</p>
   <p>To address these limitations, this study proposes a hybrid framework integrating PCA, VAR, and Random Forest. By combining the nonlinear modeling capacity of Random Forest with the temporal dependency analysis of VAR, and optimizing data structure through PCA, our approach mitigates the shortcomings of individual methods.</p>
   <p>First, Principal Component Analysis (PCA), a dimensionality reduction technique, has been widely applied in environmental studies. Pearson (1901) <xref ref-type="bibr" rid="scirp.140769-9">
     [9]
    </xref> and Hotelling (1933) were pioneers in proposing and developing PCA. Its primary advantage lies in effectively reducing data dimensions while retaining most of the in-formation, thus simplifying data analysis <xref ref-type="bibr" rid="scirp.140769-10">
     [10]
    </xref>. Liu et al. (2019) utilized PCA to extract key components of air pollutants and identified PM2.5 as one of the critical factors affecting air quality.</p>
   <p>Second, the Vector Autoregressive (VAR) model has been extensively used in time series analysis to study dynamic relationships among variables <xref ref-type="bibr" rid="scirp.140769-11">
     [11]
    </xref> <xref ref-type="bibr" rid="scirp.140769-12">
     [12]
    </xref>. Sims (1980) initially introduced the VAR model to address lag effects and interactions in multivariate time series. Liu et al. applied the VAR model to investigate the lag effects of PM2.5 concentrations, revealing a significant temporal dependence in air pollution. Kou et al. further employed the VAR model to analyze the relationship between air quality and meteorological conditions, highlighting the lag effects of factors, such as temperature and humidity on air quality. Qiu et al. utilized the VAR model to study the dynamic response mechanism between environmental regulation and agricultural carbon emissions, providing insights into the model’s application.</p>
   <p>Lastly, the Random Forest model, an ensemble algorithm based on decision trees, has garnered attention in environmental studies due to its superior performance in handling high-dimensional and noisy data. Breiman first proposed the Random Forest algorithm, and numerous studies have demonstrated its predictive performance surpasses traditional linear regression models in environmental forecasting.</p>
   <p>In summary, building on previous research, this study integrates PCA, the VAR model, and the Random Forest model <xref ref-type="bibr" rid="scirp.140769-13">
     [13]
    </xref>-<xref ref-type="bibr" rid="scirp.140769-15">
     [15]
    </xref> to develop a new meta-model aimed at providing a more accurate and robust tool for air quality analysis and prediction.</p>
   <p>The main contributions of this study are twofold. First, based on existing air quality analysis methods, this study proposes a novel analytical framework combining PCA, the VAR model, and the Random Forest model. By integrating statistical analysis with machine learning models, the proposed framework not only effectively reduces data dimensions but also enhances the accuracy of air quality predictions, enriching the theoretical foundation for air quality forecasting. Second, this study explores the interactions between various environmental variables and air quality, deepening the understanding of the causes of air pollution. This can provide valuable decision-making references for governments and assist in formulating more effective environmental policies. Moreover, the integration of data technologies and statistical methods in this study offers a research pathway for future environmental protection efforts and promotes the application of big data technologies in environmental management.</p>
  </sec><sec id="s2">
   <title>2. Theoretical Framework</title>
   <p>Since Principal Component Analysis (PCA) is a well-known method, this section primarily introduces the Vector Autoregressive (VAR) model, the Random Forest model, and the proposed framework in this study.</p>
   <sec id="s2_1">
    <title>2.1. Vector Autoregressive (VAR) Model</title>
    <p>The VAR model is used to describe the interdependencies among multiple time series. It predicts the current and future values of time series by considering the lagged values of multiple variables, making it suitable for handling multivariate time series data.</p>
    <p>The basic equation of the VAR model is as follows:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mi>
          t 
        </mi> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mi>
         c 
       </mi> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mn>
          1 
        </mn> 
       </msub> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           − 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
       </msub> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mn>
          2 
        </mn> 
       </msub> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           − 
         </mo> 
         <mn>
           2 
         </mn> 
        </mrow> 
       </msub> 
       <mo>
         + 
       </mo> 
       <mo>
         ⋯ 
       </mo> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mi>
          p 
        </mi> 
       </msub> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           − 
         </mo> 
         <mi>
           p 
         </mi> 
        </mrow> 
       </msub> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          ϵ 
        </mi> 
        <mi>
          t 
        </mi> 
       </msub> 
      </mrow> 
     </math>(1)</p>
    <p>where:</p>
    <p>To predict the value at a future time 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mi>
         t 
       </mi> 
       <mo>
         + 
       </mo> 
       <mi>
         h 
       </mi> 
      </mrow> 
     </math>, the above equation is recursively applied:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           + 
         </mo> 
         <mi>
           h 
         </mi> 
        </mrow> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mi>
         c 
       </mi> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mn>
          1 
        </mn> 
       </msub> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           + 
         </mo> 
         <mi>
           h 
         </mi> 
         <mo>
           − 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
       </msub> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mn>
          2 
        </mn> 
       </msub> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           + 
         </mo> 
         <mi>
           h 
         </mi> 
         <mo>
           − 
         </mo> 
         <mn>
           2 
         </mn> 
        </mrow> 
       </msub> 
       <mo>
         + 
       </mo> 
       <mo>
         ⋯ 
       </mo> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mi>
          p 
        </mi> 
       </msub> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           + 
         </mo> 
         <mi>
           h 
         </mi> 
         <mo>
           − 
         </mo> 
         <mi>
           p 
         </mi> 
        </mrow> 
       </msub> 
      </mrow> 
     </math>(2)</p>
   </sec>
   <sec id="s2_2">
    <title>2.2. Random Forest Model</title>
    <p>Random Forest is an ensemble learning method that improves model accuracy and robustness by constructing multiple decision trees and combining their prediction results.</p>
    <p>For regression problems, the prediction of Random Forest is expressed as:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mover accent="true"> 
        <mi>
          y 
        </mi> 
        <mo>
          ^ 
        </mo> 
       </mover> 
       <mo>
         = 
       </mo> 
       <munderover> 
        <mstyle displaystyle="true" mathsize="140%"> 
         <mo>
           ∑ 
         </mo> 
        </mstyle> 
        <mrow> 
         <mi>
           b 
         </mi> 
         <mo>
           = 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
        <mi>
          B 
        </mi> 
       </munderover> 
       <mtext>
           
       </mtext> 
       <msub> 
        <mi>
          T 
        </mi> 
        <mi>
          b 
        </mi> 
       </msub> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mi>
          x 
        </mi> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math>(3)</p>
    <p>where:</p>
   </sec>
   <sec id="s2_3">
    <title>2.3. Proposed Framework</title>
    <p>The basic idea of the proposed method is as follows: First, the original dataset is divided into a training set and a testing set. A Random Forest model is trained using the training set and is then used to predict the target values for the time steps in the testing set. The training data is combined with the predictions obtained from the Random Forest model to form a new dataset, which is then used to fit and forecast using the VAR model.</p>
    <p>The synergy stems from two complementary mechanisms:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msubsup> 
        <mover accent="true"> 
         <mi>
           y 
         </mi> 
         <mo>
           ^ 
         </mo> 
        </mover> 
        <mrow> 
         <mi>
           R 
         </mi> 
         <mi>
           F 
         </mi> 
        </mrow> 
        <mrow> 
         <mi>
           k 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           t 
         </mi> 
        </mrow> 
       </msubsup> 
       <mo>
         = 
       </mo> 
       <mfrac> 
        <mn>
          1 
        </mn> 
        <mi>
          B 
        </mi> 
       </mfrac> 
       <munderover> 
        <mstyle displaystyle="true" mathsize="140%"> 
         <mo>
           ∑ 
         </mo> 
        </mstyle> 
        <mrow> 
         <mi>
           b 
         </mi> 
         <mo>
           = 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
        <mi>
          B 
        </mi> 
       </munderover> 
       <mtext>
           
       </mtext> 
       <msubsup> 
        <mi>
          T 
        </mi> 
        <mi>
          b 
        </mi> 
        <mrow> 
         <mrow> 
          <mo>
            ( 
          </mo> 
          <mi>
            k 
          </mi> 
          <mo>
            ) 
          </mo> 
         </mrow> 
        </mrow> 
       </msubsup> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mrow> 
         <msub> 
          <mi>
            X 
          </mi> 
          <mi>
            t 
          </mi> 
         </msub> 
        </mrow> 
        <mo>
          ) 
        </mo> 
       </mrow> 
       <mtext>
           
       </mtext> 
       <mtext>
           
       </mtext> 
       <mtext>
           
       </mtext> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mrow> 
         <mtext>
           Tree Ensemble 
         </mtext> 
        </mrow> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math>(4)</p>
    <p>where 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msubsup> 
        <mi>
          T 
        </mi> 
        <mi>
          b 
        </mi> 
        <mrow> 
         <mrow> 
          <mo>
            ( 
          </mo> 
          <mi>
            k 
          </mi> 
          <mo>
            ) 
          </mo> 
         </mrow> 
        </mrow> 
       </msubsup> 
      </mrow> 
     </math> denotes the 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mi>
        b 
      </mi> 
     </math>-th tree for variable 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mi>
        k 
      </mi> 
     </math>, effectively modeling interactions between lagged terms and external factors.</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mfrac> 
        <mrow> 
         <mo>
           ∂ 
         </mo> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mrow> 
           <mi>
             k 
           </mi> 
           <mo>
             , 
           </mo> 
           <mi>
             t 
           </mi> 
          </mrow> 
         </msub> 
        </mrow> 
        <mrow> 
         <mo>
           ∂ 
         </mo> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mrow> 
           <mi>
             j 
           </mi> 
           <mo>
             , 
           </mo> 
           <mi>
             t 
           </mi> 
           <mo>
             − 
           </mo> 
           <mi>
             i 
           </mi> 
          </mrow> 
         </msub> 
        </mrow> 
       </mfrac> 
       <mo>
         = 
       </mo> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mrow> 
         <mi>
           k 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           j 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           i 
         </mi> 
        </mrow> 
       </msub> 
       <mtext>
           
       </mtext> 
       <mtext>
           
       </mtext> 
       <mtext>
           
       </mtext> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mrow> 
         <mtext>
           Linear Propagation 
         </mtext> 
        </mrow> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math>(5)</p>
    <p>The hybrid model combines these via additive decomposition:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mi>
          t 
        </mi> 
       </msub> 
       <mo>
         = 
       </mo> 
       <munder> 
        <munder> 
         <mrow> 
          <munderover> 
           <mstyle mathsize="140%" displaystyle="true"> 
            <mo>
              ∑ 
            </mo> 
           </mstyle> 
           <mrow> 
            <mi>
              i 
            </mi> 
            <mo>
              = 
            </mo> 
            <mn>
              1 
            </mn> 
           </mrow> 
           <mi>
             p 
           </mi> 
          </munderover> 
          <mtext>
              
          </mtext> 
          <msub> 
           <mi>
             A 
           </mi> 
           <mi>
             i 
           </mi> 
          </msub> 
          <msub> 
           <mi>
             y 
           </mi> 
           <mrow> 
            <mi>
              t 
            </mi> 
            <mo>
              − 
            </mo> 
            <mi>
              i 
            </mi> 
           </mrow> 
          </msub> 
         </mrow> 
         <mo stretchy="true">
           ︸ 
         </mo> 
        </munder> 
        <mrow> 
         <mtext>
           Linear Dynamics 
         </mtext> 
        </mrow> 
       </munder> 
       <mo>
         + 
       </mo> 
       <munder> 
        <munder> 
         <mrow> 
          <mi>
            β 
          </mi> 
          <mo>
            ⋅ 
          </mo> 
          <mi>
            R 
          </mi> 
          <mi>
            F 
          </mi> 
          <mrow> 
           <mo>
             ( 
           </mo> 
           <mrow> 
            <msub> 
             <mi>
               X 
             </mi> 
             <mi>
               t 
             </mi> 
            </msub> 
           </mrow> 
           <mo>
             ) 
           </mo> 
          </mrow> 
         </mrow> 
         <mo stretchy="true">
           ︸ 
         </mo> 
        </munder> 
        <mrow> 
         <mtext>
           Nonlinear Correction 
         </mtext> 
        </mrow> 
       </munder> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          ϵ 
        </mi> 
        <mi>
          t 
        </mi> 
       </msub> 
      </mrow> 
     </math>(6)</p>
    <p>First, use the Random Forest model to predict each variable:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msubsup> 
        <mover accent="true"> 
         <mi>
           y 
         </mi> 
         <mo>
           ^ 
         </mo> 
        </mover> 
        <mrow> 
         <mi>
           R 
         </mi> 
         <mi>
           F 
         </mi> 
        </mrow> 
        <mrow> 
         <mi>
           k 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           t 
         </mi> 
        </mrow> 
       </msubsup> 
       <mo>
         = 
       </mo> 
       <mi>
         R 
       </mi> 
       <msub> 
        <mi>
          F 
        </mi> 
        <mi>
          k 
        </mi> 
       </msub> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mrow> 
         <msub> 
          <mi>
            X 
          </mi> 
          <mi>
            t 
          </mi> 
         </msub> 
        </mrow> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math>(7)</p>
    <p>where:</p>
    <p>Feature Engineering Details:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          X 
        </mi> 
        <mi>
          t 
        </mi> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mrow> 
        <mo>
          [ 
        </mo> 
        <mrow> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mrow> 
           <mn>
             1 
           </mn> 
           <mo>
             , 
           </mo> 
           <mi>
             t 
           </mi> 
           <mo>
             − 
           </mo> 
           <mn>
             1 
           </mn> 
          </mrow> 
         </msub> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mrow> 
           <mn>
             1 
           </mn> 
           <mo>
             , 
           </mo> 
           <mi>
             t 
           </mi> 
           <mo>
             − 
           </mo> 
           <mn>
             2 
           </mn> 
          </mrow> 
         </msub> 
         <mo>
           , 
         </mo> 
         <mo>
           ⋯ 
         </mo> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mrow> 
           <mn>
             1 
           </mn> 
           <mo>
             , 
           </mo> 
           <mi>
             t 
           </mi> 
           <mo>
             − 
           </mo> 
           <mi>
             p 
           </mi> 
          </mrow> 
         </msub> 
         <mo>
           , 
         </mo> 
         <mo>
           ⋯ 
         </mo> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mrow> 
           <mi>
             K 
           </mi> 
           <mo>
             , 
           </mo> 
           <mi>
             t 
           </mi> 
           <mo>
             − 
           </mo> 
           <mi>
             p 
           </mi> 
          </mrow> 
         </msub> 
        </mrow> 
        <mo>
          ] 
        </mo> 
       </mrow> 
       <mo>
         ∈ 
       </mo> 
       <msup> 
        <mi>
          ℝ 
        </mi> 
        <mrow> 
         <mi>
           K 
         </mi> 
         <mo>
           × 
         </mo> 
         <mi>
           p 
         </mi> 
        </mrow> 
       </msup> 
      </mrow> 
     </math>(8)</p>
    <p>where 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mi>
        K 
      </mi> 
     </math> is the number of variables, and 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mi>
        p 
      </mi> 
     </math> is the maximum lag order (determined via AIC/BIC).</p>
    <p>Each RF model 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mi>
         R 
       </mi> 
       <msub> 
        <mi>
          F 
        </mi> 
        <mi>
          k 
        </mi> 
       </msub> 
      </mrow> 
     </math> is trained to minimize:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <munder> 
        <mrow> 
         <mtext>
           min 
         </mtext> 
        </mrow> 
        <mrow> 
         <msub> 
          <mi>
            θ 
          </mi> 
          <mi>
            k 
          </mi> 
         </msub> 
        </mrow> 
       </munder> 
       <munderover> 
        <mstyle mathsize="140%" displaystyle="true"> 
         <mo>
           ∑ 
         </mo> 
        </mstyle> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           = 
         </mo> 
         <mi>
           p 
         </mi> 
         <mo>
           + 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
        <mrow> 
         <msub> 
          <mi>
            N 
          </mi> 
          <mrow> 
           <mtext>
             train 
           </mtext> 
          </mrow> 
         </msub> 
        </mrow> 
       </munderover> 
       <msup> 
        <mrow> 
         <mrow> 
          <mo>
            ( 
          </mo> 
          <mrow> 
           <msub> 
            <mi>
              y 
            </mi> 
            <mrow> 
             <mi>
               k 
             </mi> 
             <mo>
               , 
             </mo> 
             <mi>
               t 
             </mi> 
            </mrow> 
           </msub> 
           <mo>
             − 
           </mo> 
           <mi>
             R 
           </mi> 
           <msub> 
            <mi>
              F 
            </mi> 
            <mi>
              k 
            </mi> 
           </msub> 
           <mrow> 
            <mo>
              ( 
            </mo> 
            <mrow> 
             <msub> 
              <mi>
                X 
              </mi> 
              <mi>
                t 
              </mi> 
             </msub> 
            </mrow> 
            <mo>
              ) 
            </mo> 
           </mrow> 
          </mrow> 
          <mo>
            ) 
          </mo> 
         </mrow> 
        </mrow> 
        <mn>
          2 
        </mn> 
       </msup> 
      </mrow> 
     </math>(9)</p>
    <p>where 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          θ 
        </mi> 
        <mi>
          k 
        </mi> 
       </msub> 
      </mrow> 
     </math> represents tree split parameters.</p>
    <p>RF predictions may introduce future information, causing endogeneity bias. To address endogeneity issues:</p>
    <p>- Training set 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          Y 
        </mi> 
        <mrow> 
         <mtext>
           train 
         </mtext> 
        </mrow> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mrow> 
        <mo>
          { 
        </mo> 
        <mrow> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mn>
            1 
          </mn> 
         </msub> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mn>
            2 
          </mn> 
         </msub> 
         <mo>
           , 
         </mo> 
         <mo>
           ⋯ 
         </mo> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mi>
            T 
          </mi> 
         </msub> 
        </mrow> 
        <mo>
          } 
        </mo> 
       </mrow> 
      </mrow> 
     </math>, test set 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          Y 
        </mi> 
        <mrow> 
         <mtext>
           test 
         </mtext> 
        </mrow> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mrow> 
        <mo>
          { 
        </mo> 
        <mrow> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mrow> 
           <mi>
             T 
           </mi> 
           <mo>
             + 
           </mo> 
           <mn>
             1 
           </mn> 
          </mrow> 
         </msub> 
         <mo>
           , 
         </mo> 
         <mo>
           ⋯ 
         </mo> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mrow> 
           <mi>
             T 
           </mi> 
           <mo>
             + 
           </mo> 
           <mi>
             h 
           </mi> 
          </mrow> 
         </msub> 
        </mrow> 
        <mo>
          } 
        </mo> 
       </mrow> 
      </mrow> 
     </math>.</p>
    <p>- Train RF solely on 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          Y 
        </mi> 
        <mrow> 
         <mtext>
           train 
         </mtext> 
        </mrow> 
       </msub> 
      </mrow> 
     </math>. For prediction, input 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          X 
        </mi> 
        <mrow> 
         <mi>
           T 
         </mi> 
         <mo>
           + 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mrow> 
        <mo>
          [ 
        </mo> 
        <mrow> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mi>
            T 
          </mi> 
         </msub> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mrow> 
           <mi>
             T 
           </mi> 
           <mo>
             − 
           </mo> 
           <mn>
             1 
           </mn> 
          </mrow> 
         </msub> 
         <mo>
           , 
         </mo> 
         <mo>
           ⋯ 
         </mo> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mrow> 
           <mi>
             T 
           </mi> 
           <mo>
             − 
           </mo> 
           <mi>
             p 
           </mi> 
           <mo>
             + 
           </mo> 
           <mn>
             1 
           </mn> 
          </mrow> 
         </msub> 
        </mrow> 
        <mo>
          ] 
        </mo> 
       </mrow> 
      </mrow> 
     </math> to generate 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msubsup> 
        <mover accent="true"> 
         <mi>
           y 
         </mi> 
         <mo>
           ^ 
         </mo> 
        </mover> 
        <mrow> 
         <mi>
           T 
         </mi> 
         <mo>
           + 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
        <mrow> 
         <mi>
           R 
         </mi> 
         <mi>
           F 
         </mi> 
        </mrow> 
       </msubsup> 
      </mrow> 
     </math>.</p>
    <p>(a) Dynamically update the training window.</p>
    <p>(b) Retrain RF and VAR models to ensure predictions rely only on historical data.</p>
    <p>Next, incorporate the Random Forest predictions into the VAR model:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mi>
          t 
        </mi> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mi>
         c 
       </mi> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mn>
          1 
        </mn> 
       </msub> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           − 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
       </msub> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mn>
          2 
        </mn> 
       </msub> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           − 
         </mo> 
         <mn>
           2 
         </mn> 
        </mrow> 
       </msub> 
       <mo>
         + 
       </mo> 
       <mo>
         ⋯ 
       </mo> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mi>
          p 
        </mi> 
       </msub> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           − 
         </mo> 
         <mi>
           p 
         </mi> 
        </mrow> 
       </msub> 
       <mo>
         + 
       </mo> 
       <mi>
         β 
       </mi> 
       <msubsup> 
        <mover accent="true"> 
         <mi>
           y 
         </mi> 
         <mo>
           ^ 
         </mo> 
        </mover> 
        <mi>
          t 
        </mi> 
        <mrow> 
         <mi>
           R 
         </mi> 
         <mi>
           F 
         </mi> 
        </mrow> 
       </msubsup> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          ϵ 
        </mi> 
        <mi>
          t 
        </mi> 
       </msub> 
      </mrow> 
     </math>(10)</p>
    <p>where:</p>
    <p>The comprehensive model equation becomes:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mi>
          t 
        </mi> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mi>
         c 
       </mi> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mn>
          1 
        </mn> 
       </msub> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           − 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
       </msub> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mn>
          2 
        </mn> 
       </msub> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           − 
         </mo> 
         <mn>
           2 
         </mn> 
        </mrow> 
       </msub> 
       <mo>
         + 
       </mo> 
       <mo>
         ⋯ 
       </mo> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mi>
          p 
        </mi> 
       </msub> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           t 
         </mi> 
         <mo>
           − 
         </mo> 
         <mi>
           p 
         </mi> 
        </mrow> 
       </msub> 
       <mo>
         + 
       </mo> 
       <mi>
         β 
       </mi> 
       <mo>
         ⋅ 
       </mo> 
       <mi>
         R 
       </mi> 
       <mi>
         F 
       </mi> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mrow> 
         <msub> 
          <mi>
            X 
          </mi> 
          <mi>
            t 
          </mi> 
         </msub> 
        </mrow> 
        <mo>
          ) 
        </mo> 
       </mrow> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          ϵ 
        </mi> 
        <mi>
          t 
        </mi> 
       </msub> 
      </mrow> 
     </math>(11)</p>
    <p>For each variable k, the equation can be expressed as:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           k 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           t 
         </mi> 
        </mrow> 
       </msub> 
       <mo>
         = 
       </mo> 
       <msub> 
        <mi>
          c 
        </mi> 
        <mi>
          k 
        </mi> 
       </msub> 
       <mo>
         + 
       </mo> 
       <munderover> 
        <mstyle displaystyle="true" mathsize="140%"> 
         <mo>
           ∑ 
         </mo> 
        </mstyle> 
        <mrow> 
         <mi>
           i 
         </mi> 
         <mo>
           = 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
        <mi>
          p 
        </mi> 
       </munderover> 
       <munderover> 
        <mstyle displaystyle="true" mathsize="140%"> 
         <mo>
           ∑ 
         </mo> 
        </mstyle> 
        <mrow> 
         <mi>
           j 
         </mi> 
         <mo>
           = 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
        <mi>
          K 
        </mi> 
       </munderover> 
       <mtext>
           
       </mtext> 
       <msub> 
        <mi>
          A 
        </mi> 
        <mrow> 
         <mi>
           k 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           j 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           i 
         </mi> 
        </mrow> 
       </msub> 
       <msub> 
        <mi>
          y 
        </mi> 
        <mrow> 
         <mi>
           j 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           t 
         </mi> 
         <mo>
           − 
         </mo> 
         <mi>
           i 
         </mi> 
        </mrow> 
       </msub> 
       <mo>
         + 
       </mo> 
       <munderover> 
        <mstyle displaystyle="true" mathsize="140%"> 
         <mo>
           ∑ 
         </mo> 
        </mstyle> 
        <mrow> 
         <mi>
           m 
         </mi> 
         <mo>
           = 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
        <mi>
          K 
        </mi> 
       </munderover> 
       <mtext>
           
       </mtext> 
       <msub> 
        <mi>
          β 
        </mi> 
        <mrow> 
         <mi>
           k 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           m 
         </mi> 
        </mrow> 
       </msub> 
       <msubsup> 
        <mover accent="true"> 
         <mi>
           y 
         </mi> 
         <mo>
           ^ 
         </mo> 
        </mover> 
        <mrow> 
         <mi>
           m 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           t 
         </mi> 
        </mrow> 
        <mrow> 
         <mi>
           R 
         </mi> 
         <mi>
           F 
         </mi> 
        </mrow> 
       </msubsup> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          ϵ 
        </mi> 
        <mrow> 
         <mi>
           k 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           t 
         </mi> 
        </mrow> 
       </msub> 
       <mo>
         , 
       </mo> 
       <mtext>
           
       </mtext> 
       <mtext>
           
       </mtext> 
       <mtext>
           
       </mtext> 
       <mo>
         ∀ 
       </mo> 
       <mi>
         k 
       </mi> 
       <mo>
         = 
       </mo> 
       <mn>
         1 
       </mn> 
       <mo>
         , 
       </mo> 
       <mn>
         2 
       </mn> 
       <mo>
         , 
       </mo> 
       <mo>
         ⋯ 
       </mo> 
       <mo>
         , 
       </mo> 
       <mi>
         K 
       </mi> 
      </mrow> 
     </math>(12)</p>
    <p>where:</p>
   </sec>
  </sec><sec id="s3">
   <title>3. Algorithm</title>
   <p>The algorithm is described as follows:</p>
   <p>1) Data Preprocessing &amp; Dimensionality Reduction</p>
   <p>- Input: Raw dataset 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mi>
       Y 
     </mi> 
    </math> ( 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <mi>
        N 
      </mi> 
      <mo>
        × 
      </mo> 
      <mi>
        K 
      </mi> 
     </mrow> 
    </math> matrix, 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mi>
       N 
     </mi> 
    </math>: timesteps, 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mi>
       K 
     </mi> 
    </math>: variables)</p>
   <p>- Process:</p>
   <p>* Standardize 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mi>
       Y 
     </mi> 
    </math>.</p>
   <p>* Apply PCA to extract top 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mi>
       M 
     </mi> 
    </math> principal components, obtaining reduced data 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          pca 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math> ( 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <mi>
        N 
      </mi> 
      <mo>
        × 
      </mo> 
      <mi>
        M 
      </mi> 
     </mrow> 
    </math>).</p>
   <p>- Output: Reduced-dimension dataset 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          pca 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math></p>
   <p>2) Data Splitting</p>
   <p>- Input: 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          pca 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math></p>
   <p>- Process:</p>
   <p>* Split 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          pca 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math> chronologically into training (70%), testing (15%), and forecast (15%) sets: 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          train 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math>, 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          test 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math>, 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          forecast 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math>.</p>
   <p>- Output: 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          train 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math>, 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          test 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math>, 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          forecast 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math></p>
   <p>3) Random Forest Training &amp; Prediction</p>
   <p>- Input: 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          train 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math></p>
   <p>- Process:</p>
   <p>* Train independent RF models 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mrow> 
        <mtext>
          RF 
        </mtext> 
       </mrow> 
       <mi>
         k 
       </mi> 
      </msub> 
     </mrow> 
    </math> for each variable 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mi>
       k 
     </mi> 
    </math>:</p>
   <p>
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <munder> 
       <mrow> 
        <mtext>
          min 
        </mtext> 
       </mrow> 
       <mrow> 
        <msub> 
         <mi>
           θ 
         </mi> 
         <mi>
           k 
         </mi> 
        </msub> 
       </mrow> 
      </munder> 
      <munderover> 
       <mstyle mathsize="140%" displaystyle="true"> 
        <mo>
          ∑ 
        </mo> 
       </mstyle> 
       <mrow> 
        <mi>
          t 
        </mi> 
        <mo>
          = 
        </mo> 
        <mi>
          p 
        </mi> 
        <mo>
          + 
        </mo> 
        <mn>
          1 
        </mn> 
       </mrow> 
       <mrow> 
        <msub> 
         <mi>
           N 
         </mi> 
         <mrow> 
          <mtext>
            train 
          </mtext> 
         </mrow> 
        </msub> 
       </mrow> 
      </munderover> 
      <msup> 
       <mrow> 
        <mrow> 
         <mo>
           ( 
         </mo> 
         <mrow> 
          <msub> 
           <mi>
             y 
           </mi> 
           <mrow> 
            <mi>
              k 
            </mi> 
            <mo>
              , 
            </mo> 
            <mi>
              t 
            </mi> 
           </mrow> 
          </msub> 
          <mo>
            − 
          </mo> 
          <msub> 
           <mrow> 
            <mtext>
              RF 
            </mtext> 
           </mrow> 
           <mi>
             k 
           </mi> 
          </msub> 
          <mrow> 
           <mo>
             ( 
           </mo> 
           <mrow> 
            <msub> 
             <mi>
               Y 
             </mi> 
             <mrow> 
              <mtext>
                train 
              </mtext> 
             </mrow> 
            </msub> 
            <mrow> 
             <mo>
               [ 
             </mo> 
             <mi>
               t 
             </mi> 
             <mo>
               ] 
             </mo> 
            </mrow> 
           </mrow> 
           <mo>
             ) 
           </mo> 
          </mrow> 
         </mrow> 
         <mo>
           ) 
         </mo> 
        </mrow> 
       </mrow> 
       <mn>
         2 
       </mn> 
      </msup> 
     </mrow> 
    </math></p>
   <p>with parameters: 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <mi>
        B 
      </mi> 
      <mo>
        = 
      </mo> 
      <mn>
        100 
      </mn> 
     </mrow> 
    </math>, random seed = 42.</p>
   <p>* Predict testing set 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          test 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math> using lagged test features 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         X 
       </mi> 
       <mrow> 
        <mtext>
          test 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math>.</p>
   <p>- Output: Predicted test set 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mover accent="true"> 
        <mi>
          Y 
        </mi> 
        <mo>
          ^ 
        </mo> 
       </mover> 
       <mrow> 
        <mtext>
          test 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math></p>
   <p>4) Data Merging &amp; VAR Fitting</p>
   <p>- Input: 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          train 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math>, 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mover accent="true"> 
        <mi>
          Y 
        </mi> 
        <mo>
          ^ 
        </mo> 
       </mover> 
       <mrow> 
        <mtext>
          test 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math></p>
   <p>- Process:</p>
   <p>* Merge datasets chronologically: 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          new 
        </mtext> 
       </mrow> 
      </msub> 
      <mo>
        = 
      </mo> 
      <mrow> 
       <mo>
         [ 
       </mo> 
       <mrow> 
        <msub> 
         <mi>
           Y 
         </mi> 
         <mrow> 
          <mtext>
            train 
          </mtext> 
         </mrow> 
        </msub> 
        <mo>
          ; 
        </mo> 
        <msub> 
         <mover accent="true"> 
          <mi>
            Y 
          </mi> 
          <mo>
            ^ 
          </mo> 
         </mover> 
         <mrow> 
          <mtext>
            test 
          </mtext> 
         </mrow> 
        </msub> 
       </mrow> 
       <mo>
         ] 
       </mo> 
      </mrow> 
     </mrow> 
    </math>.</p>
   <p>* Fit extended VAR model with RF predictions as exogenous variables:</p>
   <p>
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         y 
       </mi> 
       <mi>
         t 
       </mi> 
      </msub> 
      <mo>
        = 
      </mo> 
      <mi>
        c 
      </mi> 
      <mo>
        + 
      </mo> 
      <munderover> 
       <mstyle displaystyle="true" mathsize="140%"> 
        <mo>
          ∑ 
        </mo> 
       </mstyle> 
       <mrow> 
        <mi>
          i 
        </mi> 
        <mo>
          = 
        </mo> 
        <mn>
          1 
        </mn> 
       </mrow> 
       <mrow> 
        <msub> 
         <mi>
           p 
         </mi> 
         <mrow> 
          <mtext>
            var 
          </mtext> 
         </mrow> 
        </msub> 
       </mrow> 
      </munderover> 
      <mtext>
          
      </mtext> 
      <msub> 
       <mi>
         A 
       </mi> 
       <mi>
         i 
       </mi> 
      </msub> 
      <msub> 
       <mi>
         y 
       </mi> 
       <mrow> 
        <mi>
          t 
        </mi> 
        <mo>
          − 
        </mo> 
        <mi>
          i 
        </mi> 
       </mrow> 
      </msub> 
      <mo>
        + 
      </mo> 
      <mi>
        β 
      </mi> 
      <msubsup> 
       <mover accent="true"> 
        <mi>
          y 
        </mi> 
        <mo>
          ^ 
        </mo> 
       </mover> 
       <mi>
         t 
       </mi> 
       <mrow> 
        <mtext>
          RF 
        </mtext> 
       </mrow> 
      </msubsup> 
      <mo>
        + 
      </mo> 
      <msub> 
       <mi>
         ϵ 
       </mi> 
       <mi>
         t 
       </mi> 
      </msub> 
     </mrow> 
    </math></p>
   <p>where 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         p 
       </mi> 
       <mrow> 
        <mtext>
          var 
        </mtext> 
       </mrow> 
      </msub> 
      <mo>
        = 
      </mo> 
      <mi>
        m 
      </mi> 
     </mrow> 
    </math> (selected via AIC).</p>
   <p>- Output: Fitted VAR coefficients 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         A 
       </mi> 
       <mi>
         i 
       </mi> 
      </msub> 
     </mrow> 
    </math>, 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mi>
       β 
     </mi> 
    </math>.</p>
   <p>5) Forecasting &amp; Evaluation</p>
   <p>- Input: Fitted VAR model, 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mi>
         Y 
       </mi> 
       <mrow> 
        <mtext>
          forecast 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math>.</p>
   <p>- Process:</p>
   <p>* Generate forecasts 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mover accent="true"> 
        <mi>
          Y 
        </mi> 
        <mo>
          ^ 
        </mo> 
       </mover> 
       <mrow> 
        <mtext>
          forecast 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math>.</p>
   <p>* Compute RMSE:</p>
   <p>
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <mtext>
        RMSE 
      </mtext> 
      <mo>
        = 
      </mo> 
      <msqrt> 
       <mrow> 
        <mfrac> 
         <mn>
           1 
         </mn> 
         <mrow> 
          <msub> 
           <mi>
             N 
           </mi> 
           <mrow> 
            <mtext>
              forecast 
            </mtext> 
           </mrow> 
          </msub> 
         </mrow> 
        </mfrac> 
        <munderover> 
         <mstyle displaystyle="true" mathsize="140%"> 
          <mo>
            ∑ 
          </mo> 
         </mstyle> 
         <mrow> 
          <mi>
            t 
          </mi> 
          <mo>
            = 
          </mo> 
          <mn>
            1 
          </mn> 
         </mrow> 
         <mrow> 
          <msub> 
           <mi>
             N 
           </mi> 
           <mrow> 
            <mtext>
              forecast 
            </mtext> 
           </mrow> 
          </msub> 
         </mrow> 
        </munderover> 
        <msup> 
         <mrow> 
          <mrow> 
           <mo>
             ( 
           </mo> 
           <mrow> 
            <msub> 
             <mi>
               Y 
             </mi> 
             <mrow> 
              <mtext>
                forecast 
              </mtext> 
             </mrow> 
            </msub> 
            <mrow> 
             <mo>
               [ 
             </mo> 
             <mi>
               t 
             </mi> 
             <mo>
               ] 
             </mo> 
            </mrow> 
            <mo>
              − 
            </mo> 
            <msub> 
             <mover accent="true"> 
              <mi>
                Y 
              </mi> 
              <mo>
                ^ 
              </mo> 
             </mover> 
             <mrow> 
              <mtext>
                forecast 
              </mtext> 
             </mrow> 
            </msub> 
            <mrow> 
             <mo>
               [ 
             </mo> 
             <mi>
               t 
             </mi> 
             <mo>
               ] 
             </mo> 
            </mrow> 
           </mrow> 
           <mo>
             ) 
           </mo> 
          </mrow> 
         </mrow> 
         <mn>
           2 
         </mn> 
        </msup> 
       </mrow> 
      </msqrt> 
     </mrow> 
    </math></p>
   <p>- Output: Forecast results 
    <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
      <msub> 
       <mover accent="true"> 
        <mi>
          Y 
        </mi> 
        <mo>
          ^ 
        </mo> 
       </mover> 
       <mrow> 
        <mtext>
          forecast 
        </mtext> 
       </mrow> 
      </msub> 
     </mrow> 
    </math>, RMSE value.</p>
   <p>The algorithm flow chart is as follows <xref ref-type="fig" rid="fig1">
     Figure 1
    </xref>:</p>
   <fig id="fig1" position="float">
    <label>Figure 1</label>
    <caption>
     <title>Figure 1. The algorithm flow chart.</title>
    </caption>
    <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/1733064-rId212.jpeg?20250224023353" />
   </fig>
  </sec><sec id="s4">
   <title>4. Empirical Analysis</title>
   <sec id="s4_1">
    <title>4.1. Data and Statistical Description</title>
    <p>The data used in this study is sourced from the Kaggle dataset, which includes air quality data (AQI dataset) for various continents from 2022 to 2024, as well as country/region mappings, ISO codes, and continent/region data (Country/Region Mapping - ISO, Continent, Region). The two datasets were integrated and matched according to continents, resulting in a new dataset that includes variables such as year, month, and AQI values. By combining the air quality data with the world region classification data, visualization analysis was conducted in Python, and the results are as follows:</p>
    <p>This <xref ref-type="fig" rid="fig2">
      Figure 2
     </xref> shows the frequency distribution of global Air Quality Index (AQI) statuses in the dataset. The X-axis represents the AQI statuses, including “Good,” “Moderate,” “Unhealthy for Sensitive Groups,” “Unhealthy,” “Very Unhealthy,” and “Hazardous.” The Y-axis represents the frequency of each status globally. The values above each bar indicate the number of occurrences of each AQI status, showing how many countries fall under each category.</p>
    <fig id="fig2" position="float">
     <label>Figure 2</label>
     <caption>
      <title>Figure 2. Global air quality statistics.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/1733064-rId213.jpeg?20250224023354" />
    </fig>
    <p>This <xref ref-type="fig" rid="fig3">
      Figure 3
     </xref> compares the distribution of air quality statuses across different continents, displaying the air quality classification for each region. The X-axis represents the regions, such as Asia, Europe, Africa, etc., while the Y-axis shows the frequency of each air quality status within the region. The values above each bar indicate the specific count of each air quality status in the region, illustrating the distribution of air quality in that area.</p>
    <p>This <xref ref-type="fig" rid="fig4">
      Figure 4
     </xref> illustrates the distribution of the Air Quality Index (AQI) across different continents, visualized using a boxplot. The X-axis represents regions, such as Asia, Europe, Africa, etc., while the Y-axis shows the AQI values, where higher values indicate more severe air pollution. The median line in the boxplot represents the median AQI for each region (shown as the values on each box). The box represents the inter-quartile range of AQI values in each region, reflecting the central tendency and range of variation in air quality. The points marked as “outliers” represent abnormal values, which are AQI readings that are far from</p>
    <fig id="fig3" position="float">
     <label>Figure 3</label>
     <caption>
      <title>Figure 3. Comparison of air quality status in different continents.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/1733064-rId214.jpeg?20250224023354" />
    </fig>
    <fig id="fig4" position="float">
     <label>Figure 4</label>
     <caption>
      <title>Figure 4. AQI value distribution by region.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/1733064-rId215.jpeg?20250224023354" />
    </fig>
    <p>the majority of the data points.</p>
   </sec>
   <sec id="s4_2">
    <title>4.2. Algorithm 1</title>
    <fig id="fig5" position="float">
     <label>Figure 5</label>
     <caption>
      <title>4.3. Algorithm 2<p class="imgGroupCss_v"><img class=" imgMarkCss lazy" data-original="https://html.scirp.org/file/1733064-rId217.jpeg?20250224023356" /></p>Through the calculations of the two algorithms, the RMSE values of the VAR model without Random Forest training and the VAR model with Random Forest training are shown in <xref ref-type="table" rid="table1">
        Table 1
       </xref>:<xref ref-type="bibr" rid="scirp.140769-"></xref>Table 1. Model comparison.
       <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
 
        <tr> 
  
         <td class="custom-bottom-td acenter" width="22.61%"><p style="text-align:center">Model</p></td> 
  
         <td class="custom-bottom-td acenter" width="22.61%"><p style="text-align:center">RMSE Value</p></td> 
 
        </tr> 
 
        <tr> 
  
         <td class="custom-top-td acenter" width="22.61%"><p style="text-align:center">VAR RMSE</p></td> 
  
         <td class="custom-top-td acenter" width="22.61%"><p style="text-align:center">49.1113</p></td> 
 
        </tr> 
 
        <tr> 
  
         <td class="acenter" width="22.61%"><p style="text-align:center">NEW Model RMSE</p></td> 
  
         <td class="acenter" width="22.61%"><p style="text-align:center">45.2686</p></td> 
 
        </tr>

       </table>In this method, the Random Forest regression model is used, with dimensionality-reduced features for training. By constructing multiple decision trees and employing ensemble learning, the model effectively identifies and models nonlinear patterns in the data. Additionally, the robustness of the Random Forest model enhances the overall model’s performance when dealing with data noise and outliers. The linear modeling capability of the VAR model ensures that the synergistic effects in multivariate time series are effectively utilized. By combining the strengths of both, it is evident that the RMSE value obtained by the proposed method for predicting the forecast set length is lower than that obtained by the VAR model alone, indicating superior performance compared to the single VAR model.The prediction results of the two models are shown in <xref ref-type="fig" rid="fig5">
        Figure 5
       </xref>:<xref ref-type="bibr" rid="scirp.140769-"></xref><p class="imgGroupCss_v"><img class=" imgMarkCss lazy" data-original="https://html.scirp.org/file/1733064-rId218.jpeg?20250224023356" /></p>Figure 5. Prediction results.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/1733064-rId216.jpeg?20250224023355" />
    </fig>
   </sec>
  </sec><sec id="s5">
   <title>5. Conclusion</title>
   <p>In this study, a new model for air quality prediction was developed by combining PCA, the VAR model, and the Random Forest regression model. By applying dimensionality reduction, the model effectively simplified the input variables while retaining key information. During the subsequent modeling process, the Random Forest model successfully captured nonlinear relationships and complex patterns in the data, while the VAR model excelled at handling linear dependencies in multivariate time series. The model, which combines the strengths of both, significantly improved the accuracy and stability of air quality prediction. Experimental results show that the combination of the Random Forest model and the VAR model has a clear advantage in handling high-dimensional data, especially in terms of robustness when dealing with data noise and outliers. The proposed meta-model framework can be further extended and optimized, offering great potential for applications in big data environments. Future research can explore the integration of more machine learning algorithms or time series models to further enhance the accuracy of air quality prediction. Moreover, to improve the model’s generalization ability, more effective methods can be explored to handle air quality data from different regions and various climate conditions. These improvements will provide stronger data support for environmental management and policy-making and promote the further application of big data technologies in environ-mental science.</p>
  </sec><sec id="s6">
   <title>Acknowledgements</title>
   <p>This paper was completed under the careful guidance of my supervisor, Associate Fuming Lin. In the determination of the research scheme, theoretical analysis, data processing, and the writing and finalization of the article, Lin gave me attentive teaching and selfless help. On the occasion of completing this paper, I would like to express our deep gratitude to Lin. This little-by-little achievement is the condensation of our blood and sweat. No matter where I go, your teachings will always be engraved in my heart.</p>
  </sec><sec id="s7">
   <title>Funding</title>
   <p>This work is partly supported by the Graduate Textbook Construction Project of Sichuan University of Science and Engineering (Grant No. KA202011) and the Opening Project of Sichuan Province University Key Laboratory of Bridge Non-destruction Detecting and Engineering Computing (2024QYY02).</p>
  </sec>
 </body><back>
  <ref-list>
   <title>References</title>
   <ref id="scirp.140769-ref1">
    <label>1</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     World Health Organization (2021) Global Air Quality Guidelines. WHO Publications.
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref2">
    <label>2</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Liu, J., He, C., Si, Y., Li, B., Wu, Q., Ni, J., et al. (2024) Toward Better and Healthier Air Quality: Global PM
     <sub>2.5</sub> and O
     <sub>3</sub> Pollution Status and Risk Assessment Based on the New WHO Air Quality Guidelines for 2021. Global Challenges, 8, Article ID: 2300258. &gt;https://doi.org/10.1002/gch2.202300258
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref3">
    <label>3</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Sims, C.A. (1980) Macroeconomics and Reality. Econometrica, 48, 1-48. &gt;https://doi.org/10.2307/1912017
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref4">
    <label>4</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Kou, L., Liao, J., Li, X., et al. (2022) Climate Change Prediction in Canada Based on VAR Model. Computer and Modernization, 10, 13-18. 
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref5">
    <label>5</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Breiman, L. (2001) Random Forests. Machine Learning, 45, 5-32. &gt;https://doi.org/10.1023/a:1010933404324
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref6">
    <label>6</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Qiu, W. and Lu, D. (2019) Analysis of Factors Affecting Agricultural Carbon Emission Based on VAR Model and Its Dynamic Response Mechanism. Hubei Agricultural Sciences, 58, 271-276. 
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref7">
    <label>7</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Hotelling, H. (1933) Analysis of a Complex of Statistical Variables into Principal Components. Journal of Educational Psychology, 24, 417-441. &gt;https://doi.org/10.1037/h0071325
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref8">
    <label>8</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Liu, H. and Zhang, H. (2019) Atmospheric Environmental Quality Evaluation of City Based on Principal Component Analysis. China Resource Comprehensive Utilization, 37, 141-143. (In Chinese)
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref9">
    <label>9</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Pearson, K. (1901) LIII. On Lines and Planes of Closest Fit to Systems of Points in Space. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 2, 559-572. &gt;https://doi.org/10.1080/14786440109462720
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref10">
    <label>10</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Richards, L.E. and Jolliffe, I.T. (1988) Book Review: Principal Component Analysis. Journal of Marketing Research, 25, 410-410. &gt;https://doi.org/10.1177/002224378802500410
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref11">
    <label>11</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Hou, P.S., Fadzil, L.M., Manickam, S. and Al-Shareeda, M.A. (2023) Vector Autoregression Model-Based Forecasting of Reference Evapotranspiration in Malaysia. Sustainability, 15, Article No. 3675. &gt;https://doi.org/10.3390/su15043675
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref12">
    <label>12</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Nachouki, M., Mohamed, E.A., Mehdi, R. and Abou Naaj, M. (2023) Student Course Grade Prediction Using the Random Forest Algorithm: Analysis of Predictors’ Importance. Trends in Neuroscience and Education, 33, Article ID: 100214. &gt;https://doi.org/10.1016/j.tine.2023.100214
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref13">
    <label>13</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Lin, J. and He, J. (2022) Parallel Random Forest Prediction Algorithm Based on PCA Stratified Sampling in the Big Data Environment. China Management Informationization, 25, 172-176. (In Chinese)
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref14">
    <label>14</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Huang, S. and Zhang, Z. (2023) Study on the Dynamic Relationship between Energy Consumption and Environmental Pollution in Chongqing City: Empirical Analysis Based on VAR Model. China-Arab States Science and Technology Forum (Chinese and English), 2023, 23-27. (In Chinese)
    </mixed-citation>
   </ref>
   <ref id="scirp.140769-ref15">
    <label>15</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Wei, X. (2023) Treatment and Application of Outlier in VAR Model. Science and Technology and Economy, 36, 101-105. (In Chinese) &gt;https://doi.org/10.14059/j.cnki.cn32-1276n.2023.06.021
    </mixed-citation>
   </ref>
  </ref-list>
 </back>
</article>