# Simulation of Wind Speeds with Spatio-Temporal Correlation
## 2 Methodology
### Modeling
#### 2.1.5 Obtaining the Desired Correlations  
To finish the modeling stage, the relations between locations are achieved. For this, the correlations are calculated from the Normal standard distributed series of values obtained in the previous step. As was mentioned in Section 2.1.2, the positions of the values of the series are kept guaranteeing the correspondence in the calculation of the correlations, changing wrong values to zero. Thus, the correlations are calculated between pairs of locations, discarding the null values. The correlations vary in the interval [\(-1\),1], where \(+1\) is equal to a perfect direct correlation, i.e., the variables move in the same direction; \(-1\), corresponds to a perfect inverse correlation, i.e., the variables move in the opposite direction; and \(0\), to the nonexistence of correlation between the variables. Figure 3 shows these three correlation possibilities graphically [31]. The following paragraphs explain the types of correlations considered in this paper, i.e., spatial correlation, autocorrelation and cross-correlation. 1. Spatial correlation [PERSON]'s correlation, \(\rho_{XY}\), measures the force and the direction of the linear correlation of two variables \(X\) and \(Y\). This can be written as in Equation (7) with the quotient between covariance, \(cov(X,Y)\), and the standard deviations, \(\sigma_{X}\), \(\sigma_{Y}\), of the involved variables [31]:  
Figure 3: Possibilities for normalized correlations: (**a**) positive correlation, (**b**) negative correlation, (**c**) no correlation. Figure 2: Transformation between Normal (0,1) and Weibull distributions, where WtN shows the Weibull to Normal (0,1) direction and NtW the Normal (0,1) to Weibull direction: (**a**) Weibull cumulative distribution functions (CDF), (**b**) Normal CDF. \[\rho_{XY}=\frac{cov(X,Y)}{\sigma_{X}\sigma_{Y}} \tag{7}\]  
As shown in Equation (8), the covariance provides information on how both variables evolve:  
\[cov(X,Y)=\frac{\sum_{i=1}^{n}\left(X_{i}-\widetilde{X}\right)\left(Y_{i}- \widetilde{Y}\right)}{n} \tag{8}\]  
where \(X_{i}\) is the value of sequence \(X\) at time \(i\), \(\widetilde{X}\) is the mean value of \(X\), \(Y_{i}\) is the value of sequence \(Y\) at time \(i\) and \(\widetilde{Y}\) is the mean value of the \(Y\). If \(cov(X,Y)<0\), the trend of one of the variables to increase coincides with the trend of the other variable to decrease. If \(cov(X,Y)>0\), both variables tend to increase or decrease simultaneously, or at least there is a certain similarity in both trends. If \(cov(X,Y)=0\), there is not a common trend [31]. The standard deviation of the considered variables, Equations (9) and (10), provides the dispersion of the data around the mean value. The greater the standard deviation is, the greater dispersion and vice versa [31]:  
\[\sigma_{X}=\sqrt{\frac{\sum_{i=1}^{n}\left(X_{i}-\widetilde{X}\right)^{2}}{n}} \tag{9}\]  
\[\sigma_{Y}=\sqrt{\frac{\sum_{i=1}^{n}\left(Y_{i}-\widetilde{Y}\right)^{2}}{n}} \tag{10}\]  
As can be seen in Equation (11), the values obtained for every two variables take part in a correlation matrix \(\mathbf{P}\) of size \(m\times m\), where \(m\) is the total number of locations. \[\mathbf{P}=\left[ \begin{array}{cccc}\rho_{11}&\rho_{12}&\ldots&\rho_{1\text{ m}}\\ \rho_{21}&\rho_{22}&&\rho_{2\text{ m}}\\ \vdots&\ddots&\vdots\\ \rho_{m1}&\rho_{m2}&\cdots&\rho_{mm}\end{array} \right] \tag{11}\]  
Due to the use of the Pearson's correlation coefficient, the correlation matrix has some particularities:  
* Elements of the main diagonal equal 1, Equation (12) \[\rho_{ij}=1,\;\forall\;i=j\in\;\{1,2,\ldots,m\}\] (12)
* It is symmetrical, Equation (13) \[\rho_{ij}=\rho_{ji},\;\forall\;i\
eq j\in\{1,2,\ldots,m\}\] (13)
* It is positive semidefinite. It can be said that the number of calculations depends on the number of correlation values between different locations.