Calculate the residuals related to the estimated signal
Calculate the residuals related to the estimated signal
This function returns the difference between x and the estimated signal with change-points at cpt. The input in the argument type_chg will indicate the type of changes in the signal.
cpt: A positive integer vector with the locations of the change-points. If missing, the ID function is called internally to detect any change-points that might be present in x.
type_chg: A character string, which defines the type of the detected change-points. If type_chg = ``mean'', then the change-points represent the locations of changes in the mean of a piecewise-constant signal. If type_chg = ``slope'', then the change-points represent the locations of changes in the slope of a piecewise-linear and continuous signal.
type_res: A choice of raw''``` and standardised''``` residuals.
Returns
If type_res = ``raw'', the function returns the difference between the data and the estimated signal. If type_res = ``standardised'', then the function returns the difference between the data and the estimated signal, divided by the estimated standard deviation.