Forecasting of the epidemiological situation: Case of COVID-19 in Morocco

Since the coronavirus pandemic started, many people have died due to the disease. The epidemic has been challenging to predict, as it progresses and spreads throughout the world. We used Auto-Regressive Integrated Moving Average (ARIMA) models to predict the outbreak of COVID-19 in the upcoming months in Morocco. In this work, we measured the e ﬀ ective reproduction number using the real data and the forecasted data produced by the two commonly used approaches, to reveal how e ﬀ ective the measures taken by the Moroccan government have been in controlling the COVID-19 outbreak. The prediction results for the next few months show a strong evolution in the number of conﬁrmed and death cases in Morocco. We study the spread of COVID-19 in Morocco to see how many cases are discovered, recovered, and dead, and the forecasting of further cases is used as a basic novel method. It is based on time series models. We used coronavirus outbreak data from March 02, 2020, to August 04, 2021. ARIMA (Autoregressive integrated moving average) and Prophet time-series models are used to forecast the development of COVID-19, which is not a novel method. The mean absolute error, root mean square error, and coe ﬃ cient of determination R2 were computed to assess the model’s performance. Our study aims to provide a better understanding of the infectious disease outbreak that a ﬀ ected Morocco. It also provides information on the disease outbreak’s epidemiology. Our study shows that the FBProphet model is more accurate in predicting the prevalence of COVID-19. It can help guide the government’s e ﬀ orts to prevent the virus’ spread.


Introduction
COVID-19 is a new respiratory virus that emerged in China in 2019. It has a high mutation and is easily spreadable. People with compromised immune systems or chronic illnesses such as diabetes or heart disease can develop severe respiratory conditions if they become infected with this virus [1]. In this paper, we are going to forecast the further COVID cases in Morocco. So, before time, we can save the lives of people. The outbreak of COVID-19 was designated a pandemic by the World Health Organization (WHO) on March 11, 2020. Looking into these numbers of confirmed and death cases, we know the extreme danger of this pandemic situation. In Morocco, the COVID-19 pandemic was confirmed start to propagate on 2 March 2020, when the first confirmed COVID-19 case was found in Casablanca. A few weeks later, many activities and shops were closed by the Moroccan authorities to contain the spread of this new virus. Infections can be difficult to contain since individuals may not exhibit symptoms for a long time. This can be achieved through social isolation, and the only way to stop the spread of COVID-19 is by quarantining or isolation of infected individuals. COVID-19's spread can be divided into three stages [ Because of the spread of the coronavirus, which has a global reach, national governments have imposed a lockdown to prevent its infection. As of Dec. 24, 2021, 278,588,451 cases had been confirmed, 249,356,570 cases had been recovered, 5,402,557 fatalities had been recorded, and 23,829,324 active cases had been detected throughout the globe [3] was used to compile the statistical data.

Key Motivation
The key motivation behind the current research work is: to accurately forecast the spread of COVID-19 in Morocco which could help the Govt officials better plan to minimize its impact. The goal of this research is to model and predict the effects of Coronavirus transmission on various public services and resources. Various studies [4][5][6][7][8] have been published on the use of statistical analysis and artificial intelligence to predict the spread of the Covid19 virus and its effects. The findings are based on the limited data that was available during the outbreak. COVID-19 predictions are used to help predict the spread of infectious diseases. They are also used to prepare for and limit the spread of diseases [9].
In this paper, we study the capacities of the ARIMA [10] and FBProphet [11] models for predicting future outcomes. Many prediction models are used to forecast the impact of COVID-19 on Morocco. This paper aims to analyze these models and find out their applicability to predicting the virus impact in the country. COVID-19 trend analysis and model performance are analyzed using various metrics. These include mean absolute error (MAE), root mean square error (RMSE) and coefficient of determination (R2). We produce predicting results for COVID-19 confirmed, recovered, and death cases.

General context
Because of the geographic position of Morocco and its proximity is near to Europe, where the virus is still extensively spreading, the infection spread has been discovered. On March 2, 2020, Morocco became aware of the first Coronavirus case, with 954 199 persons infected with COVID-19, resulting in 937,122 people being cured and 14,823 fatalities, while 8,801,829 cases were ruled out due to negative laboratory testing (According to the Official Portal of the Coronavirus in Morocco www.covidmaroc.ma on 24/12/2021). To control and limit the spread of the pandemic. Morocco has taken the following measures and measures: 1. All air and marine flights to or from countries with epidemic hotspots will be suspended on March 13, 2020. 2. On March 15, 2020, the King ordered the government to quickly create a special fund to deal with the epidemic 3. Morocco declares a health emergency on March 19, 2020; 4. On March 12, 2020, the COVID-19 is given access to field hospitals and private clinics. 5. On April 7, 2020, the mask is made mandatory for the whole country.
Given the economic and societal consequences of the pandemic, statistical analyzes can be used to predict the number of people affected. We used machine learning models such as the Time Series model ARIMA and FBProphet to predict the daily recorded cases (Confirmed, Recovered, and Deaths) of COVID-19 during this study to get an idea of the possible scenarios soon to take the necessary measures and educate people and decisionmakers about the consequences of this epidemic.

