## 2 Materials and Methods
### Methodology
The following measures can be used to compare the synthetic and training data statistically:  
* The standard deviation of the energy consumption: \[\sigma=\sqrt{\frac{1}{n-1}{\sum_{t=1}^{n}(x_{i}-\overline{x})}}\] (3)
* The variance of the energy consumption:\[\sigma^{2}=\frac{1}{n-1}\sum_{i=1}^{n}(x_{i}-\overline{x}) \tag{4}\]  
```
Let \(X_{t}\) be the last state for the hour \(h\) if the probability for the current state in the transition matrix \(M_{h:h+1}\) (the matrix, describing the transition between the \(h\) hour and the \(h+1\) hour) is 0: { repeat\(N\) times: {  X\({}_{t}\) = \(M_{h:h}(X_{t-1})//\)Generate the last state \(X_{t}\) again (the transition between \(X_{t-1}\) and \(X_{t}\)) if the transition probability from state \(X_{t}\) in \(M_{h:h+1}\) is nonzero: { //Continue with the newly obtained state \(X_{t}\); break; } } } if an appropriate state \(X_{t}\) was obtained, for which a transition exists in the matrix \(M_{h:h+1}\): {  X\({}_{t+1}\) = \(M_{h:h+1}(X_{t})//\)generate the next state \(X_{t+1}\) from the current state \(X_{t}\) } else {  X\({}_{t+1}\) = rand(all states)//randomly choose a new state from all states in \(M_{h:h+1}\). } ```  
**Algorithm 2** Handling of the situation where the current state exists in the hour-change matrix with a zero probability. To compare the original and synthetic load profiles probabilistically, their hourly and hour-change matrices should be compared. The matrices describing the synthetic data should be generated as described in phase 3.1 of the methodology. It should be noted that while it is expected that these matrices match perfectly, this is not always the case. As mentioned in phase 3.1, sometimes the final state for an hour does not exist in the next hour-change transition matrix, which leads to changes in the probabilities of the synthetic time series. The following metrics could be used for comparing two matrices \(A\) and \(B\):  
* the Frobenius distance: \[F=\sqrt{\sum_{i=1}^{n}\sum_{j=1}^{n}(a_{ij}-b_{ij})^{2}},\] (5)  
which returns a positive value or zero. It could be interpreted as follows: the closer \(F\) is to zero, the closer the two matrices are. It is an extension of the Euclidean distance for matrices and allows measuring the common difference between two matrices [34]. * the coefficient of determination (\(R^{2}\)) [35]--in order to apply it on matrices, they should first be converted from \(n\times n\) dimensional ones to an \(n^{2}\) dimensional vector. \[A_{\mathrm{n}\times\mathrm{n}}= \begin{bmatrix}x_{11}&\ldots&x_{1n}\\ \vdots&\ddots&\vdots\\ x_{n1}&\ldots&x_{nm}\end{bmatrix} \quad\rightarrow\quad A_{\mathrm{n}^{2}\times 1}= \begin{bmatrix}x_{11}&\ldots&x_{1n}&\ldots&x_{n1}&\ldots&x_{nn}\end{bmatrix}  \tag{6}\]  
\[B_{\mathrm{n}\times\mathrm{n}}= \begin{bmatrix}y_{11}&\ldots&y_{1n}\\ \vdots&\ddots&\vdots\\ y_{n1}&\ldots&y_{m}\end{bmatrix} \quad\rightarrow\quad B_{\mathrm{n}^{2} \times 1}= \begin{bmatrix}y_{11}&\ldots&y_{1n}&\ldots&y_{n1}&\ldots&y_{nn}\end{bmatrix} \]  
Thereafter, the two one-dimensional vectors \(A_{\mathrm{n}}{}^{2}\) and \(B_{\mathrm{n}}{}^{2}\) can be compared with  
\[R^{2}=\left[\frac{n\times\sum_{i=1}^{n}\left(x_{i}\times y_{i}\right)-\sum_{i =1}^{n}\left(x_{i}\right)\times\sum_{i=1}^{n}\left(y_{i}\right)}{\sqrt{n \times\sum_{i=1}^{n}\left(x_{i}^{2}\right)-\left(\sum_{i=1}^{n}\left(x_{i} \right)\right)^{2}}\times\sqrt{n\times\sum_{i=1}^{n}\left(y_{i}^{2}\right)- \left(\sum_{i=1}^{n}\left(y_{i}\right)\right)^{2}}}\right]^{2} \tag{7}\]  
\(R^{2}\) is a statistical measure that determines the proportion of variance in the dependent variable that can be explained by the independent variable in a regression model. Values close to 1.0 would indicate that the matrix of the synthetic data is almost identical to the original one, while lower values indicate the two variables are more or less different ([PERSON], 2019). According to the proposed methodology, the synthetic load generation model is represented by 24-hourly and 24 h-change transition matrices.