Subtract the theoretical function S_H_0 or the mean of the functions
in the curve set. If the curve_set object contains already residuals
T_i(r) - T_0(r), use_theo ignored and the same object returned.
residual(curve_set, use_theo = TRUE)A curve_set (see create_curve_set) or
an envelope object. If an envelope object is given,
it must contain the summary functions from the simulated patterns which can be
achieved by setting savefuns = TRUE when calling envelope.
Whether to use the theoretical summary function or the mean of the functions in the curve_set.
A curve set object containing residual summary functions. theo is no longer included.
The mean of the functions in the curve_set is
the mean of the functions provided in obs, if obs is a matrix
(i.e. many functions in obs).
the mean of the functions provided in sim_m, if obs is a vector
(i.e. only one function in obs).
If use_theo = TRUE, but the component theo does not exist in the
curve_set, the mean of the functions is used silently.