calc_max_precision: Calculate the mode value at maximum precision
Description
This function determines the mode of a variable `x`, filtered to entries with the maximum value of a specified precision vector `precision_var`.
It optionally resolves ties using one or two additional vectors for tie-breaking.