diff --git a/assets/stan_demos/ar_k.stan b/assets/stan_demos/ar_k.stan new file mode 100644 index 0000000..3de67f4 --- /dev/null +++ b/assets/stan_demos/ar_k.stan @@ -0,0 +1,16 @@ +data { + int K; // model order + int N; // dataset size + vector[N] y; +} +parameters { + real alpha; + row_vector[K] beta; + real sigma; +} +model { + for (n in (K+1):N) { + real mu = alpha + (beta * y[n-K:n]); + y[n] ~ normal(mu, sigma); + } +}