Description Usage Arguments Details Value Examples
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.
1 | 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
|
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.
The vector x
with corrected values for the subgroup
specified by mask
.
1 2 3 4 5 6 | 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')
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.