To calculate the z score by group in javascript, you can first group your data by some attribute using Array.reduce().
index.tsx356 chars16 linesThen, for each group, calculate the mean and standard deviation using Array.reduce() and Math functions.
index.tsx491 chars14 linesThis will give you an object with group names as keys and an array of z scores as values. The z score for a value x is calculated as (x - mean) / standardDeviation. The z score represents how many standard deviations away from the mean the value is.
gistlibby LogSnag