winbugs - 2 Models in JAGS - kind of 'non-trivial' case -
i trying build garch(1,1) model in jags, , simplicity let's assume mean equation follows ar(1) process. trying build 1 jags model allow joining ar(1), , garch(1,1) processes.
for can achieve results building 2 separate jags models (they simplified clarity of presentation). first jags model estimates parameters of ar(1) process:
modelstring=" model { (i in 2:n) { y[i]~dnorm(alpha0+alpha1*y[i-1],1) } alpha0 ~ dnorm(alpha0.mean,alpha0.prec) alpha1 ~ dunif(-1,1) }
having parameter's estimates generate data of ar(1) process, obtain residuals, , variances (assuming window):
alpha0=summary(output1)$statistics[1] alpha1=summary(output1)$statistics[2] y_hat=alpha0+alpha1*y[1:(dim(data)[1])] eps=y-y_hat window=30 var=rep(na, dim(data)[1]-window) (i in 1:length(var)){ var[i]=var(eps[i:(i+window)]) }
the next block garch(1,1) proses in jags:
modelstring=" model { (i in 2:n) { var[i]~dnorm(beta0+beta1*var[i-1]*+beta2*eps[i-1]^2,1) } beta0 ~ dnorm(beta0.mean,beta0.prec) beta1 ~ dunif(0,1) beta2 ~ dnorm(0,1-beta1) } "
how join 2 processes dependent?
Comments
Post a Comment