Seasonal versus non-seasonal trends in stock market Malaysia

. Stock market prediction is considered a challenging task of financial time series analysis, which is beneficial for investors, stock traders, and future researchers. In Malaysia, many machine learning techniques have been used for stock price prediction such as Autoregressive Integrated Moving Average (ARIMA), Artificial Neural Network (ANN), and Long Short-Term Memory Network (LSTM). This study will use ARIMA and Seasonal ARIMA to present weekly, monthly and quarterly predictions, both with and without seasonal adjustment method. Stock movement prediction techniques are presented using weekly data of six industries in Malaysia such as gloves, property, airlines, banking, oil and gas, and pharmaceuticals from 26th September 2016 until 28th September 2020. The principle objective of this study is to verify seasonal and non-seasonal occurs in the Malaysian stock market and demonstrate the improvement in predictive performance of the stock market


Introduction
A stock market is able to assist the country to increase the overall economy and provide an opportunity for country development as it is a platform where government and business organizations raise capital or funds via long-term investment by individuals. Hence, many researchers start to investigate the patterns of the stock market in order to secure themselves, but the stock market is hard to predict due to it following a random walk. However, many techniques have been introduced in the prediction due to the people now are accelerating technology worldwide.
Seasonal patterns in stock price refer to the tendency of markets to have better or poor performance during certain periods within a year (Watts, 2021). Ahmad Al-smadi, Almsafir, and Binti Husni, (2018) showed that despite the use of information and various narrow growth, the stock markets are still sensitively affected by seasonal anomalies such as calendar anomalies, festival season, and weekend effects. In Malaysia, the main festivals entertained by citizens include Hari Raya Aidilfitri, Chinese New Year, Deepavali, and Christmas. Other than that, festival-like Thaipusam and Wesak Day are also entertained by Malaysian. Hence, several research on using the ARIMA model in stock price predicting and ARIMA (1,1,2) was identified as the best-fitted model in the banking stock market. Eventually, researchers applied the first differencing in the model which implies that seasonal occur and Seasonal Auto-Regressive Integrated Moving Average (SARIMA) can have different performances on it. On the other hand, Bashir, Ilyas, and Furrukh (2011) found out that the stock market in the Pakistan banking sector does not have a relationship between the historical prices and future prices for their eleven high volume trading banks listed on Karachi Stock Exchange.
Choy, Hoo, and Khor, (2021) studied on 47 stocks from the property industry in Malaysia with five algorithms namely the Auto-Regression Integrated Moving Average (ARIMA), Seasonal Auto-Regression Integrated Moving Average (SARIMA), Long Short-Term Memory (LSTM), Holt Winter, and Prophet. They concluded that ARIMA and LSTM perform better in this industry compared to other methods with an average RMSE of 0.0167 and 0.0295 respectively.
Besides that, Meher et al. (2021) investigated the stock price of the Indian pharmaceutical industry consisting of seasonal trends by using ARIMA for a three-month prediction. Hence, the SARIMA model is recommended to be used in this situation. Muhammad Nadhirin et al.
(2021) investigated the glove-manufacturing company, Hartalega Holdings Berhad's stock price and saw the data fitted better in ARIMA (2,1,0) with the lowest AIC values.
In the Oil and Gas industry, Bakar, Rosbi, and Uzaki (2018) executed a study that analyzed the performance of the ARIMA approach for Oil and Gas sector stock prices in Malaysia. Specifically, ARIMA (1,1,1) contributed to the 3.752% of error between forecast prices and actual prices. Meanwhile, they discovered that seasonal ARIMA model provided better forecasting results compared to linear methods in a short-term prediction in this industry. Moreover, Abu Bakar and Rosbi (2017) concluded that ARIMA (5,1,5) provided the highest accuracy in the share price performance for Gas Malaysia Berhad. They used Box-Jenkins statistical method and ARIMA in the data selection process. The oil and gas sector in Malaysia consists of trends and seasonal since the researchers apply differencing to the model.

Research Classification
The research methodology can be classified into three categories which are exploratory research, descriptive and causal studies. In this study, exploratory research will be used to investigate which industry stock price in the past correlates with the current price.

