Complexity-Invariant Distance-Based Clustering for Sharia Stocks Forecasting

Authors

  • Fauziah Roshafara Universitas Islam Bandung
  • Fitri Amanah Universitas Islam Bandung
  • Nafa Nurhanifah Universitas Islam Bandung
  • Novianda Dwi Tanti Ramdani Universitas Islam Bandung

DOI:

https://doi.org/10.24252/msa.v14i2.71030

Keywords:

Complexity-invariant distance, Hierarchical clustering, Average linkage, ARIMA, Forecasting

Abstract

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

2026-11-14

How to Cite

[1]
F. Roshafara, F. Amanah, N. Nurhanifah, and N. D. T. Ramdani, “Complexity-Invariant Distance-Based Clustering for Sharia Stocks Forecasting”, MSA, vol. 14, no. 2, pp. 269–280, Nov. 2026.