Original question:
I am a new WinBUGS user and I am using it to setup a multivelel model,
with time-series data for each group.
I would like to incorporate autocorrelation structure in the residuals
(AR(1) or ARMA(1)).
Is there some example I can follow to get an idea about how to implement this?
Replies:
a. From Bob OHara:
I think this paper explains the details:
Daniels & Pourahmadi (2002) Biometrika 89: 553-566.
b. From Fleischman, Steve J :
Here is some code I've used for AR(1) residuals in a simple linear
regression model. Dependent variable lnRS, independent variable S.
model {
lnalpha ~ dunif(0, 10)
beta ~ dunif(0, 10)
phi ~ dunif(-1,1)
sigma.white ~ dunif(0,10)
resid.red.0 ~ dnorm(0,tau.red)
for(y in 1:42) { lnRS[y] ~ dnorm(mean2.lnRS[y],tau.white) }
mean2.lnRS[1] <- mean1.lnRS[1] + phi * resid.red.0
for (y in 2:42) { mean2.lnRS[y] <- mean1.lnRS[y] + phi * resid.red[y-1] } #AR1
for(y in 1:42) { mean1.lnRS[y] <- lnalpha - beta * S[y] }
for(y in 1:42) { resid.red[y] <- lnRS[y] - mean1.lnRS[y] }
for(y in 1:42) { resid.white[y] <- lnRS[y] - mean2.lnRS[y] }
tau.white <- 1 / sigma.white / sigma.white
tau.red <- tau.white * (1-phi*phi)
sigma.red <- 1 / sqrt(tau.red)
}
-------------------------------------------------------------------
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
|