## 2 Materials and Methods
### Hidden Markov Chain  
In generating discrete-time Markov chains, the research focused on correctly generating matrices. Separately, for each variable, steering angle, and course variance, frequency counting was conducted, and the overcounts in non-consecutive timelines were removed. When the Markov chains were generated based on the matrices, the emission frequency of course variance angles for each steering angle was counted. Figure 3 shows the steering angle and course variance of the Markov chains in the illustration.  
In Figure 3, the steering angle could transition to the next state or sometimes to another state over the next state, which means that the steering angle changed slowly or rapidly. Likewise, the transition of course variance means the course-altering speed. As the ship's steering angle and course changed slowly along the rudder and the ship's movement [23], the expected shape of the Markov chain for both variables was a line shape.  
When both sequence data were preprocessed and arranged in seconds, the total length in time was 802,914 s. Transition probability matrices were calculated by designating states, counting the transition frequency, and transforming it into probability. The \"steering angle\" states are in every degree from \(-\)35 to +35 degrees, and the \"course variance angle\" states are in every 0.1 degrees from \(-\)2.0 to +2.0 degrees. Afterward, the transition from state to state was counted in matrices, as the pseudoc  
Figure 3: Hidden Markov chain of steering order and course variance.  
Where \"n\" is the number of states, \"m\" is the number of sequences, \"StateData\" is the array vector that includes every state, and \"SequenceData\" is the experts' sequential data changing in time and the index numbers of elements \"i\", \"j\", and \"k\". Then, the transition frequency matrices were transformed into probability matrices. Afterward, the emission probability matrix from steering angle to course variance was generated upon the counted frequency, as the pseudocode explains in Algorithm 2.  
```
1:n \(\leftarrow\) length[RudderStateData]
2:m \(\leftarrow\) length[AlterStateData]
3:t \(\leftarrow\) length[SequenceData]
4:t\({}_{j}\),r\({}_{k}\) \(\leftarrow\) RudderStateData
5:a\({}_{j}\),a\({}_{k}\) \(\leftarrow\) AlterStateData
6:EmissionMatrix(i,j) = 0, i = 1, j = 1
7:for i to n do
8:for j to m do
9:for k to t do
10:if r\({}_{1}\) = r\({}_{k}\) and a\({}_{j}\) = a\({}_{k}\) then
11:Update EmissionMatrix(i,j) using EmissionMatrix(i,j) + 1
12:return EmissionMatrix
```  
**Algorithm 2** Emission frequency counting  
Where \"n\" is the number of steering angle states, \"m\" is the number of course variance states, \"t\" is the length of the sequences as well as the length of time, \"RudderStateData\" and \"AlterStateData\" are the array vector that includes every state of steering angles and course variance angles, and \"SequenceData\" is the experts' sequential data of rudder angles and course variance angles observed second and the index numbers of elements \"i\", \"j\", and \"k\". Similar to transition frequency calculation, the algorithm counts which course variance was observed for each steering angle. Then, the frequency values were transformed into probability values. Based on the prepared database, the research conducted the random-walk simulation of course alteration and the steering angle estimations.