Description Usage Arguments Value Author(s) Examples
View source: R/jubilee-forward-rtn-method.R
These two internal utilities are intended to be used to calculate the annualized forward and backward log-return on the given time series. It is really calculating the speed of change, aka log-return, expecting the input to be in logrithmic scale. The forward return is typically the response variable in a forecast. The backward return is often used as explanatory variable in a regression.
1 2 3 | jubilee.forward_rtn(fraction, ts, fwd.rtn.duration, tol.frac = 1/12)
jubilee.backward_rtn(fraction, ts, bwd.rtn.duration, tol.frac = 1/12)
|
fraction |
numeric, the ending fraction of regression |
ts |
numeric, the time series data, typically in log-scale |
fwd.rtn.duration |
numeric, the forward-looking regression period |
tol.frac |
numeric, tolerance of missing data in the beginning of backward return, or the ending of the forward return, expressed as fraction. Default is 1/12, that is, one month. |
bwd.rtn.duration |
numeric, the backward-looking regression period |
numeric, the same length as fraction
Stephen H. Lihn
1 2 3 4 5 6 7 8 | ## Not run:
dtb <- jubilee.repo(online=FALSE)@ie
dtb$fwd.logr.10 <- jubilee.forward_rtn(dtb$fraction, dtb$log.tri, 10)
dtb$bwd.logr.10 <- jubilee.backward_rtn(dtb$fraction, dtb$log.tri, 10)
head(subset(dtb, fraction >= 1990),1)$fwd.logr.10 # 1/1990+10y: 0.16745
tail(subset(dtb, fraction <= 2000+1/12),1)$bwd.logr.10 # the same as above
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.