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
 LISTSERV Archives BUGS Home BUGS 2006

#### Options

Subject:

Implementing a DLM (or UCM-AR(2)) in BUGS

From:

Date:

Thu, 22 Jun 2006 09:17:40 +0100

Content-Type:

text/plain

Parts/Attachments:

 text/plain (66 lines)
 ```Dear BUGS users, I am trying to implement an unobserved components model (UCM) in BUGS. My model is a simple Gaussian UCM-AR(2): y(t)=mu(t)+psi(t) mu(t) ~ Random Walk psi(t)~ AR(2) While my estimated values for this model make sense using the maximum likelihood procedure, I get completely wrong values in BUGS. I must be doing  something wrong but I cannot figure out what it is. Could someone please give me some advice. Thanks, Tarik The BUGS code looks like this: model { for (t in 1:T){ y[t] <- yobs[t];#100*log(yobs[t]); } #observation model for (t in 1:T){ y[t]~dnorm(meany[t],10000); meany[t] <- mu[t] + psi[t]; } #state model for (t in 3:T){ # Random walk trend with drift mu[t] ~ dnorm(meanmu[t],tau.nu); meanmu[t] <-mu[t-1]+beta[t-1] ; # Random walk beta[t] ~ dnorm(meanbeta[t],tau.zeta); meanbeta[t] <- beta[t-1]; # Cycle psi[t] ~ dnorm(meanpsi[t],tau.kappa); meanpsi[t] <- phi1*psi[t-1]+phi2*psi[t-2]; } mu[1] ~ dnorm(6,.001); mu[2] ~ dnorm(mu[1],.001); beta[1] ~ dnorm(0,0.001); beta[2] ~ dnorm(0,0.001); psi[1] ~ dnorm(1,0.001); psi[2] ~ dnorm(psi[1],0.001); tau.nu ~ dgamma(0.1,0.1); tau.zeta ~ dgamma(0.1,0.1); tau.kappa ~ dgamma(0.1,0.1); phi1 ~ dnorm(1.5,0.01); phi2 ~ dnorm(-0.6,0.01); ------------------------------------------------------------------- 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 ```