Sampling and Data Collection
Historical weekly data set will be collected from the online source Yahoo Finance, and divided into two parts. The first four years' stock price data is used for the training data set which is from 26th September 2016 until 28th September 2020. This investigation has a total of 261 observations for each company. The reason why the selected data range from September to October is due to this study beginning in September, thus the latest information will be acquired for prediction. Meanwhile, the remaining one-year data set from 5th October 2020 until 20th September 2021 will be used to test the performance of the model generated by the training data set. Stock price from six industries in Malaysia will be studied, namely gloves, property, airlines, banking, oil and gas, and pharmaceuticals in order to investigate the seasonal and non-seasonal trends in those industries' stock price in Malaysia.

Forecasting Procedures
The programming language R will be used to examine and verify the hypothesis. Firstly, we have to ensure that the data is stationary before generating a model. Next, the decomposition process will be used to separate the historical stock price into seasonal, trend as well as cycle components and use them to build a more accurate model. After generating a model, accuracy testing will be used to measure the forecasting error and difference between forecast and actual demand such as Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), Mean Percentage Error (MPE), and to calculate the Akaike information criterion (AIC) value as well. Next, we plot the graph by using the model generated and put the testing data to investigate the patterns between them. Lastly, we obtain the one-step prediction sum of square error (SSE) on the test data. The process can be written as follows:

Model Specification
For future forecasting, two equations would be generated in this study to investigate the seasonal and non-seasonal trends in stock markets Malaysia, namely the Autoregressive Integrated Moving Average (ARIMA) Model and Seasonal Autoregressive Integrated Moving Average (SARIMA) model.

Accuracy Criteria
This section compare the performance of the models generated by the time series algorithms by comparing the Akaike Information Criterion (AIC) and forecasting error.

One-step Prediction
Normally, training data will be used to build a model and afterwards the test data will be put into the model to evaluate the performance of the model. This method is usually done with different prediction horizons to do the comparison of test data. For example, in this investigation, the last year's closing price will be used for test data and to estimate the predicting model on training data which is the first four years' closing price. Then the prediction errors will be n-steps ahead and the prediction line sometimes is linear (straight line) or curve. However, it will not follow the actual value because it is depending on the values of N times ago. One-step prediction will depend on the previous step; thus it commonly generates a prediction that is close to the actual data. Also, an increase in forecasthorizon will affect the forecast variance increase.

Statistic of Fit
Due to the previous issue mentioned in one-step prediction, it required obtaining a one-step prediction error on the test data. After coming out with a model, we have to evaluate the model it have predicted in the past versus the actual data. One-step prediction error is defined by , and the sum of square one-step prediction error will be calculated to check the model. The Sum of Square Error (SSE), generated with the one-step predicted error, can be written as: SSE is the sum of squared difference between the predicted value and observed value. For this one-step prediction error, training data is still used for evaluating the parameters, the difference being that the predicting value will use all of the data previous to each observation including training and test data to compute the prediction on test data.

Pre-processing and setup
In this stage, two methods will be used in the first stage which are the without deseasonalized method (1) and deseasonalized method (2). Next, auto.arima function will be applied to the data to estimate the appropriate model and it will come out with the ARIMA and SARIMA model with different periods including weekly, monthly, and quarterly in order to increase the accuracy of prediction. The following table will show the result of ARIMA and SARIMA in two methods for different periods.

Preliminary Checking
A preliminary checking analysis of the predicting strategies can be accomplished through R studio with the auto.arima function. In the gloves industry, the majority of the gloves companies will be more suitable with the non-seasonal adjustment method on stock price prediction except Hartalega company. It is because the forecasting error and AIC value given by the seasonal adjustment method are lower than the non-seasonal adjustment method. The difference between AIC and BIC also has to take into consideration. It is because a big different means that consist of strong evidence for one model over the other.

Gloves Industry
Therefore, the non-seasonal adjustment method and ARIMA model will be recommended to use in gloves sector stock price prediction. ARIMA model will be chosen because it provides a lower AIC and lower prediction. Also, the plot was generated to compare the actual and predicted values in the same way. However, SARIMA model will be suitable for Aventa stock because it provides the lowest AIC value in Adventa company while the ARIMA model built in the other three companies gives a good estimation and lower prediction error.
Overall, weekly estimation performs better compared to monthly and weekly, it might be due to weekly data having high predicting power and fitting better with the assumption of market efficiency compared to monthly and quarterly data. The non-seasonal adjustment method for all companies in the property sector generates ARIMA (0,0,0) in time horizon weekly. ARIMA (0,0,0) does not imply that is not an appropriate model. For the company Eco World Malaysia, both methods generate ARIMA (0,0,0) for weekly prediction with zero mean is white noise, so it implies that the errors are uncorrelated across the time. This model is only holding a constant and the prediction line will be a straight line.

