# On the Estimation of Logistic Models with Banking Data Using Particle Swarm Optimization
## 4 Implementation
In this paper, for all logistics models, the carrying capacity will be estimated using PSO at an interval, say \([a,b]\). In the case of commercial banks, \(a=\) 8,068,346 (the last data of the training data of commercial banks) and \(b=\) 142,549,510 (the maximum rough carrying capacity value of commercial banks from Table 1 times 10). And for the case of rural banks, \(a=\) 135,693 (the last data of the training data of rural banks) and \(b=\) 2,157,160 (the maximum rough carrying capacity value of rural banks from Table 1 times 10). Meanwhile, to estimate the parameters of logistic models in Section 2 such as \(a_{1},a_{2},a_{3},r,\alpha,\beta,\gamma\), we use the intervals presented in Table 2. The parameter \(r\) of the von Bertalanffy model is estimated at interval \([0,50]\), because the parameter \(r\) requires a larger value to match the behavior of the Verhulst model. \begin{table}
\begin{tabular}{c c c c c} \hline \hline \(\mathbf{s_{1}}\) & \(\mathbf{s_{2}}\) & \(\mathbf{s_{3}}\) & **Rough K for Com. Bank** & **Rough K for Rural Bank** \\ \hline
0 & 71/12 & 142/12 & 12,431,437 & 206,126 \\
2/12 & 71/12 & 140/12 & 12,022,655 & 199,172 \\
4/12 & 71/12 & 138/12 & 11,342,372 & 200,580 \\
1/12 & 72/12 & 143/12 & 14,254,951 & 215,716 \\
3/12 & 72/12 & 141/12 & 13,313,955 & 204,998 \\
5/12 & 72/12 & 139/12 & 12,619,803 & 204,283 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Rough values of the carrying capacity (in billion Rp) of commercial and rural banks in Indonesia. We have set the search space for the parameter estimation. Now, we set some parameters in PSO algorithm: \(m=1000\), \(c_{1}=2\), \(c_{2}=2\), \(w=1\), \(\rho=0.99\). Let \(\mathbf{x}(k)\) be the vector of the logistic model's parameters at \(k\)-th iteration. The objective function of the parameter estimation being used here is the Mean Absolute Percentage Error (MAPE), which is calculated as follows  
\[f(\mathbf{x}(k))=\frac{100\%}{144}\sum_{i=0}^{143}\Big{|}\frac{y(t_{i}, \mathbf{x}(k))-y_{d}(t_{i})}{y_{d}(t_{i})}\Big{|},\]  
where \(y_{d}(t_{i})\) is the training data of banking assets at time \(t_{i}=i/12\) and \(y(t_{i},\mathbf{x}(k))\) is the value of assets based on the logistic model's solution, \(i=0,1,\ldots,143\). We set the stopping criteria for the algorithm, required the iteration passes the 20-th iteration, as follows  
\[k=k_{\text{max}}\text{ or }|f(\mathbf{x}(k))-f(\mathbf{x}(k-20))|<\epsilon,\]  
where \(k_{\text{max}}=150\) and \(\epsilon=0.001\%\). We run the PSO twenty times, and choose the obtained parameters that have the minimum MAPE. The obtained model is used to validate the validation data by calculating  
\[\text{MAPE validation}=\frac{100\%}{13}\sum_{i=144}^{156}\Big{|}\frac{y(t_{i },\mathbf{x}^{\text{best}})-y_{d}(t_{i})}{y_{d}(t_{i})}\Big{|}.\]  
Apart from MAPE, as an additional consideration to find out how close the logistic model is to the data, we also calculate the Root Mean Square Error (RMSE) for the training data and the validation data below  
\[\text{RMSE training}=\sqrt{\frac{\sum_{i=0}^{143}(y(t_{i}, \mathbf{x}^{\text{best}})-y_{d}(t_{i}))^{2}}{144}},\] \[\text{RMSE validation}=\sqrt{\frac{\sum_{i=144}^{156}(y(t_{i}, \mathbf{x}^{\text{best}})-y_{d}(t_{i}))^{2}}{13}}.\]