Complexity-Invariant Distance-Based Clustering for Sharia Stocks Forecasting
DOI:
https://doi.org/10.24252/msa.v14i2.71030Keywords:
Complexity-invariant distance, Hierarchical clustering, Average linkage, ARIMA, ForecastingAbstract
The rapid growth of sharia stock investment in Indonesia has increased the need for effective methods to analyze the movement patterns of multiple stocks. This study aims to cluster sharia stocks using Complexity-Invariant Distance (CID) combined with Average Linkage Hierarchical Clustering and to use the resulting clusters for cluster-level stock return forecasting using the Autoregressive Integrated Moving Average (ARIMA) model. Daily return data of 14 sharia stocks consistently listed in the IDX Sharia Growth Index from June 3, 2024, to May 29, 2026, were analyzed. The optimal cluster configurations were evaluated using the Silhouette Index and Dunn Index, while forecasting performance was assessed using Root Mean Square Error (RMSE). The Silhouette Index identifies the two-cluster configuration as having the highest value, while the Dunn Index reaches its highest value for the five- and six-cluster configurations. The two-cluster configuration was selected primarily because it achieved the highest Silhouette Index, while the five-cluster configuration was retained for a descriptive forecasting comparison.. The two-cluster configuration produces ARIMA(2,0,0) and ARIMA(2,0,2), with an average testing RMSE of 0.01587381, while the five-cluster configuration produces ARIMA(0,0,2), ARIMA(2,0,2), ARIMA(0,0,0), ARIMA(1,0,1), and ARIMA(0,0,1), with an average testing RMSE of 0.02740923. The two-cluster configuration yielded a lower average testing RMSE in this descriptive comparison. However, these errors are conditional on cluster membership determined from the full sample, and the configurations define different cluster-average forecasting targets. The findings demonstrate that CID-based clustering can serve as a preprocessing approach for cluster-level sharia stock return forecasting, where the forecasts represent the return dynamics of the identified clusters rather than individual stocks.
References
B. Basrowi, P. Utami, E. Anggraeni, and M. Nasor, “Analisis SWOT pasar modal syariah sebagai sumber pembiayaan di Indonesia,” El-Jizya: Jurnal Ekonomi Islam, vol. 8, no. 2, pp. 210-227, 2020, doi: 10.24090/ej.v8i2.3957
D. Wu, X. Wang, and S. Wu, “Construction of stock portfolios based on k-means clustering of continuous trend features,” Knowl. Based. Syst., vol. 252, Sep. 2022, doi: 10.1016/j.knosys.2022.109358.
J. Chen et al., “From Similarity to Superiority: Channel Clustering for Time Series Forecasting.” Advances in Neural Information Processing Systems, vol. 37, pp. 130635-130663, Dec. 2024, doi: 10.52202/079017-4152.
P. Esling and C. Agon, “Time-series data mining,” ACM Comput. Surv., vol. 45, no. 1, Nov. 2012, doi: 10.1145/2379776.2379788.
A. Shifaz, C. Pelletier, F. Petitjean, and G. I. Webb, “TS-CHIEF: A Scalable and Accurate Forest Algorithm for Time Series Classification,” Feb. 2020, doi: 10.1007/s10618-020-00679-8.
Linda Sakinah, Rahma Anisa, and I Made Sumertajaya, “Energy Sector Stock Price Forecasting with Time Series Clustering Approach,” Indonesian Journal of Statistics and Its Applications, vol. 8, no. 2, pp. 132–142, Dec. 2024, doi: 10.29244/ijsa.v8i2p132-142.
F. Amanah, F. Roshafara, N. Nurhanifah, N. Dwi, and T. Ramdani, “Time Series Clustering and Mean-Variance Portfolio Modeling on IDX Sharia Growth Stocks”, doi: 10.29313/statistika.v26i1.9723.
H. A. Dau et al., “The UCR time series archive,” IEEE/CAA Journal of Automatica Sinica, vol. 6, no. 6, pp. 1293–1305, Nov. 2019, doi: 10.1109/JAS.2019.1911747.
G. E. A. P. A. Batista, X. Wang, and E. J. Keogh, “A Complexity-Invariant Distance Measure for Time Series.” in Proceedings of the 2011 SIAM international conference on data mining, pp. 699-710. Society for Industrial and Applied Mathematics, April 2011, doi: https://doi.org/10.1137/1.9781611972818.60.
L. Fathiyaturrahmi, Andriano, H. Almiatus Soleha, D. Dwi Prastyo, “Perbandingan Complexity Invariant Distance (CID) dan Dynamic Time Warping (DTW) dalam Analisis Klaster Deret Waktu pada Nilai Tukar Petani di Indonesia,” Jurnal Teknologi Informasi dan Ilmu Komputer, vol. 12, no. 4, pp. 771-778, 2025, doi: https://doi.org/10.25126/jtiik.124.
P. Montero and J. A. Vilar, “TSclust: An R Package for Time Series Clustering,” Journal of Statistical Software, vol. 62, pp. 1-43, 2015, doi: https://doi.org/10.18637/jss.v062.i01.
R. J. Hyndman and G. Athanasopoulos, “Forecasting: Principles and Practice.”, Melbourne, Australia: Otexts, 2014 doi: https://otexts.org/fpp2/.
H. Wasserbacher and M. Spindler, “Machine learning for financial forecasting, planning and analysis: recent developments and pitfalls,” Digit. Finance, vol. 4, no. 1, pp. 63–88, Mar. 2022, doi: 10.1007/s42521-021-00046-2.
V. I. Kontopoulou, A. D. Panagopoulos, I. Kakkos, and G. K. Matsopoulos, “A Review of ARIMA vs. Machine Learning Approaches for Time Series Forecasting in Data Driven Networks,” Aug. 01, 2023, Multidisciplinary Digital Publishing Institute (MDPI). doi: 10.3390/fi15080255.
C. Zhang, N. N. A. Sjarif, and R. Ibrahim, “Deep learning models for price forecasting of financial time series: A review of recent advancements: 2020–2022,” Jan. 01, 2024, John Wiley and Sons Inc. doi: 10.1002/widm.1519.
A. Arévalo, D. León, and G. Hernandez, “Portfolio Selection Based on Hierarchical Clustering and Inverse-Variance Weighting,” in Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), Springer Verlag, 2019, pp. 315–325. doi: 10.1007/978-3-030-22744-9_25.
P. J. Rousseeuw, “Silhouettes: a graphical aid to the interpretation and validation of cluster analysis,” Journal of computational and applied mathematics, vol. 20, pp.53-65, 1987, doi: https://doi.org/10.1016/0377-0427(87)90125-7.
O. Arbelaitz, I. Gurrutxaga, J. Muguerza, J. M. Pérez, and I. Perona, “An extensive comparative study of cluster validity indices,” Pattern Recognit., vol. 46, no. 1, pp. 243–256, Jan. 2013, doi: 10.1016/j.patcog.2012.07.021.
G. E. Box, G. M. Jenkins, G. C. Reinsel, and G. M. Ljung, “Time series analysis: forecasting and control,” in John Wiley & Sons, New Jersey, USA, 2008, doi: https://doi.org/10.1057/9781137291264_6.
R. S. Tsay, “Analysis of Financial Time Series Second Edition,” in John Wiley & Sons, New Jersey, USA, 2005, ISBN: 978-0-471-74618-8.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 Fauziah Roshafara, Fitri Amanah, Nafa Nurhanifah, Novianda Dwi Tanti Ramdani

