adjust_known.Rd
Adjust a regular time series for a known drift over a known period. The drift is assumed to increase linearly in time from 0 at the beginning of the time series to the specified drift value at the end of the time series.
adjust_known(x, mask, drift)
x | A vector of data with missing values. |
---|---|
mask | A logical mask that identifies a subgroup of |
drift | The drift value to correct for. The drift
is assumed to occur at the last element of the masked vector
|
The vector x
with corrected values for the subgroup
specified by mask
.
This function assumes that mask
specifies a
contiguous block, and that the time series values are
equally spaced. No consideration is given to noncontiguous
masks or unequal-interval time series.
x = rnorm(100, 10, 0.1) + 0.025 * (0:99) newx = adjust_known(x, drift = 99*0.025) if (interactive()) { plot(x, type = 'l') lines(newx, col = 'red') }