Regression analysis-based electricity price fluctuation quantification method, apparatus and device, and medium
Through the method based on regression analysis, a multivariate linear regression model was established and the ridge regression analysis method was used to solve the problem of failure to effectively consider linear relationships and multiple linear problems in the existing technology, and a stable and accurate quantitative analysis of electricity price volatility was achieved.
Patent Information
- Application Number
- CN202411635676.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-03-07
AI Technical Summary
The prior art fails to effectively consider the linear relationship and multiple linear problems between conditions when analyzing electricity price volatility, resulting in insufficient prediction accuracy.
Using a regression analysis method, by establishing a multivariate linear regression model, the fluctuations in the power price at peak load are used as the dependent variables, and new energy power generation, thermal power generation, power demand, power generation and capacity electricity prices are used as independent variables, and the overfitting of the model is reduced through the ridge regression analysis method.
A relatively stable volatility estimation was achieved, taking into account volatility over a long period of time, reducing the impact of a single event on market volatility, and improving the ability to accurately reflect the price volatility of the spot market.
Smart Images

Figure CN119579231A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electric power technology, and in particular to a method, device, equipment and medium for quantifying electricity price volatility based on regression analysis. Background Art
[0002] In the modern power market, the volatility of capacity electricity prices has gradually increased with the increasingly complex supply and demand relationship in the power market. In particular, with the increase in the proportion of renewable energy, wind power and solar power generation methods are affected by weather factors, resulting in frequent fluctuations in electricity prices. Only by identifying and assessing the risks of electricity price fluctuations can we adopt corresponding hedging strategies to reduce potential losses, help power system operators optimize resource scheduling, and improve system efficiency.
[0003] There is an increasing amount of research devoted to analyzing the volatility of capacity electricity prices. Existing technologies include time series analysis methods, such as the ARIMA model (autoregressive integrated moving average model), which is used to capture the dynamic characteristics and seasonal fluctuations of electricity prices. Another commonly used method is the GARCH model (generalized autoregressive conditional heteroskedasticity model), which can effectively model and predict the volatility of electricity prices. Machine learning methods such as random forests, support vector machines (SVMs), and neural networks have also been gradually introduced to handle complex nonlinear relationships and improve prediction accuracy. However, these methods do not consider the linear relationship between conditions and multilinear problems, and ignore the repeated effects of multiple variables.
[0004] The information disclosed in this background technology section is only intended to deepen the understanding of the overall background technology of the present invention, and should not be regarded as acknowledging or suggesting in any form that the information constitutes the prior art already known to those skilled in the art. Summary of the invention
[0005] The present invention provides a method, device, equipment and medium for quantifying electricity price volatility based on regression analysis, thereby effectively solving the problems in the background technology.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is: a method for quantifying electricity price volatility based on regression analysis, comprising the following steps:
[0007] A multivariate linear regression model was established by taking the fluctuation of electricity price during peak load as the dependent variable and taking renewable energy power generation, thermal power generation, electricity demand, power generation and capacity electricity price as independent variables.
[0008] Through scatter plots and correlation analysis, verify whether there is a linear relationship between the independent variables and the dependent variables, conduct preliminary multivariate linear regression analysis, find the optimal regression coefficient by minimizing the residual sum of squares, and make judgments on multiple linear problems;
[0009] The ridge regression analysis method is used to add a regularization term to the loss function to limit the size of the regression coefficient and reduce the overfitting of the model, and the ridge function is confirmed by cross-validation;
[0010] Performing overall significance test and regression coefficient significance test on the multivariate linear regression model and analyzing the goodness of fit;
[0011] The fitted multivariate linear regression model is used to quantitatively analyze electricity price fluctuations.
[0012] Furthermore, the establishment of a multiple linear regression model includes:
[0013] Y i =β0+β1x i1 +β2x i2 +β3x i3 +β4x i4 +β5x i5 +α;
[0014]
[0015] Where Y i is the objective function of the multivariate linear regression of capacity electricity price volatility, Y is the volatility of capacity electricity price; im As independent variables, they are represented as capacity electricity price, electricity demand, power generation, thermal power generation, and renewable energy power generation, where the capacity electricity price is a virtual 0-1 variable used to show whether the capacity electricity price is introduced; β0 is the intercept term, which indicates the expected value of the dependent variable when all independent variables are zero; β1, β2, β3, β4, and β5 are regression coefficients, which indicate the degree of influence of each independent variable on the dependent variable; α is the error term, which reflects the random error that cannot be explained by the model; log(P i ) is the logarithmic value of the peak load price of electricity on the i-th day, and μ is the average of 20 logarithmic differences.
[0016] Furthermore, the verification of whether there is a linear relationship between the independent variable and the dependent variable through scatter plot and correlation analysis includes the following steps:
[0017] Use scatter plots to determine whether there is a linear relationship between the independent and dependent variables;
[0018] The Pearson correlation coefficient between the independent and dependent variables was calculated to start the first multiple linear regression;
[0019] The residual is calculated for each prediction point i, and all residual values are summed to obtain the residual sum of squares; the regression coefficient β is differentiated to find the point where the derivative is 0 to minimize the residual sum of squares.
[0020] Furthermore, the determination of multiple linear problems includes:
[0021] After finding the minimum residual sum of squares for an independent variable, use it as the dependent variable, and the other independent variables remain as independent variables. A new multivariate linear regression model is constructed. After obtaining the predicted dependent variable value, the variance inflation factor VIF is calculated to determine whether there is a multilinear problem:
[0022]
[0023] Where, X i and Y i They correspond to the actual observed values of the independent variable and the actual observed values of the dependent variable respectively; and are the means of the corresponding independent variables and dependent variables respectively; RSS is the predicted value of the dependent variable and the actual observed value of the dependent variable Y i β is a vector containing the coefficients of all independent variables; X is a matrix containing all independent variable values, where each column is the value of an independent variable; Y is a vector of dependent variables; VIF m is the variance inflation factor corresponding to the mth independent variable; is the regression determination coefficient of the mth independent variable on other independent variables; SST is the total sum of squares; is the mean of the corresponding variable.
[0024] Furthermore, the ridge regression analysis method is used to add a regularization term to the loss function to limit the size of the regression coefficient and reduce the overfitting of the model, including:
[0025] While minimizing the residual sum of squares, a regularization term is added, which is the sum of squares of regression coefficients multiplied by a regularization parameter α;
[0026] The regularization term introduced It plays a penalty role on the regression coefficient, where α controls the strength of regularization.
[0027] Further, the confirming the ridge function by cross validation comprises:
[0028]
[0029] Where L(β) represents the loss function of ridge regression; α is the regularization parameter; E is the identity matrix; MSE is the mean square error;
[0030] Select multiple α at intervals of 0.01, and divide the data set into K subsets, of which K-1 subsets are used to train the model and the remaining 1 subset is used for testing; this process will be repeated K times, each time selecting a different subset as the test set and the other subsets as the training set; in each fold, for each candidate α value, use the training set to fit the model, and use the test set to calculate the model error; after each cross-validation training, calculate the variance inflation factor (VIF) value in the current model; select the regularization parameter α by comparing the VIF under different α values.
[0031] Furthermore, the overall significance test and regression coefficient significance test of the multivariate linear regression model include:
[0032] The F test is used to determine whether the multivariate linear regression model as a whole is statistically significant:
[0033] df1 = m;
[0034] df2 = nm-1;
[0035]
[0036] Where, df1 is the total square and degrees of freedom, m represents the number of independent variables; df2 is the residual square and degrees of freedom, n is the total number of samples; SST is the mean square error, RSS is the residual sum of squares;
[0037] Perform a t-test on the regression coefficient of each independent variable:
[0038]
[0039]
[0040] In the formula, is the estimated regression coefficient; is the standard error of the regression coefficient estimate; σ 2 is the residual variance of the regression model; S jj is the matrix (X T X) -1 The diagonal elements in .
[0041] The present invention also includes a device for quantifying electricity price volatility based on regression analysis, using the above method, the device comprising:
[0042] A modeling unit is used to establish a multiple linear regression model by taking the fluctuation of electricity price at peak load as the dependent variable and taking renewable energy power generation, thermal power generation, electricity demand, power generation and capacity electricity price as the independent variables;
[0043] A linear judgment unit is used to verify whether there is a linear relationship between the independent variable and the dependent variable through scatter plots and correlation analysis, perform preliminary multivariate linear regression analysis, find the optimal regression coefficient by minimizing the residual sum of squares, and perform multiple linear problem judgment;
[0044] The ridge regression unit is used to use the ridge regression analysis method, add regularization terms to the loss function to limit the size of the regression coefficient, reduce the overfitting of the model, and confirm the ridge function through cross-validation;
[0045] A testing unit, used to perform an overall significance test and a regression coefficient significance test on the multivariate linear regression model, and analyze the degree of fit;
[0046] The application unit is used to use the fitted multivariate linear regression model to perform quantitative analysis on electricity price fluctuations.
[0047] The present invention also includes a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method described above is implemented.
[0048] The present invention also includes a storage medium on which a computer program is stored. When the computer program is executed by a processor, the method described above is implemented.
[0049] The beneficial effects of the present invention are: it can provide a relatively stable volatility estimate, and taking into account the fluctuations over a longer period of time, it reduces the impact of a single event on market volatility. For frequent price fluctuations in the spot market, this method can more accurately reflect its volatility. By quantitatively analyzing the volatility of spot prices in the power market, the frequency and magnitude of price changes in the market are measured, thereby helping market participants assess price risks. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0051] Figure 1 is a flow chart of the method in Example 1;
[0052] Figure 2 It is a structural schematic diagram of the system in Example 1;
[0053] Figure 3 is a flow chart of the steps in Example 2;
[0054] Figure 4 It is a structural schematic diagram of the computer device of the present invention. DETAILED DESCRIPTION
[0055] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0056] Embodiment 1:
[0057] like Figure 1 As shown: A method for quantifying electricity price volatility based on regression analysis, comprising the following steps:
[0058] A multivariate linear regression model was established by taking the fluctuation of electricity price during peak load as the dependent variable and taking renewable energy power generation, thermal power generation, electricity demand, power generation and capacity electricity price as independent variables.
[0059] Through scatter plots and correlation analysis, we verify whether there is a linear relationship between the independent variables and the dependent variables, and conduct a preliminary multivariate linear regression analysis. By minimizing the residual sum of squares, we find the optimal regression coefficient and make judgments on multiple linear problems.
[0060] The ridge regression analysis method is used to add a regularization term to the loss function to limit the size of the regression coefficient and reduce the overfitting of the model, and the ridge function is confirmed by cross-validation;
[0061] Perform overall significance test and regression coefficient significance test on the multivariate linear regression model and analyze the goodness of fit;
[0062] The fitted multiple linear regression model is used to quantitatively analyze electricity price fluctuations.
[0063] It can provide a relatively stable volatility estimate and take into account fluctuations over a longer period of time, reducing the impact of a single event on market volatility. For frequent price fluctuations in the spot market, this method can more accurately reflect its volatility. By quantitatively analyzing the volatility of spot prices in the power market, the frequency and magnitude of price changes in the market are measured, thereby helping market participants assess price risks.
[0064] In this embodiment, a multiple linear regression model is established, including:
[0065] Y i =β0+β1x i1 +β2x i2 +β3x i3 +β4x i4 +β5x i5 +α;
[0066]
[0067] Where Y i is the objective function of the multivariate linear regression of capacity electricity price volatility, Y is the volatility of capacity electricity price; im As independent variables, they are represented as capacity electricity price, electricity demand, power generation, thermal power generation, and renewable energy power generation. The capacity electricity price is a virtual 0-1 variable used to show whether the capacity electricity price is introduced; β0 is the intercept term, which indicates the expected value of the dependent variable when all independent variables are zero; β1, β2, β3, β4, and β5 are regression coefficients, which indicate the degree of influence of each independent variable on the dependent variable; α is the error term, which reflects the random error that cannot be explained by the model; log(P i ) is the logarithmic value of the peak load price of electricity on the i-th day, and μ is the average of 20 logarithmic differences.
[0068] Among them, through scatter plot and correlation analysis, whether there is a linear relationship between the independent variable and the dependent variable is verified, including the following steps:
[0069] Use scatter plots to determine whether there is a linear relationship between the independent and dependent variables;
[0070] The Pearson correlation coefficient between the independent and dependent variables was calculated to start the first multiple linear regression;
[0071] The residual is calculated for each prediction point i, and all residual values are summed to obtain the residual sum of squares; the regression coefficient β is differentiated to find the point where the derivative is 0 to minimize the residual sum of squares.
[0072] Conduct multiple linear problem judgments, including:
[0073] After finding the minimum residual sum of squares for an independent variable, use it as the dependent variable, and the other independent variables remain as independent variables. A new multivariate linear regression model is constructed. After obtaining the predicted dependent variable value, the variance inflation factor VIF is calculated to determine whether there is a multilinear problem:
[0074]
[0075] Where, X i and Y i They correspond to the actual observed values of the independent variable and the actual observed values of the dependent variable respectively; and are the means of the corresponding independent variables and dependent variables respectively; RSS is the predicted value of the dependent variable and the actual observed value of the dependent variable Y i β is a vector containing the coefficients of all independent variables; X is a matrix containing all independent variable values, where each column is the value of an independent variable; Y is a vector of dependent variables; VIF mis the variance inflation factor corresponding to the mth independent variable; is the regression determination coefficient of the mth independent variable on other independent variables; SST is the total sum of squares; is the mean of the corresponding variable.
[0076] As a preferred embodiment of the above, a ridge regression analysis method is used to add a regularization term to the loss function to limit the size of the regression coefficient and reduce the overfitting of the model, including:
[0077] While minimizing the residual sum of squares, a regularization term is added, which is the sum of squares of regression coefficients multiplied by a regularization parameter α;
[0078] The regularization term introduced It plays a penalty role on the regression coefficient, where α controls the strength of regularization.
[0079] In this embodiment, the ridge function is confirmed by cross validation, including:
[0080]
[0081] Where L(β) represents the loss function of ridge regression; α is the regularization parameter; E is the identity matrix; MSE is the mean square error;
[0082] Select multiple α at intervals of 0.01, and divide the data set into K subsets, of which K-1 subsets are used to train the model and the remaining 1 subset is used for testing; this process will be repeated K times, each time selecting a different subset as the test set and the other subsets as the training set; in each fold, for each candidate α value, use the training set to fit the model, and use the test set to calculate the model error; after each cross-validation training, calculate the variance inflation factor (VIF) value in the current model; select the regularization parameter α by comparing the VIF under different α values.
[0083] Perform overall significance test and regression coefficient significance test on the multivariate linear regression model, including:
[0084] Use the F test to determine whether the multivariate linear regression model as a whole is statistically significant:
[0085] df1 = m;
[0086] df2 = nm-1;
[0087]
[0088] Where, df1 is the total square and degrees of freedom, m represents the number of independent variables; df2 is the residual square and degrees of freedom, n is the total number of samples; SST is the mean square error, RSS is the residual sum of squares;
[0089] Perform a t-test on the regression coefficient of each independent variable:
[0090]
[0091] In the formula, is the estimated regression coefficient; is the standard error of the regression coefficient estimate; σ 2 is the residual variance of the regression model; S jj is the matrix (X T X) -1 The diagonal elements in .
[0092] like Figure 2 As shown, this embodiment also includes a device for quantifying electricity price volatility based on regression analysis, using the above method, the device includes:
[0093] A modeling unit is used to establish a multiple linear regression model by taking the fluctuation of electricity price at peak load as the dependent variable and taking renewable energy power generation, thermal power generation, electricity demand, power generation and capacity electricity price as the independent variables;
[0094] The linear judgment unit is used to verify whether there is a linear relationship between the independent variable and the dependent variable through scatter plots and correlation analysis, conduct preliminary multivariate linear regression analysis, find the optimal regression coefficient by minimizing the residual sum of squares, and make judgments on multiple linear problems;
[0095] The ridge regression unit is used to use the ridge regression analysis method, add regularization terms to the loss function to limit the size of the regression coefficient, reduce the overfitting of the model, and confirm the ridge function through cross-validation;
[0096] The test unit is used to perform overall significance test and regression coefficient significance test on the multivariate linear regression model and analyze the goodness of fit;
[0097] Application unit for quantitative analysis of electricity price fluctuations using the fitted multivariate linear regression model.
[0098] Embodiment 2:
[0099] like Figure 3 As shown, this embodiment includes a capacity electricity price volatility analysis method to solve the electricity price fluctuation at the peak load, including:
[0100] The price fluctuation of electricity at peak load is taken as the spot market price fluctuation (dependent variable Y). It analyzes the logarithmic rate of return of prices in 20 consecutive time periods to obtain the monthly price volatility. New energy power generation, thermal power generation, demand, power generation and capacity electricity price are taken as independent variables, among which capacity electricity price is a dummy variable, which is 0 before introduction and 1 after introduction, and is used to measure the impact of the introduction of capacity electricity price. A multivariate linear regression model is established.
[0101] Scatter plots and correlation analysis are used to verify whether there is a linear relationship between the independent variable and the dependent variable. A preliminary multivariate linear regression analysis is performed to find the optimal regression coefficient by minimizing the sum of squares of the error terms (i.e., the residual sum of squares, RSS). Multiple linear problems are also judged.
[0102] The ridge regression analysis method was used, and a regularization term (L2 norm) was added to the loss function to reduce the overfitting of the model by limiting the size of the regression coefficient, thereby improving the model's predictive ability for new data. The ridge function was confirmed by cross-validation.
[0103] The regression model was tested for overall significance and regression coefficient significance, and the goodness of fit was analyzed.
[0104] Consider the relationship between the introduction of capacity electricity prices and the spot market prices in Jiangsu, as well as other possible influencing factors. Since it is the impact of multiple independent variables (such as capacity electricity prices, demand, power generation, thermal power generation, and renewable energy power generation) on the dependent variable (spot market price), the multivariate linear regression model is a suitable choice. And using a special monthly price volatility as the dependent variable, by analyzing the logarithmic returns of adjacent time points, the formula can provide a more stable volatility estimate, and taking into account fluctuations over a longer period of time, it reduces the impact of a single event on market volatility. For frequent price fluctuations in the spot market, this method can more accurately reflect its volatility.
[0105] Solve the fluctuation of electricity price during peak load, including:
[0106] Y i =β0+β1x i1 +β2x i2 +β3x i3 +β4x i4 +β5x i5 +α (2-1)
[0107]
[0108] In the formula, x imAs independent variables, they are represented as capacity electricity price, demand, power generation, thermal power generation, and renewable energy power generation, among which capacity electricity price is a virtual 0-1 variable used to show whether capacity electricity price is introduced; β0 is the intercept term, which indicates the expected value of the dependent variable when all independent variables are zero; (β1, β2, β3, β4, β5) are regression coefficients, which indicate the degree of influence of each independent variable on the dependent variable; α is the error term, which reflects the random error that cannot be explained by the model; log(P i ) is the logarithmic value of the peak load price of electricity on the i-th day, and μ is the average of 20 logarithmic differences.
[0109] Formula (2-1) is the objective function of the multivariate linear regression of capacity price volatility, including capacity price, demand, power generation, thermal power generation and charging costs, and their corresponding regression coefficients. Formula (2-2) quantitatively analyzes the volatility of spot prices in the power market, measures the frequency and magnitude of price changes in the market, and thus helps market participants assess price risks.
[0110] Scatter plots and correlation analysis are used to verify whether there is a linear relationship between the independent variable and the dependent variable, and preliminary multivariate linear analysis is performed, including:
[0111] Scatter plots and correlation analysis are used to verify whether there is a linear relationship between the independent variable and the dependent variable. Through scatter plots, the distribution pattern of data points can be observed intuitively. Scatter plots show the relationship between two variables by plotting data points on a two-dimensional plane. In a scatter plot, the horizontal axis represents the independent variable and the vertical axis represents the dependent variable. Each pair of data (independent variable value and corresponding dependent variable value) forms a point and is plotted in a coordinate system. Through the distribution of all data points, observe whether it shows a certain trend. If the data points are distributed along a roughly straight line, it may indicate that there is a linear relationship. This is implemented using Python's Matplotlib. Calculate the Pearson correlation coefficient. The Pearson correlation coefficient (Pearson Correlation Coefficient) is used to measure the degree of linear correlation between two variables, ranging from -1 to 1. Values close to 1 indicate strong positive correlation, close to -1 indicate strong negative correlation, and close to 0 indicate almost no linear relationship. Start the first multiple linear regression, calculate the residual for each prediction point i, sum all the differences to get the RSS, and take the derivative of the regression coefficient β to find the point that makes the derivative 0 to achieve the process of minimizing the RSS. Get the initial X i As the dependent variable, other independent variables are still independent variables. A new multivariate linear regression model is constructed. After obtaining the predicted dependent variable value, VIF is calculated to determine whether there is a multilinear problem.
[0112]
[0113]
[0114]
[0115]
[0116]
[0117]
[0118] Where X i and Y i They correspond to the actual observed values of the independent variable and the actual observed values of the dependent variable respectively; and are the means of the corresponding independent variables and dependent variables respectively; RSS is the predicted value of the dependent variable and the actual observed value of the dependent variable Y i The sum of the differences; β is a vector containing the coefficients of all independent variables; X is a matrix containing all the independent variable values, where each column is the value of an independent variable; Y is a vector of dependent variables. m is the variance inflation factor corresponding to the mth independent variable. is the regression coefficient of determination of the mth independent variable on other independent variables. SST is the total sum of squares. is the mean of the corresponding variable.
[0119] Formula (2-3) can quantitatively describe the linear dependency between two variables. Formula (2-4) RSS is used to evaluate the model fitting effect and optimize the regression coefficient in regression analysis, and is an important indicator for evaluating model performance. Formula (2-5) uses the independent variable matrix and the dependent variable vector to solve the optimal regression coefficient through matrix operations to minimize the sum of squared errors between the predicted value and the actual value, thereby achieving the best linear fit to the data. Formula (2-6) is a statistical indicator used to detect multicollinearity problems in regression models. It measures whether an independent variable is highly correlated with other independent variables, which in turn leads to unstable regression coefficients in the regression model. Formula (2-7) is the regression determination coefficient of the mth independent variable to other independent variables. Formula (2-8) represents the total variation of the dependent variable, which reflects the difference between all data points and the mean of the dependent variable.
[0120] After completing the preliminary multiple linear regression, you can make a preliminary judgment and evaluation of the model and test the VIF of each independent variable. If it exceeds 10, it means that the multiple linear problem is relatively large and the model needs to be improved.
[0121] Ridge analysis was used to address multicollinearity issues, including:
[0122] The ridge regression analysis method introduces a regularization term (L2 norm) into the loss function of traditional linear regression to deal with the multicollinearity problem and improve the generalization ability of the model. Specifically, this method adds a regularization term while minimizing the residual sum of squares. This term is the sum of the squares of the regression coefficients multiplied by a regularization parameter α. By introducing this term, ridge regression can effectively limit the size of the regression coefficients, thereby avoiding the problem of overfitting the model when facing highly correlated independent variables. Overfitting usually causes the model to perform well on the training data, but has poor predictive ability on new data. The regularization term introduced It plays a penalty role on the regression coefficient, where α controls the strength of regularization. When it is large, the regression coefficient is compressed smaller, which reduces the complexity of the model and improves the robustness of the model when facing new data. In order to find the most suitable regularization parameter α, the cross-validation method is usually used. During the cross-validation process, the model is trained and tested on multiple different subsets, the impact of different α values on model performance is evaluated, and the α that minimizes the error of the validation set is selected as the final regularization parameter. This strategy ensures that the model can effectively fit the data without being too complex and performing poorly on new data.
[0123]
[0124]
[0125]
[0126] Select multiple α values at intervals of 0.01, and divide the data set into K subsets (usually 5 or 10 folds), of which K-1 subsets are used to train the model and the remaining 1 subset is used for testing. This process will be repeated K times, each time selecting a different subset as the test set and the other subsets as the training set. In each fold, for each candidate α value, the training set is used to fit the model, and the model error is calculated using the test set. After each cross-validation training, the VIF value in the current model is calculated. By comparing the VIF under different α values, it is ensured that the final selected model not only shows a lower error in the validation set, but also that the collinearity between its independent variables is within an acceptable range.
[0127] Where L(β) represents the loss function of ridge regression; α is the regularization parameter; E is the identity matrix; and MSE is the mean square error.
[0128] Formula (2-9) is the loss function formula of ridge regression. The first part of the formula, namely the residual sum of squares, measures the error between the model prediction value and the actual observation value. By minimizing this part, the model fit is improved. The second part is the regularization term, which aims to control the size of the regression coefficient to prevent the model from overfitting when multicollinearity exists, thereby improving its generalization ability to new data. This method ensures that the selected model performs well on both the training set and the validation set, thus providing a powerful tool for solving complex regression problems. Formula (2-10) combines the independent variable matrix X and the dependent variable vector Y to obtain the optimal regression coefficient vector by minimizing the loss function. Formula (2-11) measures the overall error of the model. The smaller the MSE, the closer the model's prediction value is to the actual value, and the better the fitting effect.
[0129] Perform overall significance test and regression coefficient significance test on the regression model and analyze the goodness of fit, including:
[0130] The significance test of the regression model includes two parts: the overall significance test and the regression coefficient significance test, and the performance of the model is evaluated by the goodness of fit. In the overall significance test, we use the F test to determine whether the regression model as a whole is statistically significant. The null hypothesis of the F test is that all regression coefficients are 0 (that is, no independent variable has a significant effect on the dependent variable). The F statistic is calculated by comparing the mean square error of the model fitting and the residual sum of squares. If the F value is large and the corresponding p value is less than the significance level (0.05), the null hypothesis can be rejected, indicating that the model is significant overall. The regression coefficient significance test is a t-test performed on the regression coefficient of each independent variable to determine whether a single independent variable has a significant effect on the dependent variable. The null hypothesis of the t-test is that the regression coefficient of the independent variable is 0. If the p-value corresponding to the t-value is less than 0.05, it means that the independent variable has a significant contribution to the model. Finally, the goodness of fit index (R 2 ) to analyze the model's ability to explain the variance of the dependent variable. 2 The closer the value is to 1, the better the model fit is, that is, the independent variable can better explain the changes in the dependent variable.
[0131] df1=m (2-12)
[0132] df2=nm-1 (2-13)
[0133]
[0134]
[0135]
[0136]
[0137] Where df1 is the total square and degrees of freedom; df2 is the residual square and degrees of freedom; is the estimated regression coefficient; is the standard error of the regression coefficient estimate; σ 2 is the residual variance of the regression model; S jj is a matrix (X T X) -1 The diagonal elements in .
[0138] Formula (2-12) refers to the total sum of squares (SST) degrees of freedom df1 = m in regression analysis, which represents the number of independent variables (i.e., the number of independent variables in the model that explain the changes in the dependent variable), also known as regression degrees of freedom. This degree of freedom indicates the number of parameters used in the model to explain the changes in the dependent variable. Formula (2-13) refers to the number of valid data points in the residual sum of squares, which is equal to the total number of samples minus the number of independent variables and 1 (for the intercept term). This means how many data points are not explained by the independent variables in the regression model. Formula (2-14) By comparing two variance terms: the mean square of SST (explained variation) and the mean square of RSS (unexplained variation), the F value can be used to determine whether the regression model is significant. A larger F value indicates that the explanatory variable has a significant effect on the dependent variable, thereby providing evidence for the validity of the model. Formula (2-15) indicates that the t-test in the regression model is used to determine whether a regression coefficient is significantly different from zero. If the t-value is large enough, it usually indicates that the independent variable significantly affects the dependent variable, otherwise it may not have a significant effect. Constraint (2-16) This formula reveals how the uncertainty of the regression coefficient is affected by the model error and the information of the independent variable. If the residual variance is large or the information of the independent variable is insufficient, the standard error will be large, indicating that there is a high uncertainty in the estimated value of the regression coefficient. Constraint (2-17) represents the estimated value of the variance of the error term in the regression analysis, which reflects the amount of variation that is not explained in the model.
[0139] Results:
[0140] We confirm the value of the regularization coefficient through Table 1. Substituting α = 0.02, we can get spot price fluctuation = -6.477 + 41.134 * capacity price_none - 0.002 * power generation (GWH) - 0.003 * demand (GWH) + 0.009 * thermal power generation (GWH) + 0.007 * new energy power generation (GWH).
[0141] Table 1
[0142]
[0143] Through Table 2, we start to conduct F test, and divide the total sum of squares and the residual sum of squares by the corresponding degrees of freedom (df) to get their respective mean squares. The two mean squares are divided to get the F statistic, and then the corresponding p value can be found according to the F distribution table. If the p value is less than 0.05, it means that the model is meaningful. It is found that the model passes the F test (F = 5.289, p = 0.004 < 0.05), which means that at least one of the capacity electricity price_none, power generation (GWH), demand (GWH), thermal power generation (GWH), and renewable energy power generation (GWH) will have an impact on the spot market price fluctuations.
[0144] Table 2
[0145] sum of squares df Mean Square F p-value return 16614.897 5 3322.979 5.289 0.004 Residual 11308.061 18 628.226 total 27922.958 23
[0146] Through Table 3, we start to conduct t-test. The t-test is similar to the F-test. After calculating the t-statistic, the p-value corresponding to the t-statistic is found through the distribution table. If the p-value is less than 0.05, it means that the independent variable has a significant impact on the dependent variable. We can see that only the p-value of capacity electricity price_none is less than 0.05, indicating that only the capacity electricity price has a significant impact and the regression coefficient is 41.134, indicating that the capacity electricity price_none has a positive impact on the spot price fluctuation. Since the capacity electricity price is set as a dummy variable in the regression model, the dummy variable appears in pairs and is divided into capacity electricity price_yes and capacity electricity price_no. This shows that compared with the power market where the capacity electricity price is introduced, if the capacity electricity price does not exist in the current market, the spot price fluctuation will increase significantly. The model R-square value is 0.595, which means that capacity electricity price_none, power generation (GWH), demand (GWH), thermal power generation (GWH), and new energy power generation (GWH) can explain 59.50% of the changes in spot market price fluctuations. Since we are more concerned about the impact of capacity electricity prices on spot market prices, that is, the impact of X on Y, the R-square value is within a reasonable range. The VIF of all independent variables is less than 10, and only the VIF of thermal power generation is slightly higher than 5, indicating that the collinearity problem has been basically solved.
[0147] Table 3
[0148]
[0149]
[0150] See also Figure 4 A computer device 400 provided in an embodiment of the present application includes: a processor 410 and a memory 420, wherein the memory 420 stores a computer program executable by the processor 410, and when the computer program is executed by the processor 410, the above method is executed.
[0151] The embodiment of the present application further provides a storage medium 430 on which a computer program is stored. When the computer program is run by the processor 410, the above method is executed.
[0152] Among them, the storage medium 430 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, disk or optical disk.
[0153] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. "Multiple" means two or more, unless otherwise clearly and specifically defined.
[0154] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0155] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0156] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.
[0157] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0158] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0159] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0160] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present invention. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.
Claims
1. A method for quantifying electricity price volatility based on regression analysis, characterized in that: The steps include: A multivariate linear regression model was established by taking the fluctuation of electricity price during peak load as the dependent variable and taking renewable energy power generation, thermal power generation, electricity demand, power generation and capacity electricity price as independent variables. Through scatter plots and correlation analysis, verify whether there is a linear relationship between the independent variables and the dependent variables, conduct preliminary multivariate linear regression analysis, find the optimal regression coefficient by minimizing the residual sum of squares, and make judgments on multiple linear problems; The ridge regression analysis method is used to add a regularization term to the loss function to limit the size of the regression coefficient and reduce the overfitting of the model, and the ridge function is confirmed by cross-validation; Performing overall significance test and regression coefficient significance test on the multivariate linear regression model and analyzing the goodness of fit; The fitted multivariate linear regression model is used to quantitatively analyze electricity price fluctuations.
2. The method for quantifying electricity price volatility based on regression analysis according to claim 1, characterized in that: The multivariate linear regression model is established, comprising: Y i =β0+β1x i1 +β2x i2 +β3x i3 +β4x i4 +β5x i5 +a; Where Y i is the objective function of the multivariate linear regression of capacity electricity price volatility, Y is the volatility of capacity electricity price; im As independent variables, they are represented as capacity electricity price, electricity demand, power generation, thermal power generation, and renewable energy power generation, where the capacity electricity price is a virtual 0-1 variable used to show whether the capacity electricity price is introduced; β0 is the intercept term, which indicates the expected value of the dependent variable when all independent variables are zero; β1, β2, β3, β4, and β5 are regression coefficients, which indicate the degree of influence of each independent variable on the dependent variable; α is the error term, which reflects the random error that cannot be explained by the model; log(P i ) is the logarithmic value of the peak load price of electricity on the i-th day, and μ is the average of 20 logarithmic differences.
3. The method for quantifying electricity price volatility based on regression analysis according to claim 1, characterized in that: The verification of whether there is a linear relationship between the independent variable and the dependent variable through scatter plot and correlation analysis includes the following steps: Use scatter plots to determine whether there is a linear relationship between the independent and dependent variables; The Pearson correlation coefficient between the independent and dependent variables was calculated to start the first multiple linear regression; The residual is calculated for each prediction point i, and all residual values are summed to obtain the residual sum of squares; the regression coefficient β is differentiated to find the point where the derivative is 0 to minimize the residual sum of squares.
4. The method for quantifying electricity price volatility based on regression analysis according to claim 3, characterized in that: The multi-linear problem determination includes: After finding the minimum residual sum of squares for an independent variable, use it as the dependent variable, and the other independent variables remain as independent variables. A new multivariate linear regression model is constructed. After obtaining the predicted dependent variable value, the variance inflation factor VIF is calculated to determine whether there is a multilinear problem: Where, X i and Y i They correspond to the actual observed values of the independent variable and the actual observed values of the dependent variable respectively; and are the means of the corresponding independent variables and dependent variables respectively; RSS is the predicted value of the dependent variable and the actual observed value of the dependent variable Y i β is a vector containing the coefficients of all independent variables; X is a matrix containing all independent variable values, where each column is the value of an independent variable; Y is a vector of dependent variables; VIF m is the variance inflation factor corresponding to the mth independent variable; is the regression determination coefficient of the mth independent variable on other independent variables; SST is the total sum of squares; is the mean of the corresponding variable.
5. The method for quantifying electricity price volatility based on regression analysis according to claim 1, characterized in that: The ridge regression analysis method is used to add a regularization term to the loss function to limit the size of the regression coefficient and reduce the overfitting of the model, including: While minimizing the residual sum of squares, a regularization term is added, which is the sum of squares of regression coefficients multiplied by a regularization parameter α; The regularization term introduced It plays a penalty role on the regression coefficient, where α controls the strength of regularization.
6. The method for quantifying electricity price volatility based on regression analysis according to claim 5, characterized in that: The ridge function is confirmed by cross validation, comprising: Where L(β) represents the loss function of ridge regression; α is the regularization parameter; E is the identity matrix; MSE is the mean square error; Select multiple α at intervals of 0.01, and divide the data set into K subsets, of which K-1 subsets are used to train the model and the remaining 1 subset is used for testing; this process will be repeated K times, each time selecting a different subset as the test set and the other subsets as the training set; in each fold, for each candidate α value, use the training set to fit the model, and use the test set to calculate the model error; after each cross-validation training, calculate the variance inflation factor (VIF) value in the current model; select the regularization parameter α by comparing the VIF under different α values.
7. The method for quantifying electricity price volatility based on regression analysis according to claim 1, characterized in that: The overall significance test and regression coefficient significance test of the multivariate linear regression model include: The F test is used to determine whether the multivariate linear regression model as a whole is statistically significant: df1 = m; df2 = nm-1; Where, df1 is the total square and degrees of freedom, m is the number of independent variables; df2 is the residual square and degrees of freedom, n is the total number of samples; SST is the mean square error, RSS is the residual sum of squares; Perform a t-test on the regression coefficient of each independent variable: In the formula, is the estimated regression coefficient; is the standard error of the regression coefficient estimate; σ 2 is the residual variance of the regression model; S jj is the matrix (X T X) -1 The diagonal elements in .
8. A device for quantifying electricity price volatility based on regression analysis, characterized in that: Using the method according to any one of claims 1 to 7, the device comprises: A modeling unit is used to establish a multiple linear regression model by taking the fluctuation of electricity price at peak load as the dependent variable and taking renewable energy power generation, thermal power generation, electricity demand, power generation and capacity electricity price as the independent variables; A linear judgment unit is used to verify whether there is a linear relationship between the independent variable and the dependent variable through scatter plots and correlation analysis, perform preliminary multivariate linear regression analysis, find the optimal regression coefficient by minimizing the residual sum of squares, and perform multiple linear problem judgment; The ridge regression unit is used to use the ridge regression analysis method, add regularization terms to the loss function to limit the size of the regression coefficient, reduce the overfitting of the model, and confirm the ridge function through cross-validation; A testing unit, used to perform an overall significance test and a regression coefficient significance test on the multivariate linear regression model, and analyze the degree of fit; The application unit is used to use the fitted multivariate linear regression model to perform quantitative analysis on electricity price fluctuations.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Method and system for constructing periodontitis prediction model based on heavy metals and polycyclic aromatic hydrocarbons
CN120126812A
Convex optimization-based motor imagery electroencephalogram signal classification method and system
CN120632724A