# NOT RUN {
## Get the data
library("Quandl")
d <- Quandl("NASDAQOMX/OMXS30", start_date="2012-01-02",
end_date="2014-01-02", type="zoo")
y <- as.numeric(100 * diff(log(d$"Index Value")))
## Estimate the filtered state
xhatf <- sm_sv(y, mu=-0.10, phi=0.97, sigmav=0.15, nPart=500,
T=500 )$xh
## Plot the data and the log-volatility estimate
par(mfrow=c(2,1))
plot(y, type="l", xlab="time", ylab="log-returns")
plot(xhatf, type="l", xlab="time", ylab="estimate of log-volatility")
# }
Run the code above in your browser using DataLab