Print

Print


Dear All:
         I have an AR(1) example via WinBUGS. Maybe you are interested in.
Many thanks to Professor Farrow.

Best Wishes,

Gary Gau
Math & Stat
Boston University
http://math.bu.edu/people/wgau
----- Original Message -----
>a simulated AR(1) series
>
> y_t = mu + phi*(y_t-1 - mu) + e_t
>
> with mu=10, phi=0.8 and var(e)=1.
>
> The other file contains a (classic) BUGS program which works with this
model and
> these data. The initial observation y_0 is taken as fixed, y_0=13. I took
a
> sample of 10000 phi values and, curiously, there was a little hump at the
upper
> end of the posterior distribution. Otherwise everything seems perfectly
OK.
>


----------------------------------------------------------------------------
----


>     13.0826
>     12.0263
>     13.2564
>     12.1181
>     11.3720
>     12.4619
>     11.2712
>     10.3401
>     10.2225
>      9.4269
>     10.8509
>      9.2491
>      8.1869
>      7.9515
>      7.9624
>      9.5700
>     11.4676
>      9.9282
>     10.0481
>      9.0173
>      9.2939
>      8.4095
>      8.0112
>      8.0132
>      9.1525
>     10.0040
>      8.9083
>      9.1437
>      9.6536
>     10.5645
>     11.2686
>      9.5324
>     10.0392
>      9.3548
>      8.5384
>      9.5017
>     10.3454
>      9.1905
>      8.9498
>      9.1033
>      8.2317
>      6.8483
>      8.05571
>      7.50762
>     5.86687
>     6.94436
>     9.50971
>     9.27238
>     9.46818
>     9.20724
>     7.54402
>     7.41957
>     7.38182
>     8.41263
>     8.31616
>     9.12996
>     9.86440
>     8.57547
>     9.81590
>     9.00445
>     9.43477
>     9.13524
>     9.06310
>      8.1533
>      8.2119
>      8.4364
>      8.4518
>      8.6679
>      9.0107
>      9.3537
>      9.8223
>     10.6041
>      8.8178
>     11.1377
>     11.3183
>     11.9031
>     11.1018
>      9.4257
>      8.8812
>      8.9565
>      8.0170
>      8.5344
>      9.1885
>      8.9057
>     10.1016
>     10.5212
>     10.6441
>     10.1745
>      8.4729
>      9.5725
>      8.7555
>      9.6180
>      8.4995
>      8.5272
>      8.1157
>      9.3125
>     10.0596
>     11.3611
>     10.3386
>     10.2119


----------------------------------------------------------------------------
----


> model ar1a;
>
> const N=100, y0=13;
>
> var     y[N], ymean[N], mu, phi, tau;
>
> data y in "ar1.dat";
>
> {
> ymean[1]<-mu + phi*(y0-mu);
> y[1]~dnorm(ymean[1],tau);
>
> for (i in 2:100) {
> ymean[i]<-mu + phi*(y[i-1]-mu);
> y[i]~dnorm(ymean[i],tau);
>                   }
>
> mu~dnorm(0,0.1);
> tau~dgamma(1,0.1);
> phi~dunif(-1,1);
>
> }