This function verifies and normalizes the provided prior probabilities and
misclassification cost matrix for a given response variable. It ensures that
the lengths of the prior and the dimensions of the misclassification cost
matrix match the number of levels in the response variable. If prior
or
misClassCost
are not provided, default values are used: the prior is set to
the observed frequencies of the response, and the misclassification cost
matrix is set to 1 for all misclassifications and 0 for correct
classifications.
checkPriorAndMisClassCost(prior, misClassCost, response)
A list containing:
A normalized vector of prior probabilities for each class.
A square matrix representing the misclassification costs, with rows and columns labeled by the levels of the response variable.
A numeric vector representing the prior probabilities for each
class in the response variable. If NULL
, the observed frequencies of the
response are used as the default prior.
A square matrix representing the misclassification costs
for each pair of classes in the response variable. If NULL
, a default
misclassification matrix is created where all misclassifications have a
cost of 1 and correct classifications have a cost of 0.
A factor representing the response variable with multiple classes.