nextAlphaProb {conjurer} | R Documentation |
Generates next alphabet based on prior probabilities.
nextAlphaProb(alphaMatrix, currentAlpha, placement)
alphaMatrix |
A table. This table is generated using the |
currentAlpha |
A string. This is the alphabet(s) for which the next alphabet is generated. |
placement |
A string. This takes one of the two values namely "first" or "all". |
The purpose of this function is to generate the next alphabet for a given alphabet(s). This function uses prior probabilities to generate the next alphabet. Although there are two types of input tables passed into the function by using the parameter alphaMatrix, the process to generate the next alphabet remains the same as given below.
Firstly, the input table contains frequencies of the combination of current alphabet currentAlpha (represented by rows) and next alphabet(represented by columns). These frequencies are converted into a percentage at a row level. This means that for each row, the sum of all the column values will add to 1.
Secondly, for the given currentAlpha, the table is looked up for the corresponding column where the probability is the highest. The alphabet for the column with maximum prior probability is selected as the next alphabet and is returned by the function.
The next alphabet following the input alphabet(s) passed by the argument currentAlpha.