# Method for Select Best AIS Data in Prediction Vessel Movements and Route Estimation
## 4 Data Analysis and Preliminary Experiments
### Data Adjustment  
The graph of the histogram with its probability density curve is in two perspectives. The first uses the calculation of bins through the square root of the amount of data. The second is by using the Freedman-Diaconis rule, as shown in Figures 3 and 4. The last graph is a quantile-quantile one to verify the non-normality of the distribution. Figures 3 and 4 show the sample's behavior around its histogram and its KDE. Figure 3: The Kernel Density Estimation (KDE) and histograms for each sample route (one and two) to visualize the differences. Freedman–Diaconis rule was used to calculate bins. Some route data change in latitude or longitude, depending on the destination, starting point, or route. The rest of the data are very similar in latitude and longitude. The data are different in the number of observations, or they have small deviations in the routes. At the same time, the historical data contain complete routes. The previous cases (the feature)  
Figure 4: Route 3 and 4 Kernel Density Estimation (KDE) and histograms for each sample route to visualize the differences. Freedman–Diaconis rule is used as a complement of Figure 3.  
affect the search and selection of statistical values that serve as discriminant properties to select the appropriate routes that are the basis for predicting and estimating routes. The first step is to cut the data between the origin and the last actual position values for each route to adjust the sample route to the objective route. In the target route, the method approximates all AIS data's statistical behavior to our target and discards those routes with different behavior because some statistical values can perform as outliers, as shown in Figure 5. The data in the red section are discarded. This step helps approximate the historical data to the current route in statistical terms. Some routes have a different direction, and similar cases help to perform the selection of routes in the next step. Once the data have been filtered, the method computes the statistical values of each route. All sets of the route with a behavior similar to the target route will maintain a similar statistical behavior despite the lack of information and regardless of the number of observations. This stability is what allows the method to select the most appropriate datasets. It is possible to find statistical values that have a higher weight for classification to detect the best routes that statistically match our route with the Chi-squared selection method. In this case, the method wants to find values with minor and significant statistical differences. The statistics with less dispersion and those with much more dispersion are kept, as shown in Table 1.  
The statistical metrics calculated for the vessel position's target routes (longitude and latitude) are as follows:  
The **mean** is obtained from the tracking of each route. A central descriptive value is obtained from the distribution of the routes. The main disadvantage is the mean is susceptible to outliers' influence, a property that the method can use as a discriminant feature. **Standard deviation** measures the dispersion around the mean. It is highly influenced by the mean and allows the identification of outliers. This property is used to select the closest routes to the route that will generate the prediction. The **median** is selected because outliers do not influence it. In addition, it provides an approximate location of the center point to the distribution when it is not normal to the target path distribution. The **trimmed** mean is less sensitive to outliers. It allows discarding them and uses the distribution data to get closer to the target route. Figure 5: The data in the red section are discarded. **MAD** is less sensitive to outliers. It is an important variable to relate the routes that are statistically similar to the target route. The **range** is susceptible to outliers. This property allows discriminating those routes that have large deviations outside the target route.