calc_metric function

Calculate deviance