# SV model estimation in R using tsbugs

I have been trying to estimate the basic stochastic volatility model using OpenBUGS via R and at an stage of the following command. Please can you comment for the command that can give me the estimated parameter values of the model?

library(tsbugs)
y <- svpdx$pdx # create and write bugs script sv0 <- sv.bugs(y) writeLines(sv0$bug, "sv0.txt")

# estimate model parameters in R2OpenBUGS
library(R2OpenBUGS)
sv0.bug <- bugs(data=sv0$data, inits=list(inits(sv0)), param=c(nodes(sv0, "prior")$name, "h"),
model="sv0.txt",
n.iter=11000, n.burnin=10000, n.chains=1)

• For the SV model estimation I have been trying to model by using OpenBUGS via R and at an stage of the following command!y y<- svpdx$pdx sv0 <- sv.bugs(y, sim=TRUE) print(sv0) – user25287 May 9 '13 at 6:35 • > sv0.bug <- bugs(data = sv0$data, inits = list(init), param = c(nodes(sv0, "prior")$name,"y.sim","h"), model = "sv0.txt", n.iter = 11000, n.burnin = 1000, n.chains = 1) How can I estimate the parameter values of a basic SV model? a command that could print an estimated value for the parameters (alpha0, alpha1, sigma) or (beta, mu, sigma) of a SV model – user25287 May 9 '13 at 6:48 • This question appears to be off-topic because it is about how to use R, & too old to migrate. – gung - Reinstate Monica May 21 '14 at 16:16 ## 1 Answer Tell the bugs command which parameters you want to monitor param=c("psi0", "psi1", "tau").... sv0.bug<-bugs(data=sv0$data,
inits=list(inits(sv0)),
param=c("psi0", "psi1", "tau"),
model="sv0.txt",
n.iter=11000, n.burnin=10000, n.chains=1)


Then use print.bugs command to give the summary statistics of the MCMC estimation...

> print(sv0.bug)
Inference for Bugs model at "sv0.txt",
Current: 1 chains, each with 11000 iterations (first 10000 discarded)
Cumulative: n.sims = 1000 iterations saved
mean   sd   2.5%    25%    50%    75%  97.5%
psi0       -0.9  0.2   -1.2   -1.0   -0.9   -0.7   -0.5
psi1        1.0  0.0    1.0    1.0    1.0    1.0    1.0
tau         0.2  0.0    0.1    0.2    0.2    0.2    0.2
deviance 1753.7 12.6 1729.0 1745.0 1753.0 1763.0 1776.0

DIC info (using the rule, pD = Dbar-Dhat)
pD = 36.6 and DIC = 1790.0
DIC is an estimate of expected predictive error (lower deviance is better).