Property Industry
From the above table, monthly prediction performs better than a weekly and quarterly prediction, except for IOI Property because the data given show that this company fits better in quarterly prediction. Besides, these four glove companies in Malaysia perform better in ARIMA model instead of SARIMA model and the most selected model is ARIMA (1,0,0). This model is equivalent to AR (1) which implies that past data is able to predict the future values, but it is not used the errors from past data to forecast.
Overall, the majority of them will be appropriate using without deseasonalized method for the stock price prediction and ARIMA model which is ARIMA (1,0,0) is fitted well in these four property companies. It is because this model provides the lowest AIC value and error between the actual value and predicted value is smaller compared to the second method. For Malaysia Airport stock price, the first method ARIMA (1,0,1) of weekly prediction will be fitted better than other models due to it providing the lowest AIC with 15.86 compared with the second method ARIMA (1,0,0) of monthly prediction with AIC 274.46. The lower AIC value the better fit the model. ARIMA (1,0,1) is the combination of Autoregressive Model AR (1) and Moving Average MA (1) which means that this model uses the past forecast and the errors from the past forecast to predict the future values for this stock price.

Airlines Industry
Moreover, Air Asia stock price is fitted better in the deseasonalized method with ARIMA (2,0,0) instead of the first method with ARIMA (0,0,5). Both models generate lower AIC values and lower forecast error compared to other models, but ARIMA (0,0,5) will be better predicted due to the range of prediction values being closer to the actual values in the quarterly forecast. Overall, Airline's stock in Malaysia is more fitted well in ARIMA compared to the SARIMA as well. For the Banking industry stock price market, Ambank, and CIMB will be more prefer the non-seasonal adjustment method because it provides lower AIC value and forecasting error values. Also, Ambank is fitted better in quarterly prediction instead of monthly and weekly prediction. It might be short periods is more useful for this company due to uncertainties occurring in the stock market. While CIMB is different from the Ambank because it is more prefers weekly prediction and without deseasonalized compared to removing the seasonal component. It is because the data of CIMB can use non-adjusted values to predict the future.

Banking Industry
On the other hand, Maybank and Allianze are more preferred deseasonalized methods. It can be explained by these two companies consisting of seasonal components that might affect the closing price prediction. However, Maybank looks to fit well in weekly prediction while Allianze is more likely to monthly prediction. For Maybank weekly prediction it generates SARIMA (0,0,5) (1,0,0) [52] which implied that this data consists of high seasonality with fifty-two lags, but Allianze is more fitted well in ARIMA model.
Overall, in this industry both methods are acceptable, and three out of four companies perform better in ARIMA instead of SARIMA to predict the stock price for a banking company in Malaysia. For the oil and gas industry, seasonal adjustment prediction method will be recommended due to three out of four companies in this industry generate the model with the lowest AIC and lower predicting errors. As the result shown above, they performed well in the weekly prediction instead of monthly and quarterly. It might be due to weekly predictions being more informative than monthly and quarterly. Also, these companies might have a short period of replenishment cycles and sell items with short lead times.

Oil and Gas Industry
For Petron, it fits better in ARIMA by using the method without deseasonalized data and the model generated is ARIMA (2,0,2) instead of SARIMA (0,0,5) (1,0,0) [52]. SARIMA model gives the higher AIC value which is 294.66 while ARIMA gives a 194.44 AIC value. So, the lower AIC value the better-fitted model. However, the weekly prediction of Hibiscus and Petronas company generates the same model which is ARIMA (1,0,0). It implied that the future value can be predicted by using the past data. Overall, weekly prediction is more fitted well in this oil and gas industry since the monthly and quarterly performed with high AIC and predicting errors. For the pharmaceutical industry, seasonal adjustment is only suitable for one company which is Plabs. While the other three companies will be more prefer the non-seasonal adjustment technique and the model generated mostly are ARIMA model. As the result shown in the table above, weekly prediction performed better than monthly and quarterly except for Sunzen.

