Calculates the macro-F1 score and its standard error
aa_macro_f1.RdCalculates the macro-F1 score as the unweighted arithmetic mean of class-specific F1 scores. Each class therefore contributes equally to the macro-F1 score, irrespective of its sample size or prevalence.
If standard errors of the class-specific F1 scores are provided, the standard error of the macro-F1 score is calculated by standard variance propagation for an arithmetic mean, assuming that the class-specific F1 estimates are independent:
$$ SE(\mathrm{macro\mbox{-}F1}) = \frac{\sqrt{\sum_{k=1}^{K} SE(F1_k)^2}}{K} $$
When class-specific F1 scores are calculated from the same confusion matrix or the same set of observations, they may not be statistically independent. In this case, the covariance terms between class-specific F1 estimates are not accounted for by this calculation, and the resulting standard error is an approximation. A covariance-aware delta method or a bootstrap approach should be used when the dependence between class-specific estimates needs to be accounted for.
Value
A vector containing two numeric values:
f1: The macro-F1 score, calculated as the unweighted arithmetic mean of the class-specific F1 scores.f1_se: The standard error of the macro-F1 score. This isNULLiff1_seis not provided. When provided, the calculation assumes independence between the class-specific F1 estimates.