Related Works
Works can also be found on the application of SIR (Susceptible Infectious Recovered) models [12], this last study conducted by scientists revealed that the SIR model can predict the epidemic trend based on the diseases spread.
Different diseases, such as SARS, Ebola, pandemic influenza and dengue fever, are usually predicted using time series analyses. A. G. Amiranashvili [13] conducted research using the ARIMA model to project the number of COVID-19 cases in India in the future, and they determined that cases in India would increase exponentially, with cases decreasing relative to expected forecasts. They have also emphasized the importance of social separation and sanitizing to reduce the spread of the human virus. The goal of their research was to assist the government and medical community in preparing for the crisis. They failed to account for the effect of COVID-19 tests on the number of cases where positive results were recorded. 2 A similar study was conducted by Tyagi [14], who estimated the number of COVID-19 cases in India using the ARIMA model. These efforts are directed toward the goal of developing effective methods to reduce the impact of infectious diseases on public health. These include mean absolute error (MAE), root mean square error (RMSE) and coefficient of determination (R2).
According to Dost Khan [15] and T. Latunde [16], they represent the popular autoregressive integrated moving average (ARIMA) will be used to forecast the cumulative number of confirmed, recovered cases, and the number of deaths from COVID-19 for the specific country.
Further, Miksic [17] presents the model that method considers expected recoveries and deaths, and it determines maximally allowed daily growth rates that lead away from exponential increase toward stable and declining numbers.
Modelling and forecasting the total number of cases and deaths due to the pandemic is represented by N. Khan [18] with the use of a polynomial regression model. With data intelligence, the model should be able to assess the probability of pandemic disease.
According to Abonazel [19] used the ARIMA model based on the Box-Jenkins approach was used to predict the confirmed, recovered cases and deaths of COVID-19 in Egypt. Further, he researches suitable statistical prediction models to be meaningful in forecasting and controlling this global pandemic threat, especially after the genetic mutation of the virus in 2021. The results indicated that the estimated ARIMA models have a high ability to predict the number of confirmed cases, recovered COVID-19 cases and death in Egypt.
On the other side, F. O. Awedaa [20] and Awwad [21], used two models that are Autoregressive Integrated Moving Average (ARIMA) model and the Spatial Time-Autoregressive Integrated Moving Average (STARIMA) model the measure the impact of the curfew on the spread of COVID-19 in KSA. He concluded that STARIMA models are more reliable in forecasting future epidemics of COVID-19 than ARIMA models due to the inclusion of spatial information i.e. neighboring effect in the form of the spatial weight matrix. Unlike the univariate ARIMA models, STARIMA models have a smaller number of parameters. For the illustrated dataset, the STARIMA model has only three parameters for the three locations, whereas ARIMA model has numerous parameters, under such cases parameterization may prompt to lower sum of squares of residuals. In conclusion, they studied the trend pattern of the COVID-19 outbreak in Makkah, Jeddah, and Taif in Saudi Arabia. Finally, they found out that the best prediction model for forecasting the trend of daily confirmed cases in Makkah, Jeddah, and Taif is STARIMA.

Method of Data Analysis
A time series model is used to predict future outcomes based on historical data. For our study, we used the ARIMA and Facebook Prophet models. where p is order of autoregression, d is order of differencing, q is order of moving average. The AR(p) model is defined as a linear process given as the following equation.
where z t−1 , z t−2 , . . . , z t−p are the lags (past values); and φ 1 , φ 2 , . . . , φ p are lag coefficients which are estimated by the model, w t is the white noise, and is defined as follows.
where µ is mean of the process. The MA(q) model is defined as the following equation.
where w t , w t−1 , . . . , w t − q error terms of the model for the respective lags i.e. z t−1 , z t−2 , . . . , z t−p ARIMA is able to fit if the data is stationary i.e. data mean and standard deviation is constant. The differencing parameter d is the order of transformation to make dataset stationary. Second order differencing is shown in the following equation.
Finally the equation for the ARIMA(p,d,q) is defined as follows.

Facebook Prophet
Taylor et al. [11] presented the Facebook Prophet (FBProphet), a model that combines many non-linear and linear approaches with time as a regressor. Prophet was developed by Facebook's data science team and released as open-source library. The model assumes that the data's time dependency is not significant, and that training is treated as if it's a curvefitting operation. As a result, irregular observations are permitted in a dataset. The approach has few benefits, including the ability to handle several periods of seasonality, as well as unique and well-known holidays; it provides flexibility by offering two options for trend: 1. a piecewise linear model, 2. a saturating growth model; and the model fits very fast.
The model includes another vacation term as part of the time series, so that a time series can be defined by the following equation.
where T t is trend, S t is seasonality, H t is holiday, and t is error term.

Methods and analyzes
To predict Coronavirus disease (COIVD-19), we are using the Time Series Analysis using Facebook prophet Model and ARIMA, designed for making forecasts for time series datasets and using forecasting tools available in Python. This enables us to observe and predict the spread of the coronavirus pandemic on a daily or weekly basis.
Then we started with reading the whole dataset and cleaning it of missing values and outliers. We then analysis the data into five Python libraries are 'numpy', 'Pandas', 'Matplotlib', 'Datetime', and 'sklearn.metrics'.

