added discriminant function (psim)