Journal of Islamic Monetary Economics and Finance, Vol. 9, No. 3 (2023), pp. 511 - 532 p-ISSN: 2460-6146, e-ISSN: 2460-6618 RETAKAFUL CONTRIBUTIONS MODEL USING MACHINE LEARNING TECHNIQUES Kouach Yassine1, EL Attar Abderrahim2 and EL Hachloufi Mostafa3 1 University Hassan II of Casablanca, Morocco, yassine.kouach-etu@etu.univh2c.ma 2 University Hassan II of Casablanca, Morocco, abderrahimelattar@univh2c.ma 3 University Hassan II of Casablanca, Morocco, mostafaelhachloufi@univh2c.ma ABSTRACT Driven by the need to manage risk by the newly created Moroccan Takaful operators, the Moroccan Insurance and Social Welfare Control Authority has authorized the Central Reinsurance Company to create a ReTakaful window for the purpose of reinsuring Takaful operations. Nevertheless, the main challenge is determining the appropriate ReTakaful model for the Moroccan Islamic insurance sector by ensuring compliance with Shariah. With this in mind, this article aims to determine the optimal ReTakaful contributions model for the Moroccan Takaful industry via Machine Learning algorithms. We select the best model by comparing the performance of each algorithm. The achieved results of this study demonstrate the potential of using Machine Learning algorithms to compute ReTakaful contributions that are more suitable for Takaful operators and more optimal for the ReTakaful operator. Keywords: ReTakaful, Takaful, Reinsurance, Treaty, Machine learning, Probability of ruin. JEL classification: G22; C51; C52; C53. Article history: Received : January 22, 2023 Revised : July 28, 2023 Accepted : August 31, 2023 Available online : September 29, 2023 https://doi.org/10.21098/jimf.v9i3.1681 512 Retakaful Contributions Model Using Machine Learning Techniques I. INTRODUCTION Re-Takaful, which is an alternative Islamic reinsurance to a conventional reinsurance, is a process whereby a Re-Takaful company agrees to bear all or part of the loss of primary Takaful companies (Billah, 2019a) if the risks insured are above the normal underwriting or claim (Arbouna, 2000). Indeed, ReTakaful helps Takaful operators to manage the risk of having insufficient financial resources when multiple unwanted damages occur at the same time. For this reason, ReTakaful aims to protect the Takaful operators from the threat of insolvency and to consolidate the financial stability of the Takaful operators (Arbouna, 2000; Billah, 2019a). Re-Takaful principal is similar to conventional reinsurance principal in the way that the ReTakaful operator (insurer) accepts to insure a part of the defined risk in a specified category, if it exceeds prudent underwriting limits (Hassan & Mollah, 2018), in the Takaful policy transferred by the Takaful operator (ceding company or the cedent). In return, the Takaful operator transfers also a part of the premium as contributions depending on the part of the risk covered by the ReTakaful operator. However, there are some differences between conventional reinsurance and ReTakaful operations. The central difference is that ReTakaful transactions should take into consideration the Shariah principles in the same way as Takaful does (Arbouna, 2000). It should avoid Riba (interest), Gharar (uncertainty), and maysir (gambling) (Billah, 2019a; IFSB-18, 2016). In addition, The Re-Takaful contracts must be based on profit and loss sharing. If there is a profit, the Takaful operators will get a share of the profit based on a predetermined ratio (Billah, 2019a; Budd, 2016). Moreover, the ReTakaful operators’ income is limited to the fee (wakalah) and/ or profit sharing (mudarabah) (Archer et al., 2011). In addition, in the event of a deficit in the participants’ fund, the ReTakaful company will make a free loan as in Takaful insurance (Budd, 2016). Thus, ReTakaful is generally divided into two categories, family ReTakaful and general ReTakaful (IFSB-18, 2016). A ReTakaful operator, or ‘‘Takaful of Takaful’’ (Archer et al., 2011), has the same role as the Takaful operator, that is, reducing the risks of loss faced by the insured (Ali & Markom, 2021). With that in mind, the newly created Takaful operators in Morocco are invited to cover their risks and to place a certain part of their risk with another operator. Though, they should not obtain coverage from conventional reinsurance operators as their practice is contrary to Shariah principles (Billah et al., 2019). This explains the need for Islamic reinsurance operators. In this view and in order to ensure the proper progress of Islamic insurance in Morocco, Insurance and Social Welfare Control Authority (ACAPS) has authorized SCR, the Central Reinsurance Company, to open a reinsurance window (ReTakaful window (Budd, 2016)) for Takaful operators based on the principles of Shariah, in this case, ReTakaful. The challenge that remains is to determine the appropriate ReTakaful model that fits the Islamic insurance industry in Morocco by ensuring compliance with Shariah. According to the literature review, we find that most works related to ReTakaful or Takaful are theoretical in nature. There are limited works that deal with the practical and actuarial aspects of Takaful and ReTakaful. Journal of Islamic Monetary Economics and Finance, Vol. 9, Number 3, 2023 513 In regards to the Takaful, Khouaja (2015) propose generalized linear models in pricing the contribution of a Takaful automobile insurance. Derkaoui & Halourou Souley (2016) design in their thesis an Islamic borrower insurance product adapted to a Mourabaha model taking into account the Moroccan regulations on Takaful. In the recent work related to Takaful pricing, Kouach et al. (2022) seek in their article to price Takaful automobile insurance using Machine Learning algorithms and by interpreting the Takaful insurance model introduced in Law 59.13 and in compliance with Shariah. Within the context of the ReTakaful, Ahmad et al. (2015) attempt to examine the Shariah issues related to ReTakaful and whether the risks in ReTakaful are shared by Takaful operators and ReTakaful funds or simply transferred to ReTakaful operators. Alshammari & Altwijry (2023) introduce new perspectives to review the ReTakaful industry’s legitimacy by exploring the views of six Shariah scholars on whether the fatwā on the permissibly of using conventional reinsurance based on the precept of ḍarūrah is still applicable (Alshammari & Altwijry, 2023). However, with the exception of the work by El Attar & El Hachloufi (2022), these works are limited to the theoretical aspect of ReTakaful through qualitative research without developing a pricing method adopted for ReTakaful products. El Attar & El Hachloufi (2022) design an actuarial model of Takaful insurance contributions associated with Mourabaha real-estate contracts that meets Shariah standards by introducing ReTakaful as a tool of security and technical support. In addition, they seek to find the optimal structure of ReTakaful, which maximizes the technical surplus under certain constraints. El Attar & El Hachloufi (2022) develop an optimization program that allows not only to calculate the individual Takaful contributions but also to determine the appropriate form of ReTakaful. However, their work deals only with the family ReTakaful. In this view, this article aims to propose pricing ReTakaful contributions based on Machine Learning in the context of general ReTakaful especially ReTakaful of an automobile Takaful product. We model ReTakaful treaty using Decision tree, Random Forests, and Neural Networks. As well, we seek to choose the best model to price ReTakaful contributions by taking into consideration two ReTakaful methods, namely the “quota share” treaty and the “excess of loss” treaty. At the same time, we propose a model of ReTakaful in conformity with Moroccan regulations and in compliance with Shariah. In addition, the purpose of this article is to contribute to the improvement of the actuarial ReTakaful literature and to encourage practitioners to integrate Machine Learning algorithms into the Islamic finance industry, especifically the Takaful and ReTakaful industry. The rest of the paper is structured as follows. The next section introduces the theoretical framework of ReTakaful by highlighting ReTakaful methods and ReTakaful models. In section III, we proceed to present the methodology, Machine Learning algorithms adopted, and the criteria for an optimal ReTakaful notably the probability of ruin minimization. The results of the application of our proposed model for the ReTakaful of the damage and collision guarantee of the motor insurance branch are presented section IV. And finally, section V presents the conclusions and recommendations. 514 Retakaful Contributions Model Using Machine Learning Techniques II. THEORETICAL FRAMEWORK OF RETAKAFUL 2.1. ReTakaful Methods The methods used by ReTakaful operators are the same as conventional Reinsurance methods (Figure 1). There are two main categories: Treaty ReTakaful and Facultative ReTakaful. The scope of this article is limited to the Treaty ReTakaful. Figure 1. ReTakaful MEthods ⁻⁻ Facultative ReTakaful: Facultative ReTakaful allows the reinsurance of risks individually based on each risk (case by case) (Gunardi et al., 2013). Indeed, the ReTakaful operator has the ability to accept or reject any risk transferred by the Takaful operator. In other words, the ReTakaful operator considers each risk separately and it retains the ‘faculty’ to accept or reject each risk offered (Billah, 2019b). ⁻⁻ Treaty ReTakaful: Takaful operator can transfer during a specified period the risks wanted to be reinsured but the ReTakaful Operator, contrary to the Facultative ReTakaful, agrees to accept all risks in the scope of the treaty with the Takaful operator (Ali & Markom, 2021; Hassan & Mollah, 2018). For Treaty ReTakaful contract, the losses (Xi)i∊[1,…,N] are shared between the Takaful operator and the ReTakaful operator as follows: (1) Where (XiT)i∊[1,…,N] the risk portion retained by Takaful operator, (XiR)i∊[1,…,N] the risk portion retained by ReTakaful operator, and N represents the number of the claims. Treaty ReTakaful includes two methods (Figure 1), in occurrence, the proportional method and the non-proportional method. According to the proportional method, the ReTakaful can be expressed on a “quota-share” or “surplus-share” agreement. By contrast, the non-proportional method can be expressed on an “excess of loss” or “stop loss” agreement. Journal of Islamic Monetary Economics and Finance, Vol. 9, Number 3, 2023 515 2.1.1. Proportional Method: When the ReTakaful operator opts for a proportional method, the ReTakaful operator undertakes to reinsure part or a percentage of the risk transferred by the Takaful operator. In return, the latter transfers the same part of the premiums to the ReTakaful operator. ⁻⁻ Quota share treaty: A quota share treaty is a pro-rata ReTakaful contract, whereby the Takaful operator and ReTakaful operator accept to share premiums and losses of each and every risk within a defined category of business (Billah, 2019b) according to a fixed percentage (Essadic Amine & Mouhssine Yassine, 2018). In other words, each disaster, regardless of its weight, is shared in the same proportion between Takaful and ReTakaful operators (Arbouna, 2000). In the quota share treaty, the ReTakaful operator limits its liability to a fixed proportion of the risk α called the proportionality factor or the cession rate. In this case, the proportions retained by the ceding company and the ReTakaful operator are expressed as follows: and (2) ⁻⁻ Surplus treaty: The cession rate in the case of surplus treaty is not fixed. Indeed, it varies according to the maximum amount of claim and the full retention which corresponds to a fixed amount retained by the ceding. (3) (4) Where (mi > 0)i∊[1,…,N] represents the maximum amount of claim and (ai > 0)i∊[1,…,N] represents the fixed amount retained by the ceding. 2.1.2. Non-proportional Method: Non-proportional reinsurance only responds if the loss suffered by the insurer exceeds a certain amount, which is called the “retention” or “priority” (Hasan, 2011). In fact, non-proportional ReTakaful allows the Takaful operator to limit its liability to an amount L>0 called retention limit. ⁻⁻ Excess of loss treaty: This treaty is a form of ReTakaful under which recoveries are available when a given loss exceeds the retention limit as defined in the agreement (Billah, 2019b). The retention limit is applied to each claim such as the Takaful operator portion and the ReTakaful operator portion are expressed as follow: (5) 516 Retakaful Contributions Model Using Machine Learning Techniques (6) ⁻⁻ Stop loss Treaty: Unlike the excess of loss treaty, the retention limit is not applied to each claim. Indeed, the retention limit is applied to the total claims. (7) (8) Stop loss protects against catastrophic losses or large shock claims by protecting reserves after a certain threshold is reached, as well as protecting the integrity of the organization and its cash flow (Essadic Amine & Mouhssine Yassine, 2018). 2.2. ReTakaful models ReTakaful operators have the option to operate using organizational structures that are similar to those used in the Takaful insurance industry, such as Mudharabah, Wakala, and hybrid models. 2.2.1. Mudharabah Model Mudharabah ReTakaful model is operating in the same way as the Mudharabah Takaful model. The ReTakaful operator acts as an entrepreneur (Mudharib) who undertakes the ReTakaful business activities. Meanwhile, the participants, comprised of different Takaful operators acting as capital providers (Rab al mal) who give ReTakaful contributions to the ReTakaful Risk Fund for the ReTakaful operator. These contributions are made based on tabarru (Htay et al., 2014). In accordance with the Mudharabah principle, both the ReTakaful operator and Takaful operator will agree to share any profits and losses at a predetermined rate (Alkhan & Hassan, 2020; Bensed & Fasly, 2020). Figure 2. Mudharabah ReTakaful Model Journal of Islamic Monetary Economics and Finance, Vol. 9, Number 3, 2023 517 2.2.2. Wakala Model Under Wakala model, the ReTakaful operator acts as an agent (Wakeel) who manages the ReTakaful Risk Fund. On the other hand, the Takaful operators act as principals (Muwakil) (Htay et al., 2014). In return for the service rendered by the ReTakaful Operator as Wakeel, Wakeel receives an agreed management fee called the Wakala fee, which is usually a percentage of the contributions paid by the participants (IFSB-18, 2016). However, the profits and losses belong entirely to the participants (Htay et al., 2014). Figure 3. Wakala ReTakaful Model 2.2.3. Hybrid Model The hybrid or mixed model combines the best sides of Mudharabah and Wakala operating models (Mohamed Yusuf, 2011). In ReTakaful’s hybrid model, the operator fulfills both the roles of Wakeel and Mudharib. As a Wakeel, the ReTakaful operator manages the ReTakaful Risk Fund, while as a Mudharib, the operator manages the investment activities. The ReTakaful operator receives a Wakala fee and a pre-determined percentage share of the investment proceeds as remuneration (IFSB-18, 2016). 518 Retakaful Contributions Model Using Machine Learning Techniques Figure 4. Hybrid ReTakaful Model III. METHODOLOGY 3.1. Context of the Study Since 2014, the monetary authorities in Morocco have undertaken an ambitious strategy to promote Islamic finance in the country. This strategy involves establishing an Islamic financial system that operates in parallel with the existing conventional system, with the aim of catering to the financial needs of individuals who hold religious convictions. In 2018, a significant milestone was achieved when the central bank granted consent to participating banks to offer Islamic banking products. This has allowed them to introduce Islamic banking products and the issuance of Sukuk into the market, which is considered a crucial step in expanding the scope of the financial landscape. Despite these advancements, the Islamic financial ecosystem in Morocco is still evolving. The emergence of an Islamic insurance market alongside the conventional insurance sector has evolved from being a mere option to a pressing necessity to meet market demand and ensure financial inclusivity. The demand for Islamic insurance products becomes even more evident, especially in situations such as real estate transactions. Participating banks offer Murabaha (real estate) products but without an insurance policy to cover the death of borrowers. This absence not only hampers the expansion of real estate loans but also introduces complications after the borrower’s death. The need for a comprehensive solution is apparent for both financial institutions and borrowers. Recognizing these gaps, Morocco introduced Takaful Insurance in 2016 through Law 59.13 by amending and supplementing the existing Insurance Code outlined in Law 17.99. However, it was not until the end of 2021 that the Ministry of Finance’s decree pertaining to Takaful insurance contracts came into effect. This substantial progress was accentuated by the subsequent actions of the Insurance and Social Welfare Supervisory Authority (ACAPS), which published Journal of Islamic Monetary Economics and Finance, Vol. 9, Number 3, 2023 519 the application circular for the law and collaborated closely with the esteemed Superior Council of the Ulemas (Religious Scholars) to grant approval to three operators, thus inaugurating Takaful insurance operations in the country. However, the transition to a complete Islamic insurance environment has highlighted the need to institute a risk management strategy that aligns with Shariah principles. In effect, these newly created Takaful operators in Morocco need to cover their risks and to place a certain part of their risks with another operator. However, these operations must be in accordance with Shariah principles and hence the need for Islamic reinsurance operators. In view of this fact, ACAPS authorized SCR, Central Reinsurance Company, to open a reinsurance window or ReTakaful window. This innovative mechanism enables Takaful operators to access reinsurance services based on the Shariah principles. Nevertheless, ReTakaful in Morocco does not yet have the fundamental theoretical and practical framework for the pricing of ReTakaful contributions. Accordingly, the challenge that remains is to determine a suitable framework for pricing ReTakaful contributions in Morocco. Furthermore, selecting an appropriate ReTakaful model that adapts to the Moroccan Islamic insurance sector while ensuring compliance with Shariah principles is key to the development of the ReTakaful framework. Aiming to explore and provide innovative solutions, this paper proposes the use of Machine Learning algorithms in computing ReTakaful contributions to improve accuracy and efficiency in determining risk-sharing arrangements in accordance with Shariah principles. 3.2. Research Approach Our research objective is to develop an appropriate Moroccan ReTakaful model for pricing ReTakaful contributions aligned with Shariah principles through machine learning algorithms for accurate and efficient risk-sharing arrangements. For this reason, we adopt the following steps in our research approach. Firstly, our focus lies on the interpretation of the ReTakaful model as proposed by Law 59.13 amending and supplementing law 17.99 on the insurance code. This involves a detailed examination of its nuances to better understand the ReTakaful structure allowed in Morocco. Afterward, we proceed to the calculation of ReTakaful contributions using two distinct ReTakaful methods, namely, a method of the proportional category, specifically the quota share treaty, and a method of the non-proportional category, specifically the excess of loss treaty. In order to model the contributions, we exploit the power of Machine Learning algorithms, namely Decision trees, Random Forests, and Neural Networks. In the next step, we embark on the task of selecting the suitable Machine Learning algorithm for each ReTakaful treaty method. This selection is motivated by an evaluation of the performance measures based on minimizing the root mean square error. Finally, we engage in a particular assessment to determine the most appropriate ReTakaful treaty method. This evaluation is guided by an essential criterion, namely the minimization of the probability of ruin. 520 Retakaful Contributions Model Using Machine Learning Techniques By following this proposed research approach based on legal interpretation, advanced modeling, and decision-making, we aim to contribute to the development of a ReTakaful framework that not only meets regulatory and Shariah requirements but also optimizes risk management practices. 3.3. Proposed Model of ReTakaful Law 59.13 defines Takaful reinsurance as being “a reinsurance operation carried out in accordance with the assent of the Superior Council of Ouléma having as its objects the coverage of the risks provided for in the Takaful reinsurance treaty by a Takaful reinsurance fund managed, in return for remuneration of management, by an insurance and reinsurance company approved to carry out Takaful reinsurance operations”. In addition, surplus Takaful Reinsurance Funds shall be distributed among Takaful Operators in accordance with the Takaful Reinsurance Fund Management Regulations, after deduction of Takaful advances, if they exist. No part of the technical and financial surpluses may be granted to the Takaful reinsurance company managing the Fund. The distribution of technical and financial surpluses can only take place after the constitution of provisions and reserves. According to Law 59.13, we can conclude that the model proposed by the cited law is similar to the Wakala ReTakaful model. Hence, Moroccan ReTakaful operators will be paid by an agreed management fee as a Wakala fee. Consequently, the contribution paid by the Takaful operators will be calculated as follows: (9) Wakala fee represents the operating expenses and the margin Wakala (the profit from the Wakala). The ReTakaful contribution can be expressed as follows: (10) We are interested in calculating the ReTakaful pure contribution, which is the proportion of the expected cost of claims retained by the ReTakaful operator. Under the quota share treaty, the ReTakaful pure contribution E[SR] is calculated as follows: (11) Where α is the cession rate. Under the excess of loss treaty, the ReTakaful pure contribution E[SR] is expressed as follows: (12) Journal of Islamic Monetary Economics and Finance, Vol. 9, Number 3, 2023 521 Where L is the retention limit. We assume that the random variables X1R,…,XNR are independently and identically distributed, and the costs of claims X1R,…,XNR and the number of claims N are independent. In this case, the average total charge of claims is equal to the average number multiplied by the average cost: (13) For the purpose of ReTakaful pure contribution calculation, we compute the frequency of claims which is the same of Takaful pure contribution E[N], and the average cost of claims E[XR] retained by the ReTakaful operator. We will apply Machine Learning algorithms in order to determine the frequency and the average cost of claims. 3.4. Machine Learning Algorithms In this study, we seek to exploit the potential of non-parametric methods, in this case, Machine Learning algorithms. Indeed, statistical learning methods allow actuaries to go beyond the limits of traditional methods (Kouach et al., 2022). Traditional methods such as linear regressions or generalized linear models often do not provide satisfactory results due to assumptions of linearity, assumptions of independence of explanatory variables, assumptions about data distribution, difficulties in processing large datasets, and manual feature engineering (Bellina, 2014; Fotia Santsa, 2018; Fox, 2022). These limitations justify the use of Machine Learning algorithms as alternative solutions. In fact, machine learning algorithms can adopt nonlinear relationships between variables, capture complex interactions, handle high-dimensional data, and perform automatic feature selection (Gotlieb et al., 2022; Xie et al., 2023). In addition, Machine Learning algorithms make no assumptions about data distribution (Sheetal et al., 2023). Statistical learning theory assumes just one hypothesis, in occurrence, the data to predict (Bekkaye & Zari, 2023). Machine Learning usually provides systems with the ability to learn and enhance from experience automatically without being specifically programmed (Saint-Cirgue, 2019; Sarker, 2021). Machine Learning includes four learning algorithms categories depending on the type of data, namely supervised learning, unsupervised learning, semisupervised learning, and reinforcement learning. The category of Machine Learning algorithms used in this article is supervised learning. This choice is explained by the type of data available, which is labeled. Indeed, our model explains the response variable “ReTakaful charge” or “claim frequency” according to the explanatory variables. In order to determine the frequency of claims and the average cost of claims retained by ReTakaful operator, we apply supervised learning algorithms appropriate for regression, particularly, Decision tree, Random Forest, and Neural Networks. 522 Retakaful Contributions Model Using Machine Learning Techniques 3.4.1. Decision tree: The Decision tree algorithm is chosen for its ability to handle both categorical and numerical data (Saed & Jaharadak, 2022), which makes this algorithm suitable for predictive modeling. The advantage of the Decision tree lies in its simplicity of visual interpretation to explain the results of the model (Nanfack et al., 2022). Additionally, the Decision tree has the ability to capture complex nonlinear relationships within the data (McNamara et al., 2022). The Decision tree algorithm consists of splitting the tree from node to leaf containing the outputs based on criteria such as “Gini impurity” or “entropy” for information gain. 3.4.2. Random Forest: Random Forest is an ensemble supervised learning technique. This method uses “parallel assembling” which fits several Decision trees in parallel, on different dataset sub-samples, and uses majority voting or averages for the outcome or final result (Sarker, 2021). The Random Forest algorithm is used to solve overfitting and variance problems often associated with individual Decision trees (Correa-Garcia et al., 2022; Santhosh et al., 2022). By combining multiple Decision trees through ensemble learning, Random Forest improves the generalization and accuracy of predictions (Correa-Garcia et al., 2022; McNamara et al., 2022). 3.4.3. Neural Networks: The computational architecture of Artificial Neural Networks combines three processing layers, namely the Input layer, the Hidden layer, and the Output layer. The input layer contains the explanatory variables that will be transmitted to the hidden layer thanks to the combination function. In order to introduce the nonlinearity, an activation function will be applied to the linear combination output. Neural Networks are used for their capacity to capture nonlinear relationships within data (Paturi et al., 2022). Their hierarchical structure allows feature extraction (Taye, 2023). The neural Networks are particularly useful for tasks involving high-dimensional data (Gotlieb et al., 2022). After we have chosen the Machine Learning algorithms, we divide the database into two sub-databases, namely the training database to train each algorithm and the testing database to evaluate the performance of each algorithm. In order to optimize the parameters, we use cross-validation instead of having a third base i.e. database validation. 3.4.4. Performance Measure: In order to choose the best algorithm, we use the mean square error as a measure of performance particularly suited to regression problems where the goal is to predict continuous numerical values. Journal of Islamic Monetary Economics and Finance, Vol. 9, Number 3, 2023 523 (14) Where yi the actual value of the observation i, ŷi the predicted value of the observation i, and n the total number of observations. The mean square error is easy to interpret. A value of zero indicates perfect predictions, while higher values indicate ​​ non-negligible prediction errors. 3.5. Optimization Program In this work, we consider a ReTakaful treaty pricing is optimal for the ReTakaful operator when this treaty avoids the risk of having a total amount of contributions lower than the total amount of claims charges. In other words, it avoids the ruin or insolvency of the ReTakaful operator. For this purpose, we choose to use the criterion of minimization of the probability of ruin to evaluate the two treaty models of ReTakaful namely the “quota share” and “excess of losses”. First, the probability of ruin is defined as the probability that the operator’s reserve will become negative due to the excess of the total burden of claims over the contributions collected. The reserve of an operator with an initial capital k and who receives net premiums Pnet with a view to damaging claims X1,X2,…., is written as follows: (15) (16) With (17) We assume that the portion of risk transferred to the ReTakaful operator is priced according to a pricing method based on the principle of mathematical expectation. Hence, the net premium is expressed as follows: (18) (19) Where ηR is the safety loading. So (20) (21) (22) (23) 524 Retakaful Contributions Model Using Machine Learning Techniques And (24) Therefore, the ruin probability function is: (25) (26) (27) Adding E(Rt) and dividing the left and right sides of the inequality by we find: , (28) (29) (30) (31) Note that the left side of the inequality converges to a normal law N(0,1). Using the central limit theorem and a normal approximation, the probability of ruin is given by: (32) Where: FZ is the distribution function of the random variable which follows the normal law N(0,1). By definition represents the factor of safety. Once the ReTakaful model has been determined within the context of Law 59.13, presenting the Machine Learning algorithms used in this study and considering the probability of ruin as a criterion for optimal ReTakaful pricing, we proceed to formulate our optimization program in order to select the optimal ReTakaful model. The objective of our proposed program is to choose the optimal ReTakaful treaty pricing that minimizes the objective function ψ(R). Our optimization program then consists in finding the minimum probability of ruin ψ(R) among the different ReTakaful methods and models adopted in this study. Journal of Islamic Monetary Economics and Finance, Vol. 9, Number 3, 2023 525 In this perspective, we have the following optimization program: (33) Where ηR is the safety loading. The optimization program is written in the case of the quota share treaty, as follows: (34) Where ηR is the safety loading and α is the cession rate. Our objective then for this program is to find the optimal ηR and α parameters that minimize the probability of ruin in the case of the quota share treaty. Under the excess of loss treaty, the optimization program is formulated as follows: (35) Where ηR is the safety loading and L is the retention limit. The objective then for this program consists in finding the optimal parameter ηR that minimizes the probability of ruin in the case of the excess of loss treaty. 526 Retakaful Contributions Model Using Machine Learning Techniques Figure 5. Optimization Process • • • • • Our optimization process (Figure 5) takes place as follows: Choose the best algorithm to model the frequency of claims and the average cost of claims of ReTakaful under both methods, quota share and excess of losses, based on the minimum mean squared error MSE. Compute the ReTakaful contributions under both methods, quota share and excess of losses. Assess the objective function ψ(R) under defined constraints. Select the minimum probability of ruin for both the quota share and excess of losses scenarios. Select the optimal ReTakaful method that has the lowest probability of ruin. 3.6. Data and Materials In order to choose the best ReTakaful treaty and to determine the portion to be transferred to the ReTakaful operator, we use two open-source databases. One database contains policy information, and the other database contains the history of claims charges. We are interested in the pricing of the portion of ReTakaful operator for the damage and collision guarantee of the motor insurance branch. To compute the portion of the risk accepted by the ReTakaful operator, we need to determine the frequency and average claim of ReTakaful. The database intended for frequency modeling contains 50,000 observations. For the modeling of the average claim of ReTakaful, we use a database that contains 1735 observations. For the ReTakaful “quota share” treaty, we will test the Machine Learning algorithms according to different levels of cession rate α={5%,10%,….,95%}. For the Journal of Islamic Monetary Economics and Finance, Vol. 9, Number 3, 2023 527 ReTakaful “excess of losses” treaty, we retain L=5000 as retention limit. In addition, different safety loading levels ηR={5%,10%,….,100%}, are used to determine the net premium. In our study, to calculate the probability of ruin or the reserve, we set the initial capital to zero since the ReTakaful operator only manages the fund and in case of insufficiency it lends the Takaful operators a Qard Hassan. In addition, the horizon for calculating the probability of ruin is one year. For ReTakaful fees, in general, the management fees can be between 10% and 20%. We retain 20% in our case. Since the ReTakaful operator works in the same economic context as the conventional reinsurer, we retain the average ratio between the premiums and the operating expenses of conventional operators. According to the annual report of ACAPS for the year 2021, the average operating expense ratio is equal to 28%. Calculations are performed using Python. IV. RESULTS AND ANALYSIS The results illustrated in table 1, that outline the mean squared error on the test dataset regarding the application of the Machine Learning algorithms to the quota share ReTakaful method, show important outputs. Indeed, according to the mean squared error, the Neural Network algorithm demonstrates an exceptional ability to minimize prediction errors. The Neural Network algorithm achieves a considerably low mean squared error of 0.00688669, a value that is almost zero. This result significantly outperforms the error metrics associated with the other algorithms. The Decision tree has the highest value of prediction error with 5398.90 followed by Random Forest with 608.1508. For this reason, we choose the Neural Network algorithm to model the average cost claims of ReTakaful under the quota shares ReTakaful method with the specified cession rate of 10%. Table 1. Mean Squared Error of Machine Learning Algorithms Under Quota Share Retakaful Method for the Average Claims Cost of ReTakaful Algorithm Neural Network Random Forest Decision tree Cession rate Mean squared error / test data 0.1 0.05 0.05 0.00688669 608.1508 5398.90 Regarding the application of the Machine Learning algorithms to the excess of losses ReTakaful method, the overall outcomes are unsatisfactory. Notably, the Random Forest is the algorithm that minimizes the mean squared error well among the applied algorithms. The Random Forest algorithm has the ability to produce a particularly low mean squared error of 3.17E + 06, that makes it possible to estimate the average cost of ReTakaful under the excess of losses. In contrast, the Neural Network algorithm is the worst algorithm that does not significantly minimize the mean squared error with MSE equal to 3.37E+06. 528 Retakaful Contributions Model Using Machine Learning Techniques In light of this finding, we opt for Random Forest algorithm to model the average cost claims in the context of the excess of losses ReTakaful method, using a retention limit of 5000. Table 2. Mean Squared Error of Machine Learning Algorithms Under Excess of Losses Retakaful Method for the Average Claims Cost of ReTakaful Algorithm Decision tree Neural Network Random Forest Mean squared error / test data 3.23E+06 3.37E+06 3.17E+06 We model the number of claims for both methods at once because the frequency of claims is the same for both treaty types. As shown in Table 3, the results highlight that among the applied algorithms, the Random Forest is the model that performs well. The Random Forest algorithm achieves a notably low mean squared error of 0.036280 at the test database. However, it is notable that the Neural Network algorithm does not present the same level of performance in terms of error minimization, followed by the Decision tree algorithm with 0.036298 and 0.036333 mean squared error values respectively. Random Forest algorithm is selected to model the frequency of claims in ReTakaful operations considering its performance in minimizing mean squared error. Table 3. Mean Squared Error of Machine Learning Algorithms for the Frequency Claims of ReTakaful Algorithm Decision tree Neural Network Random Forest Mean squared error / test data 0.036333 0.036298 0.036280 Journal of Islamic Monetary Economics and Finance, Vol. 9, Number 3, 2023 529 Figure 6. Probability of Ruin under Quota Share and Excess of Loss ReTakaful Treaty in Function the Security Loading After we have chosen the best algorithms to model the frequency of claims and the average cost of claims of ReTakaful under both methods, quota share and excess of losses, we compute the probability of ruin of both ReTakaful models. This calculation is performed on different safety loading levels, as illustrated in Figure 6. On one hand, we find that the probability of ruin is a decreasing function of the safety loading. On the other hand, the probability of ruin is minimum in the case of the ReTakaful quota share method when the safety loading is above 40%. In this case, the probability of ruin is less than 5%. On the other hand, the probability of ruin using the excess of loss method is less than 5% when the security load is above 15%. In other words, there is a high probability that the ReTakaful operator will be insolvent under the quota share method if the ReTakaful operator does not increase the security loading. However, the probability of granting a Quard Hassan to Takaful operators is lower with the excess of loss method. According to this application, we recommend pricing the ReTakaful contributions under the excess of loss method by utilizing the Random Forest algorithm for modeling both the average cost of claims and the frequency of claims. V. CONCLUSION AND RECOMMENDATION Moroccan Insurance and Social Welfare Control Authority (ACAPS) authorized SCR, Central Reinsurance Company, to open a ReTakaful window based on the principles of Shariah in order to cover the risks transferred by Takaful operators. However, the challenge that remains is to determine the appropriate ReTakaful model for the Moroccan Islamic insurance sector. Unfortunately, the works examined in the literature review that deal with the practical and actuarial aspects of Takaful and ReTakaful, are rare. In this context, this article seeks to price ReTakaful contributions based on Machine Learning in the context of general 530 Retakaful Contributions Model Using Machine Learning Techniques ReTakaful especially ReTakaful of an automobile Takaful product. At the same time, this work proposes a model of ReTakaful in conformity with Moroccan regulations and in compliance with Shariah. We model the ReTakaful contributions using Decision tree, Random Forests, and Neural Networks under two ReTakaful methods, namely the “quota share” treaty and the “excess of loss” treaty. In order to choose the best Machine Learning algorithm, we used the mean squared error. The selection of the best ReTakaful treaty is based on the probability of ruin minimization criteria. The results of this work demonstrate the advantage to price the ReTakaful contributions under the excess of loss method that minimizes well the probability of ruin. In addition, we suggest using Machine Learning algorithms, especially, the Random Forest algorithm to model the average cost of claims and the Random Forest algorithm to model the frequency of claims. Through this work, we try to enrich the literature of ReTakaful from an empirical angle. However, future empirical research should consider other methods of ReTakaful and other prime principles that are beyond the scope of this work and worth investigating. REFERENCES Ahmad, A. U. F., Mahbob, I. B., & Ayub, M. (2015). Sharing and transferring risks in retakāful and conventional reinsurance: A critical analysis. Journal of King Abdulaziz University, Islamic Economics, 28(2), 117–154. Ali, N. A., & Markom, R. (2021). Shariah compliance on retakaful in Malaysia. Diponegoro Law Review, 6(1), 1–16. Alkhan, A. M., & Hassan, M. K. (2020). How do takaful operators choose which model to adopt? A case study from the Kingdom of Bahrain. Journal of Islamic Accounting and Business Research, 11(9), 1677–1688. Alshammari, A., & Altwijry, O. (2023). Reform of retakaful industry: A quest. Islamic Studies, 62(2), 255-274. Arbouna, B. (2000). The operation of retakaful (Islamic reinsurance) protection. Arab Law Quarterly, 15(4), 335–362. Archer, S., Karim, R. A. A., & Nienhaus, V. (2011). Takaful Islamic insurance: Concepts and regulatory issues. Clementi Loop, Singapore: John Wiley & Sons. Bekkaye, C., & Zari, T. (2023). The use of machine learning in non-life insurance: Literature review. International Journal of Accounting, Finance, Auditing, Management and Economics, 4(2–1), 307-319. Bellina, R. (2014). Méthodes d’apprentissage appliquées à la tarification non-vie [Mémoire]. Bensed, N., & Fasly, H. (2020). L’assurance Islamique “takaful”: Etat des lieux au Maroc. Revue Française d’Economie et de Gestion, 1(5), 13–30. Billah, M. M. (2019a). Re-takaful products. In M. M. Billah (Ed.), Islamic insurance products: Exploring takaful principles, instruments and structures (pp. 407–415). Springer International Publishing. https://doi.org/10.1007/978-3-030-176815_35 Billah, M. M. (2019b). Re-takaful products in a nutshell. In M. M. Billah (Ed.), Islamic insurance products: Exploring takaful principles, instruments and structures Journal of Islamic Monetary Economics and Finance, Vol. 9, Number 3, 2023 531 (pp. 29–45). Springer International Publishing. https://doi.org/10.1007/978-3030-17681-5_2 Billah, M. M., Ghlamallah, E., & Alexakis, C. (2019). Encyclopedia of Islamic insurance, takaful and retakaful. Cheltenham, UK: Edward Elgar Publishing. Budd, E. (2016). Les particularités du Takaful (assurance selon l’islam) [Master’s thesis]. University of Panthéon-ASSAS – PARIS II. Correa-Garcia, S., Constant, P., & Yergeau, E. (2022). The forecasting power of the microbiome. Trends in Microbiology, 31(5), 444-452. Derkaoui, T., & Halourou Souley, M. (2016). Conception d’un produit Takaful décès emprunteur dans le contexte marocain [Master’s thesis]. INSEA, University Mohammed V. El Attar, A., & El Hachloufi, M. (2022). Actuarial model for takaful contributions via optimal retakaful. Journal of Islamic Accounting and Business Research, 13(5), 778–790. Essadic Amine, & Mouhssine Yassine. (2018). Comparative study between the proportional approach and the non-proportional approach in retakaful. Вестник Белгородского Университета Кооперации, Экономики И Права, 4(71), 202-220. Fotia Santsa, R. P. (2018). Méthodes d’apprentissage statistique appliquées à la tarification non-vie: Tarification Automobile [Mémoire de Master en Actuariat,FST]. UNIVERSITE DES MONTAGNES. Fox, J. (2022). Review of Linear Models, Generalized Linear Models, and Linear MixedEffects Models, pp. 1-13. Gotlieb, N., Azhie, A., Sharma, D., Spann, A., Suo, N.-J., Tran, J., Orchanian-Cheff, A., Wang, B., Goldenberg, A., Chassé, M., Cardinal, H., Cohen, J. P., Lodi, A., Dieude, M., & Bhat, M. (2022). The promise of machine learning applications in solid organ transplantation. Npj Digital Medicine, 5(1), 89-101. Gunardi, S., Deuraseh, N., Tahir, H. M., & Ahmad, S. (2013). Retakaful from syariah perspective: A comparative study. Chinese Business Review, 12(9), 616–624. Hasan, A. (2011). Shariah issues in the operation of retakaful and reinsurance: A preliminary exploration from Shariah perspective. IIUM Law Journal, 19(2), 149-178. Hassan, A., & Mollah, S. (2018). Operational mechanism of takaful and re-takaful. In A. Hassan & S. Mollah (Eds.), Islamic finance: Ethical underpinnings, products, and institutions (pp. 193–205). Springer International Publishing. https://doi. org/10.1007/978-3-319-91295-0_14 Htay, S. N. N., Hamat, M., Wan Ismail, W. Z., & Salman, S. A. (2014). Retakaful (Islamic reinsurance) historical, shari’ah and operational perspectives. World Applied Sciences Journal, 30((Innovation Challenges in Multidiciplinary Research & Practice)), 185–190. IFSB-18. (2016). Principes directeurs du Retakaful (Réassurance islamique). https:// www.ifsb.org/ Khouaja, M. A. (2015). Takaful, Le chemin islamique à l’assurance: Développement d’un outil de tarification Takaful Auto—RC [Master’s thesis]. FST, University Cadi Ayyad. 532 Retakaful Contributions Model Using Machine Learning Techniques Kouach, Y., El Attar, A., & El Hachloufi, M. (2022). Automobile takaful pricing by machine learning algorithms. Recherches et Applications En Finance Islamique (RAFI), 6(2), 201-218. McNamara, M. E., Zisser, M., Beevers, C. G., & Shumake, J. (2022). Not just “big” data: Importance of sample size, measurement error, and uninformative predictors for developing prognostic models for digital interventions. Behaviour Research and Therapy, 153(2022), 104086. Mohamed Yusuf, R. Y. (2011). Revisiting and redefining the concept of reTakaful and the viability of its model in Malaysian Takaful industry. Business and Management Quarterly Review (BMQR), 2(4), 20–32. Nanfack, G., Temple, P., & Frénay, B. (2022). Constraint enforcement on decision trees: A survey. ACM Computing Surveys (CSUR), 54(10s), 1–36. Paturi, U. M. R., Cheruku, S., & Reddy, N. S. (2022). The role of artificial neural networks in prediction of mechanical and tribological properties of composites—A comprehensive review. Archives of Computational Methods in Engineering, 29(5), 3109–3149. Saed, A. A. A., & Jaharadak, A. A. (2022). Implementation with performance evaluation of decision tree classifier for uncertain data: Literature review. International Journal of Multidisciplinary Research and Publications, 5(5), 125-132. Saint-Cirgue, G. (2019). Apprendre le maching learning en une semaine. https:// machinelearnia.com/apprendre-le-machine-learning-en-une-semaine/ Santhosh, N. M., Cheriyan, J., & Nair, L. S. (2022). A multi-model intelligent approach for rumor detection in social networks. 2022 International Conference on Computing, Communication, Security and Intelligent Systems (IC3SIS), 1–5. Sarker, I. H. (2021). Machine learning: Algorithms, real-world applications and research directions. SN Computer Science, 2(3), 160. https://doi.org/10.1007/ s42979-021-00592-x Sheetal, A., Jiang, Z., & Di Milia, L. (2023). Using machine learning to analyze longitudinal data: A tutorial guide and best-practice recommendations for social science researchers. Applied Psychology, 72(3), 1339–1364. Taye, M. M. (2023). Theoretical understanding of convolutional neural network: Concepts, architectures, applications, future directions. Computation, 11(3), 52. https://doi.org/10.3390/computation11030052 Xie, J., Sage, M., & Zhao, Y. F. (2023). Feature selection and feature learning in machine learning applications for gas turbines: A review. Engineering Applications of Artificial Intelligence, 117(2023), 105591.