# NOT RUN {
library(astsa)
# Fitting a seasonal arima model
mod1 = Sarima(birth,order = c(0,1,2),seasonal = c(1,1,1))
fit1 = varstan(mod1,iter = 500,chains = 1)
# Fitting a Dynamic harmonic regression
mod2 = Sarima(birth,order = c(0,1,2),xreg = fourier(birth,K=6))
fit2 = varstan(mod2,iter = 500,chains = 1)
# compute the Bayes factor
bayes_factor(fit1, fit2)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab