# Regional Geomagnetic Field Modeling Based on Associated Legendre Polynomials
## 3 Data and Modeling Results
### Regional Geomagnetic Anomaly Field Model Construction  
In this study, the Northwest Pacific Ocean--specifically, the \(3^{\circ}\times 3^{\circ}\) area from \(122^{\circ}\) E to \(125^{\circ}\) E in longitude and \(29.5^{\circ}\) N to \(32.5^{\circ}\) N in latitude (the area marked by the red box in Figure 1a)--was selected as the study area. This area, which covers approximately 160,000 square kilometers and contains 8100 data points, was assessed based on the sea-level dataset. As illustrated in Figure 1b, the spatial distribution of the geomagnetic anomalies in the study area is clearly characterized, and the statistics provided in Table 1 highlight the significant variations regarding the geomagnetic anomalies in the area. Furthermore, there are several areas with high geomagnetic anomaly values in the region, which provides good conditions for verifying and comparing the accuracy and applicability of various modeling approaches. To construct and validate the model, 80% of the data (i.e., 6480 data points) were randomly selected from the 8100 points in the selected region as the training dataset for the model; meanwhile, the remaining 20% (i.e., 1620 data points) were used as the test dataset for the model. This data partitioning approach ensures an unbiased evaluation of the model's performance on independent data. To objectively assess the model's predictive accuracy, the root mean square error (RMSE) was selected as the key index, which is calculated as follows:  
\[\text{RMSE}=\sqrt{\frac{1}{n}\sum_{i=1}^{n}(y_{i}-\hat{y}_{i})^{2}} \tag{8}\]  
where \(n\) represents the number of samples, \(y_{i}\) denotes the predicted value of the model for the \(i\)th data point, and \(\hat{y}_{i}\) represents the true value for the \(i\)th data point. The smaller the RMSE value, the smaller the difference between the predicted result and the true value of the model, which indicates that the predictive performance of the model is superior. Through calculating the RMSE, we can quantitatively assess the prediction accuracy of the model and provide a scientific basis for the optimization and selection of the model. Previous studies [14] have highlighted that the truncation level and the resolution of boundary effects are critical factors in constructing regional geomagnetic anomaly models. In regional geomagnetic field modeling, the truncation level refers to the maximum degree of the modeling model expansion used, which determines the resolution and complexity of the model. The selection of the optimal truncation level is crucial, as it balances the trade-off between model accuracy and computational efficiency. A higher truncation level captures finer details of the field but increases the computational complexity, while a lower truncation level simplifies calculations but may omit significant features. Therefore, the optimal truncation level is determined through comprehensive consideration of the error analysis results and computational efficiency. Regarding boundary effects, the prediction of data within the modeling region is essentially an interpolation problem, where points exhibit continuous relationships with surrounding points. However, at the boundaries, the boundary points have vacant data outside the region, which can result in significant deviations in the model predictions at the boundary points. Figure 2a illustrates the \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Data Type** & **Max/nT** & **Min/nT** & **Mean** & **Std** \\ \hline Magnetic Anomalies & 259.17 & \(-121.871\) & \(-4.58\) & 47.20 \\ \hline \hline \end{tabular}  
* Max: maximum value in data; Min: minimum value in data; Mean: mean value of data; Std: standard deviation of data.  
\end{table} 
Table 1: Basic experimental data. relationship between the truncation level and the number of outliers. The RMSE was calculated using the training data and the number of outliers, which was determined using the test data through the box plot method (as will be detailed later in this section).