This work is licensed under a Creative Commons Attribution 4.0 International License.
Copyright Notice
Jurnal MSA (Matematika dan Statistika serta Aplikasinya)
Authors who publish in Jurnal MSA agree to the following copyright and licensing terms.
1. Copyright Ownership
Authors retain copyright in their scholarly articles unless copyright is lawfully held by another authorized rights holder.
Publication in Jurnal MSA does not require an exclusive transfer or assignment of copyright ownership to the journal or its publisher.
2. Non-Exclusive Publishing Rights
Authors or authorized copyright holders grant Jurnal MSA non-exclusive rights of first journal publication, dissemination, indexing, and digital preservation.
These rights allow the journal to publish, reproduce, distribute, archive, and preserve the accepted scholarly article without transferring copyright ownership.
3. Publication License
Jurnal MSA adopts and applies the Creative Commons Attribution 4.0 International License (CC BY 4.0) as the standard license for scholarly articles published under its current publication terms.
Authors or authorized rights holders authorize publication of their articles under CC BY 4.0.
This license permits sharing, reproduction, redistribution, adaptation, and reuse, including commercial reuse, subject to the license terms and attribution requirements.
Official License:
https://creativecommons.org/licenses/by/4.0/
4. Non-Commercial Publishing Model
Jurnal MSA operates as a non-commercial scholarly publisher dedicated to education, scientific research, and scholarly communication.
The journal's non-commercial status does not restrict commercial reuse of articles licensed under CC BY 4.0.
5. Authors' Rights and Self-Archiving
Authors retain their applicable rights to reuse, share, and disseminate their scholarly works.
Authors may immediately deposit and distribute the published version of their CC BY 4.0-licensed articles through institutional repositories, disciplinary repositories, and academic websites without an embargo imposed by the journal.
Such distribution remains subject to the applicable license and third-party rights.
6. Author Consent and Third-Party Rights
By agreeing to publication, the corresponding author confirms that:
-
All listed authors have approved the manuscript and the publication arrangements.
-
The authors or authorized rights holders possess the legal authority necessary to authorize publication and licensing.
-
Jurnal MSA is granted the necessary non-exclusive publishing rights.
-
Publication of the article under CC BY 4.0 is authorized.
-
Required permissions for third-party materials have been obtained, and any licensing exclusions have been clearly identified.
7. Previously Published Articles
Articles published before the implementation of the current licensing policy remain governed by their validly applicable copyright and licensing arrangements.
The adoption of CC BY 4.0 does not automatically change licenses previously granted under different terms.
Copyright and License Statement
Copyright © [Year], The Author(s).
The author(s) retain copyright and grant Jurnal MSA non-exclusive rights of first publication, dissemination, indexing, and preservation.
This article is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).