Pharmaceuticals Industry
Besides, Kotra company predicting future values by using without seasonal adjustment method that generates ARIMA (1,0,0) for weekly, monthly, and quarterly periods. For Plabs and Goldis, both also perform better in weekly prediction. The difference is Plabs is fitted well in SARIMA using seasonal adjustment method, while Goldis fitted better in ARIMA using non-seasonal adjustment method. Goldis and Kotra are fitted better in ARIMA (1,0,0). However, Sunzen is ARIMA (2,0,0) and Plabs is SARIMA (1,0,1) (1,0,0) [52]. Overall, this industry is suggested to use non-seasonal adjustment since this method provides the model with the lowest AIC value and the error between the actual value and observed value is small.

Comparison Times Series Plot of ARIMA and SARIMA Models
In this comparison time series plot will use the time horizon of 52 weeks to predict the values of the stock price from 2020 September until 2021 September by using the method of without deseasonalized and deseasonalized data. After "auto.arima" chooses the best model with lower AIC and forecasting error for the data, it requires to obtain the residuals of the model. The following diagram will show the residuals of the model and whether the model is able to capture all of the information provided by the actual data.

Times Series Plot
Example of Property industry -MahSing Stock (8583) ARIMA models The above diagram shows the residuals after fitting an auto.arima model and it used actual data of MahSing stock (8583) from Yahoo.com without deseasonalized. It seems that the model left information in the residuals. From the first diagram, it shows that values do not fluctuate around a constant mean and variance, so it implies the time series is non-stationary. Also, the Autocorrelation Function (ACF) plot shows that very slowly decreasing and consists of a typical pattern of trend component and seasonal component as well. Since the trend component will result in a time-varying mean and the seasonality will affect the time-varying variance, researchers have to try to remove them and get a different result and compare which is better fitted. This ACF plot does not follow cut off and it has more than five significant spikes, so the relationship between the residuals is strong. Partial Autocorrelation Function (PACF) plot shows that it does not has any significant spikes in the plot which means there are significant autocorrelations between subsequent lags. This implies the residuals obtained from the ARIMA model are white noise and no other significant patterns are remaining in the time series. Hence, the model suggests ARIMA (0,0,0). SARIMA Model   Fig. 3. Time Series Decomposition. Figure 3 shows a decreasing trend and returns a smoothed pattern of seasonal periodicity in the stock. Due to the residuals of Mah Sing actual data consist of seasonal components, so the decomposition has to apply to the data in order to remove seasonal components. This process is able to improve the accuracy of prediction and reduce the error of prediction in a stock. After deseasonalizing the actual data, Autocorrelation Function (ACF) plot of Seasonal ARIMA model is less autocorrelated than ARIMA model but occurs irregular variation in the residual plots between 2019 and 2020. The ACF plot for SARIMA looks decreasing slowly and it still consists of seasonal and trend components. For this situation suggest having differencing to further remove the trend and seasonal components to increase the accuracy of prediction.
However, Partial Autocorrelation Function (PACF) plot of SARIMA model with deseasonalized data indicates that large spikes at the first five lag suggest a non-seasonal MA (5) model, and a significant spike at lag-8 suggests a seasonal AR (1) model. Consequently, SARIMA (0,0,5) (1,0,0) [52] suggests being used to predict the next year's future values of Mah Sing weekly stock price. Fig. 5. Without Deseasonalized Method (ARIMA (0,0,0)). Histogram above shows the residuals of SARIMA (0,0,5) (1,0,0) [52] seem better to follow a normal distribution than ARIMA (0,0,0). The ARIMA (0,0,0) residuals histogram shows that has few bins with a higher concentration of cases than other bins which distorted the normal distribution. Therefore, SARIMA model is fitted better than ARIMA model in this weekly prediction for Mah Sing stock price in Malaysia.

