snarch | R Documentation |
Calculates the long-, middle- and short-term trends and vola for a financial time series.
snarch(dat)
dat |
financial time series. |
data frame
tr20 |
long-term trend |
vl20 |
long-term vola |
tr10 |
middle-term trend |
vl10 |
middle-term vola |
tr5 |
short-term trend |
vl5 |
short-term vola |
Dr. Lars Metzner
Dr. Lars Metzner (2019) Finanzmathematische Zeitreihenanalyse. Independently Published.
# generate test data
set.seed(1234)
x <- seq(1:250)
dat <- 13000 + cumsum(rnorm(250))
# calculate the S-NARCH model
df <- snarch(dat)
# plot the results
op <- par(mfrow=c(1,3))
plot(x,dat)
lines(x,df$tr20)
lines(x,df$tr20 - df$vl20, lty = 'dotted')
lines(x,df$tr20 + df$vl20, lty = 'dotted')
plot(x,dat)
lines(x,df$tr10)
lines(x,df$tr10 - df$vl10, lty = 'dotted')
lines(x,df$tr10 + df$vl10, lty = 'dotted')
plot(x,dat)
lines(x,df$tr5)
lines(x,df$tr5 - df$vl5, lty = 'dotted')
lines(x,df$tr5 + df$vl5, lty = 'dotted')
par(op)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.