# Medium- and Long-Term Load Forecasting for Power Plants Based on Causal Inference and Informer
## 3 Methods
### Causal Effect Estimation Model of External Factors  
Based on the screening results of the mutual information method obtained in Section 3.1, the causal effect of ambient temperature on load was the focus of the present study. Other external variables were treated as binary variables for rough causal effect calculation. First, the causal effect of external variables other than ambient temperature was calculated using propensity score matching (hereafter referred to as PSM) [29]. All external variables except ambient temperature were converted to binary variables using carefully designed rules. Therefore, the treatment of the variables was also binary, and the treatment could only take the value of 0 or 1. Then, \(Y\) was used to refer to the outcome of the causal effect, that is, load. Additionally, feature \(X\) consists of each external factor, where \(X_{i}\) is sample \(i\)'s feature vector. The causal effect of treatment \(t\) on \(Y\) was the focus of the present study, specifically the average treatment effect (hereinafter abbreviated as ATE).  
\[V_{ATE}=E[V_{ITE}]=E[Y_{1}]-E[Y_{0}] \tag{13}\]  
The \(V_{ITE}\) mentioned in the above equation refers to the individual treatment effect (ITE), which is defined as \(V^{i}_{ITE}=Y^{i}_{1}-Y^{i}_{0}\).  
For PSM, each sample is first divided into two groups according to the true value of treatment \(t\), which is a binary variable. PSM assumes that \(t\) is a random variable drawn from a particular distribution, that is, \(t_{i}\sim P(t_{i}\,|\,x_{i})\). In each group, the probability of receiving a certain \(t\) is calculated for each instance based on given \(x\). This probability is called the propensity score. Finally, the samples with the closest propensity scoresin different groups are matched. Taking sample \(i\) as an example, sample \(j\) s.t. argmin \(\textit{dist}(i,j)=\left\lvert P(t\mid X_{i})-P(t\mid X_{j})\right\rvert\) is found. The ATE that is obtained from PSM is as follows:  
\[\hat{\tau}=\frac{1}{n}\left[\sum_{i:t_{i}=1}\left(y_{i}-y_{j}\right)+\sum_{i:t_ {i}=0}\left(y_{j}-y_{i}\right)\right] \tag{14}\]  
As one of the external variables with the most significant impact on load, the continuous treatment effect of temperature is computed with an interval of \(1\)\({}^{\circ}\)C. The Double Machine Learning (hereafter referred to as DML) [30] approach is applied to achieve unbiased estimation of the effect of temperature on load. The random forest algorithm [31] is applied to fit the load \(Y\) and the temperature \(T\) separately. The residuals are obtained by removing the corresponding random forest algorithm fit results from the load \(Y\) and temperature \(T\), respectively.  
\[\widetilde{Y}=Y-\tilde{Y}(X) \tag{15}\]  
\[\widetilde{T}=T-\hat{T}(X) \tag{16}\]  
where \(\widetilde{Y}\) and \(\widetilde{T}\) are the fitted residuals. After obtaining the residuals \(\widetilde{Y}\) and \(\widetilde{T}\), the causal effect can be obtained by modeling a regression equation. The specific equation is \(\widetilde{Y}=\theta(\mathbf{X})\widetilde{T}\). The residuals \(\widetilde{Y}\) and \(\widetilde{T}\) are the quantities of variation and are related by \(\theta(\mathbf{X})\). \(\theta(\mathbf{X})\) describes the association between \(\widetilde{Y}\) and \(\widetilde{T}\), which is the causal effect ATE. Because \(\theta(\mathbf{X})\) is an equation related to \(x\), it can be solved by the method of least squares.