# NOT RUN {
##
## Example: Fit multivariate NP model to SOI/Recruitment series:
##
data <- cbind(as.numeric(astsa::soi-mean(astsa::soi)),
as.numeric(astsa::rec-mean(astsa::rec)) / 50)
data <- apply(data, 2, function(x) x-mean(x))
# If you run the example be aware that this may take several minutes
print("example may take some time to run")
mcmc <- gibbs_vnp(data=data, Ntotal=10000, burnin=4000, thin=2)
# Visualize results
plot(mcmc, log=T)
##
## Example 2: Fit multivariate NP model to VMA(1) data
##
n <- 256
ma <- rbind(c(-0.75, 0.5), c(0.5, 0.75))
Sigma <- rbind(c(1, 0.5), c(0.5, 1))
data <- sim_varma(model=list(ma=ma), n=n, d=2)
data <- apply(data, 2, function(x) x-mean(x))
# If you run the example be aware that this may take several minutes
print("example may take some time to run")
mcmc <- gibbs_vnp(data=data, Ntotal=10000, burnin=4000, thin=2)
# Plot spectral estimate, credible regions and periodogram on log-scale
plot(mcmc, log=T)
# }
Run the code above in your browser using DataLab