Description Usage Arguments Details Value Author(s) See Also Examples
Computes the ratio of lagged observations in a vector.
1 2 3 4 5 6 7 8 |
x |
A numeric vector or matrix. |
lag |
An integer representing the lag ‘distance’. |
recursion |
An integer that indicates the level of recursion for the calculations. A |
differences |
Same as |
direction |
A string that indicates the direction of calculation. A |
... |
Additional arguments to |
This function behaves similarly to diff()
except that it returns a vector or matrix of ratios rather than differences.
A vector or matrix of lagged ratios.
Derek H. Ogle, derek@derekogle.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Backward lagged ratios
# no recursion
lagratio(1:10,1)
lagratio(1:10,2)
# with recursion
lagratio(1:10,1,2)
lagratio(1:10,2,2)
## Forward lagged ratios
# no recursion
lagratio(10:1,1,direction="forward")
lagratio(10:1,2,direction="forward")
# with recursion
lagratio(10:1,1,2,direction="forward")
lagratio(10:1,2,2,direction="forward")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.