A Hidden Markov Model Approach to Daily Stock Return Dynamics of PT Kimia Farma Tbk

Rahmawati Masithoh

School of Data Science, Mathematics, and Informatics, IPB University, Bogor 16680, Indonesia.

Berlian Setiawaty *

School of Data Science, Mathematics, and Informatics, IPB University, Bogor 16680, Indonesia.

Retno Budiarti

School of Data Science, Mathematics, and Informatics, IPB University, Bogor 16680, Indonesia.

*Author to whom correspondence should be addressed.


Abstract

PT Kimia Farma Tbk is one of the enterprises owned by the government of Indonesia that is engaged in the pharmaceutical sector. The daily stock return price of PT Kimia Farma Tbk (KAEF) from 2012 to 2024 is constantly changing. This change can be influenced by one of the conditions of the stock market that cannot be observed directly. In addition, this change moves up and down drastically, so stock price predictions cannot use just one model. In this study, a hidden Markov model (HMM) was chosen for modeling this data because it allowed changes from one model to another. Initially, a 3-state discrete HMM was used to model the data. The simulation showed that the model could not accurately follow the movement of the data. To overcome this, the discrete HMM was modified into a continuous HMM by replacing the parameters of the probability mass function with the probability density function of the continuous distribution for each hidden state. So, the daily stock return price of KAEF was modeled by a 3-state continuous HMM, and the data in each state follows a logistic distribution. To measure the accuracy of using the continuous HMM, we used the mean absolute error (MAE). The MAE value obtained from the training data simulation using discrete HMM is 0.03188 or 7.97% of the original data range, while the MAE from the training data simulation using continuous HMM is 0.029818 or 7.45% of the original data range. Furthermore, the MAE value of the test data simulation is 0.0338527 or 8.46% of the original data range. The results show that the HMM performs very well in modeling the dynamics of the KAEF data.

Keywords: Stock return, hidden Markov model, mean absolute error, continuous hidden Markov model


How to Cite

Masithoh, Rahmawati, Berlian Setiawaty, and Retno Budiarti. 2025. “A Hidden Markov Model Approach to Daily Stock Return Dynamics of PT Kimia Farma Tbk”. Journal of Advances in Mathematics and Computer Science 40 (8):1-13. https://doi.org/10.9734/jamcs/2025/v40i82029.

Downloads

Download data is not yet available.