Abstract
Combining Response Surface Methodology (RSM) with Central Composite Design (CCD) is a powerful statistical approach to optimizing materials in energy storage systems. This study presents an open-source Python (v3.8+) framework that replicates and validates the RSM-based optimization of NiCo2S4–graphene supercapattery materials. We validated the framework by replicating a 20-experiment CCD analyzing graphene/NCS ratios, hydrothermal time, and S/Ni molar ratios. Advanced optimization using the Differential Evolution algorithm was integrated to efficiently solve the high-dimensional response surface space. The model explained 97.16% of the variance, and comprehensive diagnostic tests confirmed the assumptions of normality and residual independence. This approach provides an open-source methodology that supports reproducible and scalable data-driven material design and facilitates transparent computational materials science studies.
1. Introduction
This article is a revised and expanded version of a paper entitled Python-Based Automated Response Surface Methodology: Computational Replication and Validation Framework for Supercapattery Materials Optimization, which was presented at The 1st International Online Conference on Designs.
Combining Response Surface Methodology (RSM) with Central Composite Design (CCD) is a powerful statistical approach to material optimization in energy storage systems [1,2]. RSM has been extensively applied in materials science to efficiently explore design spaces and identify optimal synthesis conditions, reducing experimental burden while maintaining rigor [2]. Recent computational advances have enabled significant progress in battery and supercapacitor research, including predictive modeling of graphite anode capacity fading [3] and automated design for efficient lithium-ion battery material separation and recycling [4].
This study presents an open-source, Python-based computational framework for the automated analysis of RSM experiments, designed to scale to high-dimensional problems. We validate this framework by replicating the optimization of NiCo2S4–graphene hybrids originally reported by Hong et al. [1]. By reconstructing the statistical models and ANOVA tables, performing temporal residual diagnostics, and executing response surface optimization using transparent code, we aim to demonstrate the reliability of automated computational replication and provide a tool for future data-driven material design. The conceptual framework of this research, bridging experimental data with computational tools, is illustrated in Figure 1.
Figure 1.
Conceptual framework of this study, integrating experimental design with Python-based automated statistical analysis to support material optimization and improve reproducibility.
The preliminary concepts of this computational framework were initially introduced in our previous conference abstract [5] and are herein fully expanded with detailed statistical validation, the integration of global optimization routines (Differential Evolution), and the complete Python source code.
2. Materials and Methods
2.1. Experimental Design and Data Acquisition
The dataset utilized in this computational replication was derived from the study by Hong et al. [1], which focused on optimizing the hydrothermal synthesis of NiCo2S4–graphene hybrids. A Central Composite Design (CCD) with five levels was employed. The design matrix consisted of 20 experimental runs, including 8 factorial points, 6 axial points (with ), and 6 center points to estimate pure error.
The independent variables (factors) investigated were as follows:
- —Graphene/NCS mass ratio (%), ranging from 0.6% to 7.4%;
- —Hydrothermal reaction time (h), ranging from 4.6 h to 11.4 h;
- —Sulfur/Nickel (S/Ni) molar ratio, ranging from 3.3 to 6.7.
The response variable (Y) was the specific capacitance (F/g) measured at a current density of 1 A/g.
2.2. Computational Framework and Statistical Modeling
The automated analysis was developed entirely in Python (v3.8+), utilizing the ‘pandas’ and ‘numpy’ libraries for data manipulation, ‘scipy.stats’ for probabilistic calculations, ‘scipy.optimize’ for high-dimensional optimization, and ‘matplotlib’ for visualization. The workflow implemented in the code is detailed in Figure 2.
Figure 2.
Flowchart of the Python-based automated methodology for RSM analysis incorporating advanced optimization.
A second-order polynomial equation (Equation (1)) was fitted to the experimental data using Multiple Linear Regression (MLR) via the Ordinary Least Squares (OLS) method:
where Y is the predicted response; denotes the coded independent variables; is the intercept; , , and are the linear, quadratic, and interaction coefficients, respectively; and is the error.
The coefficients in Equation (1) have fundamental physicochemical interpretations. Linear coefficients () represent the primary effects of individual factors on the response. Interaction coefficients () indicate synergistic or antagonistic effects between two parameters—for example, how sulfur concentration influences the incorporation of graphene in the NiCo2S4 matrix. Quadratic coefficients () describe the curvature of the response space, often reflecting threshold limits or material saturation effects where excessive increases in a variable begin to reduce capacitance.
Model adequacy was assessed through analysis of variance (ANOVA). Significance of regression terms was determined by the F-test and p-values (). Using this framework, we conducted a lack-of-fit test and determined the Durbin–Watson statistic for run-order residual independence. For optimization, the classic grid-search algorithm was combined with the Differential Evolution (DE) algorithm—a metaheuristic for global optimization in continuous spaces—to support scalability for high-dimensional scenarios.
3. Results
3.1. Model Fitting and Statistical Analysis
The experimental results and the complete design matrix are presented in Table 1. The computational framework successfully fitted the quadratic model to the specific capacitance data. The regression yielded a high coefficient of determination () and an adjusted of , indicating that the model explains over 97% of the variability in the synthesis process.
Table 1.
Complete experimental design matrix (CCD) and response (specific capacitance).
The resulting empirical equation in terms of coded factors is
The automated analysis of variance (ANOVA), summarized in Table 2, confirms the statistical significance of the model (F-value , ). The lack-of-fit term was non-significant (), thus validating the adequacy of the quadratic model in terms of representing the experimental data within the studied domain.
Table 2.
ANOVA results generated by the Python framework.
3.2. Variable Contributions and Pareto Analysis
The Pareto chart (Figure 3) illustrates the standardized effects of the variables. The linear term of the graphene/NCS ratio () is the most influential factor, accounting for 57.19% of the total variance, followed by the quadratic effect of time (, 17.29%). Notably, significant interaction effects were observed between G/NCS and S/Ni () and between time and S/Ni (), indicating synergistic mechanisms in the material synthesis.
Figure 3.
Pareto chart of standardized effects showing the significance of linear, quadratic, and interaction terms ().
3.3. Diagnostic and Surface Analysis
A more detailed model diagnosis was performed to supplement standard fitting checks. The residual analysis (Figure 4) confirmed the normality of the error distribution (Shapiro–Wilk ). To assess the independence assumption, a plot of residuals versus run order was automatically generated, and the Durbin–Watson statistic was calculated, yielding a value of 1.8288. This value is close to the ideal value, 2.0, indicating there is no significant temporal autocorrelation and confirming that the experimental trials were independent.
Figure 4.
Residual analysis plots: (left) normal probability plot, and (right) residuals vs. predicted values.
The 3D response surface plots (Figure 5) visualize the interaction effects. The curvature observed in the surfaces associated with and reflects the significant quadratic terms, indicating a distinct optimal region within the experimental domain rather than at the boundaries.
Figure 5.
3D response surface and 2D contour plots showing the interaction between synthesis variables with respect to specific capacitance.
3.4. Optimization and Validation
The computational optimization, executed via the Differential Evolution metaheuristic algorithm constrained to the factorial region , identified the following optimal conditions:
- G/NCS Ratio ()—1.0 (coded) → 6.0%;
- Hydrothermal Time ()—1.0 (coded) → 10.0 h;
- S/Ni Ratio ()—1.0 (coded) → 6.0.
Under these conditions, the model predicts a maximum specific capacitance of 2263.19 F/g.
4. Discussion
The results obtained with our automated Python framework are in agreement with the original study by Hong et al. [1]. The predicted optimal capacitance of 2263.19 F/g deviates from the value reported in the reference article (2317 F/g) by only 2.32%. The implementation of a global optimizer (Differential Evolution) indicates that this method can be scaled efficiently to high-dimensional problems while mitigating the risk of local optima. Table 3 highlights the differences and improvements offered by the proposed methodology in comparison to traditional procedures.
Table 3.
Differences and improvements offered by the Python-based framework in comparison to traditional methods.
The dominance of the G/NCS ratio () highlights the critical role of graphene in enhancing the conductivity and surface area of the composite. The significant interactions ( and ) suggest that the sulfur concentration () modulates how effectively the graphene integrates with the NiCo2S4 matrix.
5. Conclusions
We developed an open-source Python framework for automated Response Surface Methodology analysis. Applied to NiCo2S4–graphene supercapattery optimization, the framework identified optimal synthesis conditions, namely, a G/NCS ratio of 6.0%, a hydrothermal time of 10.0 h, and a S/Ni ratio of 6.0, predicting a specific capacitance of 2263.19 F/g—a 2.32% deviation from the value in the reference study (2317 F/g). Compared to traditional commercial software approaches, the framework offers open-source transparency, global optimization capability via Differential Evolution, and comprehensive diagnostics, including run-order independence testing.
Author Contributions
Conceptualization, T.F.d.O.; methodology, T.F.d.O.; software, T.F.d.O.; validation, T.F.d.O.; formal analysis, T.F.d.O.; writing—original draft preparation, T.F.d.O.; writing—review and editing, T.F.d.O.; supervision, S.M.P.M. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Data Availability Statement
The Python code used in this study is available at https://github.com/thiagoferrobr/rsm (accessed on 7 September 2025).
Conflicts of Interest
The authors declare no conflicts of interest.
Abbreviations
The following abbreviations are used in this manuscript:
| RSM | Response Surface Methodology |
| CCD | Central Composite Design |
| NCS | Nickel–Cobalt Sulfide (NiCo2S4) |
| ANOVA | Analysis of Variance |
| MLR | Multiple Linear Regression |
| OLS | Ordinary Least Squares |
| DE | Differential Evolution |
References
- Hong, Z.-Y.; Chen, L.-C.; Li, Y.-C.M.; Hsu, H.-L.; Huang, C.-M. Response Surface Methodology Optimization in High-Performance Solid-State Supercapattery Cells Using NiCo2S4–Graphene Hybrids. Molecules 2022, 27, 6867. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Pandey, V.K.; Kumar, A.; Singh, R. A Response Surface Methodology Optimization Approach to Architect Low-Cost Activated Carbon-Based Ternary Composite for Supercapacitor Application with Enhanced Electrochemical Performance. Synth. Met. 2025, 311, 117844. [Google Scholar] [CrossRef] [Scilit]
- Qian, X.; Wu, W.; Wang, Y.; Liu, L.; Ye, J.; Fu, L.; Wang, Z.; Chen, Y.; Wang, T.; Wu, Y. Predicting graphite anode capacity fade in lithium-ion batteries using a pseudo-two-dimensional model. J. Energy Storage 2026, 141, 119229. [Google Scholar] [CrossRef] [Scilit]
- Kong, Y.; Yuan, L.; Liao, Y.; Shao, Y.; Hao, S.; Huang, Y. Efficient separation and selective Li recycling of spent LiFePO4 cathode. Energy Mater. 2023, 3, 300053. [Google Scholar] [CrossRef] [Scilit]
- Oliveira, T.F.; Meneghetti, S.M.P. Python-Based Automated Response Surface Methodology: Computational Replication and Validation Framework for Supercapattery Materials Optimization. In Proceedings of the 1st International Online Conference on Designs, Basel, Switzerland, 9–10 February 2026; Available online: https://sciforum.net/paper/view/28829 (accessed on 13 February 2026).
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.




