# Analyzing Student Behavioral Patterns in MOOCs Using Hidden Markov Models in Distance Education
## 2 Materials and Methods
The correlation among resources is given in the transition matrix  
**Step 2** Calculation of \(\gamma\) and \(\xi\) probabilities  
We employ transition and emission matrixes to calculate the variables \(\gamma\) and \(\xi\) with Baum-Welch. The variable \(\gamma\) represents the posterior probability that a student with user ID \(t\) is in state \(S_{i}\). The variable \(\gamma\) is useful to indicate the expected number of transitions from each resource (hidden state) to each grade (observed state) for the same student with user ID \(t\). The variable \(\xi\) denotes the posterior probability that a student with user ID \(t\) to be in the state \(S_{i}\) and for a student with user ID \(t+1\) to be in the state \(S_{j}\). We find which pairs of states have high probabilities with \(\xi\). Baum-Welch (or training algorithm) is trained from the observations (training set)  
**Step 3** With the Viterbi algorithm, we find the most likely sequence of states given the observation sequence. When a value in transition matrix is 0 the Viterbi algorithm offers a solution. Initially, the transition matrix, which includes the probabilities of transitioning from one state to another state (referred to as hidden states), is calculated. The emission matrix, representing the probabilities of transitioning between the hidden states and the observed states (referred to as grades), is also implemented. Next, the initial probabilities needed to execute the model are calculated. With these parameters in place, we run the HMM function in R. The transition matrix in our experiments represents the probability of entering a new state from the current state. These probabilities for each student are given in Table 3. These values are illustrated in Figure 6. In this figure, we can derive conclusions about the participation percentages for the resources (hidden states) of the MOOC. The probabilities of the different possible outputs from each resource to the grades (observed states) are illustrated in the column chart of Figure 5. We can derive conclusions from this chart about the grades achieved from the students after their participation to each resource of the MOOC. These values also appear in Table 3. We employ transition and emission matrixes to calculate the variables \(\gamma\) and \(\xi\). The variable \(\gamma\) represents the posterior probability that a student with user ID \(t\) is in state \(S_{i}\).The variable \(\xi\) denotes the posterior probability that a student with user ID \(t\) to be in the state \(S_{i}\) and for a student with user ID \(t+1\) to be in the state \(S_{j}\) as we describe in Algorithm 1. The variable \(\gamma\) is useful to indicate the expected number of transitions from each resource (hidden state) to each grade (observed state) for the same student with user ID \(t\). The variable \(\gamma\) is depicted in Figure 2, where we can see the values for certain resources. Figure 3 illustrates the distribution of the variable \(\xi\) and the correlation among the various course resources. The values of \(\xi\) correspond to the probabilities for pairs of states. We mention some background knowledge required for the algorithms used in the following paragraphs. Some basics for the Forward-Backward algorithm are the following. We utilize the Markov property in sequence, i.e., such that the next step depends only on the previous step in a sequence. We apply this assumption to a sequence of student IDs in a MOOC course. We have calculated the transition and emission probability matrixes, and the initial probability distribution. The hidden states are the important states of the MOOC course. The visible states are the final grades achieved by each student ID. In the Forward algorithm, we will use the computed probability for the current ID \(t\) to be in state \(S_{i}\) after having observed the grades until student ID \(t\). This derivation is extended to a generalized model for all IDs, which is implemented by the Forward algorithm to find the probability that the observation sequence was generated by the HMM.