A linear time method for the detection of point and collective anomalies