Hi all,
I am an undergraduate student and new to WinBUGS. We are trying to
program Stock & Watson's Dynamic Factor Model.
We have put the model specification on the following link which you
can view: http://www.angelfire.com/on4/stockwatson/index.html
This is excerpted from the book, "State-Space Models with Regime
Switching," by Chang-Jin Kim and Charles R. Nelson.
We have tried to enter the model in WinBUGS and got numerous errors.
We tried to get around these by band-aid "patch-up" solutions, and now
it just hangs when we try to compile.
I am including the code below. Does anyone have some pointers or a
basic idea on how this model might be entered?
One problem we encountered was, we cannot let our Delta.Y variables be
assigned a value in the code and also be entered from the data. So we
had to specify a prior on the Delta.Y's and defined mu's as the means
of these Delta.Y's. The mu's were then assigned values.
This seems to fit with the BUGS examples we looked at, but it still
isn't working.
We also had problems dealing with lagging variables.
Any help that anyone could provide would be much appreciated.
Thanks,
Tom Farrar
Model {
muc[1]<- 0.0001
muc[2]<- 0.0001
for (t in 3:T) {
Delta.C[t] ~ dnorm(muc[t],1)
Delta1.Y[t] ~ dnorm(mu1[t],tau.1)
Delta2.Y[t] ~ dnorm(mu2[t],tau.2)
Delta3.Y[t] ~ dnorm(mu3[t],tau.3)
Delta4.Y[t] ~ dnorm(mu4[t],tau.4)
mu1[t] <- D.1 + gamma.1*Delta.C[t] + psi.11*e.1[t-1] +
psi.12*e.1[t-2] + epsilon.1[t]
mu2[t] <- D.2 + gamma.2*Delta.C[t] + psi.21*e.2[t-1] +
psi.22*e.2[t-2] + epsilon.2[t]
mu3[t] <- D.3 + gamma.3*Delta.C[t] + psi.31*e.3[t-1] +
psi.32*e.3[t-2] + epsilon.3[t]
mu4[t] <- D.4 + gamma.4*Delta.C[t] + psi.41*e.4[t-1] +
psi.42*e.4[t-2] + epsilon.4[t]
muc[t] <- delta + phy.1*(muc[t-1] - delta) +
phy.2*(muc[t-2] - delta)
#e.1[t] <- psi.11*e.1[t-1] + psi.12*e.1[t-2] + epsilon.1[t]
#e.2[t] <- psi.21*e.2[t-1] + psi.22*e.2[t-2] + epsilon.2[t]
#e.3[t] <- psi.31*e.3[t-1] + psi.32*e.3[t-2] + epsilon.3[t]
#e.4[t] <- psi.41*e.4[t-1] + psi.42*e.4[t-2] + epsilon.4[t]
}
# Priors on parameters:
gamma.1 ~ dnorm(0.0,1.0)
gamma.2 ~ dnorm(0.0,1.0)
gamma.3 ~ dnorm(0.0,1.0)
gamma.4 ~ dnorm(0.0,1.0)
D.1 ~ dnorm(0.0,1.0)
D.2 ~ dnorm(0.0,1.0)
D.3 ~ dnorm(0.0,1.0)
D.4 ~ dnorm(0.0,1.0)
delta ~ dnorm(0.0, 1.0E-6)
phy.1 ~ dnorm(0.0,1.0)
phy.2 ~ dnorm(0.0,1.0)
psi.11 ~ dnorm(0.0,1.0)
psi.12 ~ dnorm(0.0,1.0)
psi.21 ~ dnorm(0.0,1.0)
psi.22 ~ dnorm(0.0,1.0)
psi.31 ~ dnorm(0.0,1.0)
psi.32 ~ dnorm(0.0,1.0)
psi.41 ~ dnorm(0.0,1.0)
psi.42 ~ dnorm(0.0,1.0)
tau.1 ~ dgamma(0.001,0.001)
tau.2 ~ dgamma(0.001,0.001)
tau.3 ~ dgamma(0.001,0.001)
tau.4 ~ dgamma(0.001,0.001)
sigma.1 <- 1.0/sqrt(tau.1)
sigma.2 <- 1.0/sqrt(tau.2)
sigma.3 <- 1.0/sqrt(tau.3)
sigma.4 <- 1.0/sqrt(tau.4)
# Priors on Error Terms:
for (t in 1:T) {
epsilon.1[t] ~ dnorm(0.0,tau.1)
epsilon.2[t] ~ dnorm(0.0,tau.2)
epsilon.3[t] ~ dnorm(0.0,tau.3)
epsilon.4[t] ~ dnorm(0.0,tau.4)
e.1[t] ~ dnorm(0.0,1.0)
e.2[t] ~ dnorm(0.0,1.0)
e.3[t] ~ dnorm(0.0,1.0)
e.4[t] ~ dnorm(0.0,1.0)
}
}
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|