One-Step Prediction
Example of Property industry -Hartalega Stock (5168) Fig. 7. Coding for the process of conducting a one-step prediction.
The code above shows the process of conducting the one-step prediction on test data. First, a company stock closing price is split into two parts which are training data "ytraining" and test data "ytest". Researchers apply an ARIMA model to the training data which is the first four-year closing price. Next, apply the same model to test data and generate a forecasting plot. Table 7. Comparison between n-step prediction and one-step prediction when deseasonalized method was not used for weekly prediction. Table 8. Comparison between n-step prediction and one-step prediction when deseasonalized method was used for weekly prediction. Table 9. Comparison between n-step prediction and one-step prediction when deseasonalized method was not used for monthly prediction. Table 10. Comparison between n-step prediction and one-step prediction when deseasonalized method was used for monthly prediction.  Table 11. Comparison between n-step prediction and one-step prediction when deseasonalized method was not used for quarterly prediction. Table 12. Comparison between n-step prediction and one-step prediction when deseasonalized method was used for quarterly prediction.
To further investigate the sum of square one-step prediction, a researcher has to estimate the one-prediction as well. Overall, the result from the above diagrams shows one-step prediction predicted line seem is closer to the actual value line as compared to the n-step prediction. However, monthly, and quarterly n-step prediction looks to move in the same direction except for weekly prediction in this stock price. Hence, one-step prediction is performed better than n-step prediction in Hartalega stock.

Sum of Squared Prediction Errors
In this statistical analysis, we obtain one-step prediction errors on the test data to get a more accurate error. As the forecast horizon increase, the predicting variance also increases as well. The following table is the predicting accuracy statistics measure for each company that has been collected in this investigation: When models are compared using the Sum of Squared Prediction Errors (SSE), all models must have a smaller SSE value. The smaller the SSE value the higher accuracy of a fitted model. Also, the size of values will affect the SSE value as well due to the larger data value, so SSE will become higher. For Gloves, Property, Oil and Gas, and Pharmaceuticals industries, there is a majority of their companies consists of seasonal component that fitted well in the ARIMA and Seasonal ARIMA due to their SSE value the smallest by using deseasonalized method compared to other methods. On the other hand, Banking industry obtained the smaller SSE values by using the method without removing the seasonal components from actual data. While there has one industry to be classified as both method is acceptable which is Airlines industry because Malaysia Airlines tends to remove seasonal components method, but Air Asia prefer to use the actual data to predict in order to get the smallest SSE value.

Stock
Overall, there are 30 out of 66 prediction models have a lower SSE value by using actual data to predict the future. By deseasonalized method, it consists of 36 models that capture the lower SSE value by comparing to the without removing seasonal component. Therefore, for the stock market in Malaysia deseasonalized method is fitted better than using the original data to do prediction.

Summary of Findings
Various types of share price prediction models have been generated by other researchers to predict the future movement of stock prices in the Malaysian stock market. This paper presents seasonal adjustment and non-seasonal adjustment with time series algorithms among ARIMA and SARIMA models in the Malaysian stock market, and demonstrated the potential of these two models to predict stock prices satisfactorily on a short-term basis.
From the preliminary checking, we obtain three types of time horizon prediction in this study. Quarterly predictions for a majority of the company seem to move in the same direction but the accuracy analysis shows that the Gloves, Banking, Oil and Gas, and, Pharmaceuticals industries are fitted better in the weekly prediction. On the other hand, Property industry shows ARIMA (1,0,0) is performed better in all of the companies in this industry with monthly predictions. From the seasonal viewpoint, Gloves, Property, Oil and Gas, and, Pharmaceuticals industries are fitted better in the model from seasonal adjustment. While the Banking industry performed better in non-seasonal adjustment method. Moreover, only the Airlines industry has shown both methods are acceptable.
Lastly, by statistical analysis, we obtain the best SSE value that proved that the seasonal adjustment which is deseasonalized method is fitted better than the one without seasonal adjustment. This may imply that the stock market in Malaysia has seasonal variation.
The contribution of this study is help investors to understand the future behavior of stock prices in Malaysian companies before making any investment decisions. In addition, the findings from this research will help investors to find the best time to do investment.

Limitations and Recommendations
The limitation of this study was mainly that the monthly and quarterly predictions are more time-consuming than weekly predictions due to the need to convert weekly data into monthly and quarterly for predicting. Moreover, this process might lead to the misalignment between week, month and quarter. It is recommended that future works could obtain different time horizon data such as monthly and quarterly data to improve the accuracy of prediction. After decomposing seasonal and trend components in the original data, there will be irregularities in the original data. Hence, future works could take other alternative ways to overcome this issue. It might be helpful for the investor to make a profitable investment decision in the stock market in Malaysia.