Email discussion lists for the UK Education and Research communities

## BUGS@JISCMAIL.AC.UK

#### View:

 Message: [ First | Previous | Next | Last ] By Topic: [ First | Previous | Next | Last ] By Author: [ First | Previous | Next | Last ] Font: Proportional Font

#### Options

Subject:

Replies to "autocorellation"

From:

Date:

Thu, 6 Dec 2007 17:36:02 +0100

Content-Type:

text/plain

Parts/Attachments:

 text/plain (62 lines)
 ```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```