Helpfunction for update_g(). Calculates the errors for one of the possible groups time series can be placed in.
Useful links