Modeling Dataset
The Repository by the Center for Systems Science and Engineering [22] provided the data on which the resulting model was built and tested. From March 02, 2020 to August 04, 2021, this data shows the daily values since the first case of COVID-19 in Morocco. Figure 1 depicts the daily cumulative confirmed, fatalities, and recovered cases from COVID-19 in Morocco during this time period. The total number of confirmed cases in the dataset was 523 620, the number of recovered cases was 510 958, and the number of death cases was 9 207 for Morocco as a whole, as shown in Table 1  our study is based on a well-structured approach to prediction: analysis, cleaning and configuration of data, then prediction. all the steps are mentioned in figure 2. Figure 2 depicts the basic phases involved in the prediction process.
The architecture used to predict and analyze instances of COVID 19 using the ARIMA and FBProphet models is shown in Figure 3. The confirmed, recovered, and dying datasets patients were separated into training (80%) and testing (20%) groups (the remaining 20%).

Performance Measures
The following statistical metrics are used to evaluate the prediction models: • Mean Absolute Error (MAE): where, y predicted value of y y i mean value of y • Root Mean Square Error (RMSE): • R-Squared Score:

Results and discussion
In Python 3.8, we employed the ARIMA and Prophet models from the stats-models and FbProphet open-source packages, respectively. Our testing were performed on a machine with a 2.80 GHz Intel R Core i7 processor, 16 GB of RAM, and an 8GB Intel R HD Graphics 620 GPU. We'll discuss how accurate adopted models are in forecasting confirmed, recovered, and mortality cases in this section.

Forecasting of confirmed cases
We employ ARIMA and FBProphet models to anticipate future instances. ARIMA may be used to create predictions if the data is stationary. The FBProphet is a tool for analyzing real data. The forecasting accuracy statistics for verified Moroccan instances are shown in Table 2. In terms of various sorts of error metrics, such as MAE, RMSE, and R2, the findings clearly show that FBProphet performs considerably better than the ARIMA model. Figure 4 displays both the actual and predicted confirmed cases. It is obvious from the graph that the predicted cumulative confirmed cases are rising more quickly, but the curve still has to be flattened.

Forecasting of recovered cases
We performed an evaluation of the suggested models using data from cured cases in Morocco to predict and assess the cure rate of the disease. We have applied FBProphet directly on actual data to fit the model and generated the forecasting results. The accuracy results of the models for the recovered cases are shown in Table 3. Best results are by FBProphet. The results  Figure 5 also shows actual and anticipated recovered cases, which demonstrates that COVID-19 recovered cases will rise over the next few days.

Forecasting of death cases
Since the Coronavirus has caused many deaths, it's important to study its mortality rate to predict its future cases. This can help plan governments for its spread. We assessed the predicting models for death cases in Morocco in this area. Table 4 indicates the models' accuracy in predicting fatality cases. We can observe that the ARIMA prediction errors are quite high, but the prediction results of FbProphet have a low error factor. According to the findings, FbProphet may be used to predict occurrences in real time and structure services accordingly. Figure 6 also displays the actual and anticipated mortality cases, which demonstrates that the COVID-19 death rate is lower than the virus's propagation.
Aside from predicting, some statistical and mathematical modeling studies have been available since the beginning of the 5 COVID-19 pandemic to anticipate national and worldwide epidemics by varying the degrees of accuracy. The accuracy of predictions is subject to the assumptions that have been made based on the available data. Because of the differences in input value parameters and assumptions, the forecasting results may vary. During new pandemics, such as COVID-19, the quality and availability of information vary as the epidemic progresses, causing uncertainty in early-stage forecasts and improving as the epidemic progresses.

Conclusion
The patterns from the current data reveal that prompt and effective measures taken by Moroccan authorities to contain the pandemic are showing a positive impact when compared with other countries. Based on the obtained data, we predicted the evolution of COVID-19 using the ARIMA and Prophet Models. Although the results generated by these models are quantitatively different, both models have predicted an important increase in confirmed cases and deaths in Morocco in the next few months.
The finding indicates that the transmission of COVID-19 in Morocco will continue to expand in the next few months. Fortunately, both models predict that the situation will not be considered too dramatic and, therefore, may give hope for controlling the disease. Finally, we hope that these results will help the Moroccan government to better control and prevent the outbreak of COVID-19 in the future. The COVID-19 virus has taken hold of the planet and has had an impact on human life all around the world.
As a result, early prediction of the coronavirus spread can aid in the preparation of critical government and public activities. We have demonstrated the prediction of COVID-19 by utilizing a time series data approach based on the currently presented dataset to evaluate the COVID-19 viral outbreak data in this paper. This paper proposed the use of data analysis for predicting the pandemic. It shows that the process of predicting a flu pandemic can be very challenging and time-consuming if the data sources are not accurate. As a result, when using the model to anticipate 52 weeks, this type of limitation is encountered. As an example, an effort may be made to construct a hybrid quality model for improved forecasting by merging the model used in the study with other time series forecasting methods.