Introduction to the mtarm Package
Luis Hernando Vanegas
Sergio Alejandro Calderón
Luz Marina Rondón
Source:vignettes/Introduction.Rmd
Introduction.RmdMultivariate Threshold Autoregressive (TAR) models
The mtarm package provides a computational tool designed
for Bayesian estimation, inference, and forecasting in multivariate
Threshold Autoregressive (TAR) models. These models provide a versatile
approach for modeling nonlinear multivariate time series and include
multivariate Self-Exciting Threshold Autoregressive (SETAR) and Vector
Autoregressive (VAR) models as particular cases (Vanegas, Calderón V, and Rondón 2025). The
package accommodates a broad class of innovation distributions beyond
the Gaussian assumption, such as
Student-,
slash, symmetric hyperbolic, Laplace, contaminated normal, skew-normal,
and
skew-
distributions, thereby enabling robust modeling of heavy tails,
asymmetry, and other non-Gaussian characteristics.
Installation
Install from GitHub
remotes::install_github("lhvanegasp/mtarm")Install from CRAN
install.packages("mtarm")Application: Temperature, precipitation, and two river flows in Iceland
Dataset
The data are available in the object `iceland.rf` and were obtained from (Tong 1990), who provided a detailed description of the geographical and meteorological characteristics of the rivers and analyzed each series individually. Subsequently, (Tsay 1998) conducted a bivariate analysis of the same dataset. The focus is on the bivariate time series , where and denote the daily river flow (in cubic meters per second, ) of the Jökulsá Eystri and Vatnsdalsá rivers, respectively. The sample covers the period from 1972 to 1974, comprising 1095 observations. The exogenous variables include daily precipitation , measured in millimeters (), and temperature , measured in degrees Celsius (), both recorded at the meteorological station in Hveravellir. Precipitation corresponds to the accumulated rainfall from 9:00 A.M. of the previous day to 9:00 A.M. of the current day.
library(mtarm)
data(iceland.rf)
str(iceland.rf)
#> 'data.frame': 1096 obs. of 5 variables:
#> $ Vatnsdalsa : num 16.1 19.2 14.5 11 13.6 12.5 10.5 10.1 9.68 9.02 ...
#> $ Jokulsa : num 30.2 29 28.4 27.8 27.8 27.8 27.8 27.8 27.8 27.3 ...
#> $ Precipitation: num 8.1 4.4 7 0 0 0 1.9 1.2 0 0.1 ...
#> $ Temperature : num 0.9 1.6 0.1 0.6 2 0.8 1.4 1.3 2.2 0.1 ...
#> $ Date : Date, format: "1972-01-01" "1972-01-02" ...
summary(iceland.rf[,-5])
#> Vatnsdalsa Jokulsa Precipitation Temperature
#> Min. : 3.670 Min. : 22.00 Min. : 0.000 Min. :-22.4000
#> 1st Qu.: 6.100 1st Qu.: 26.70 1st Qu.: 0.000 1st Qu.: -4.2000
#> Median : 7.500 Median : 31.40 Median : 0.300 Median : 0.3000
#> Mean : 8.938 Mean : 41.15 Mean : 2.519 Mean : -0.4407
#> 3rd Qu.: 9.240 3rd Qu.: 50.90 3rd Qu.: 2.500 3rd Qu.: 3.9000
#> Max. :54.000 Max. :143.00 Max. :79.300 Max. : 13.9000
Model specification
Following (Tsay 1998), the series are modeled using a specification given by
where is the error term. The last 55 observations (from November 7 to December 31, 1974), corresponding to of the sample, are excluded from the estimation stage and reserved for out-of-sample forecast evaluation. The following code requests the estimation for the specification under Gaussian, Student-, and Laplace error distributions.
Parameter estimation
set.seed(09102)
fits <- mtar_grid(~ Jokulsa + Vatnsdalsa | Temperature | Precipitation,
data=iceland.rf, subset={Date<="1974-11-06"},
row.names=Date, nregim.min=2, nregim.max=2, p.min=15,
p.max=15, q.min=4, q.max=4, d.min=2, d.max=2,
n.burnin=5000, n.sim=4000, n.thin=2, ssvs=TRUE,
dist=c("Gaussian","Student-t","Laplace"),
plan_strategy="multisession")
fits
#>
#>
#> Sample size : 1026 time points (1972-01-16 to 1974-11-06)
#>
#> Output Series : Jokulsa | Vatnsdalsa
#>
#> Threshold Series (TS): Temperature
#>
#> Exogenous Series (ES): Precipitation
#>
#> Error Distribution : Gaussian, Laplace, Student-t
#>
#> Number of regimes : 2
#>
#> Deterministics : Intercept
#>
#> Autoregressive order : 15
#>
#> Maximum lag for ES : 4
#>
#> Maximum lag for TS : 2Model comparison using forecast accuracy measures
Adjusted within-sample
The following code requests Deviance Information Criterion (DIC) (Spiegelhalter et al. 2002, 2014) and Watanabe-Akaike Information Criterion (WAIC) (Watanabe 2010) values.
Out-of-sample with standard -step-ahead forecasting
In addition, the following code provides the median of the log-score (Good 1952), the Energy Score (ES) (Gneiting et al. 2008)—a multivariate extension of the Continuous Ranked Probability Score (CRPS)(Matheson and Winkler 1976; Grimit et al. 2006)—and the Absolute Percentage Error (APE), all computed from the observed and forecasted values for the last 55 observations.
newdata <- subset(iceland.rf, Date>"1974-11-06")
set.seed(09102)
oos <- out_of_sample(fits, newdata=newdata, n.ahead=nrow(newdata), FUN=median)
oos[,c(1,2,5,6)]
#> Log.Score Energy.Score Jokulsa.APE Vatnsdalsa.APE
#> Gaussian.2.15.4.2 3.797904 2.811035 5.652454 32.49836
#> Laplace.2.15.4.2 3.242485 1.833367 3.823622 15.61231
#> Student-t.2.15.4.2 3.545381 2.456398 3.676001 20.90241Out-of-sample with rolling-origin forecasting and fixed parameters
set.seed(09102)
oos2 <- out_of_sample(fits, newdata=newdata, n.ahead=nrow(newdata),
rolling=5, FUN=median)
for(i in 1:length(oos2)){
cat("\n",i,"-step-ahead\n")
print(oos2[[i]][,c(1,2,5,6)])
}
#>
#> 1 -step-ahead
#> Log.Score Energy.Score Jokulsa.APE Vatnsdalsa.APE
#> Gaussian.2.15.4.2 2.584186 1.2773363 1.5798016 7.274053
#> Laplace.2.15.4.2 1.296487 0.7563662 0.9070033 4.779227
#> Student-t.2.15.4.2 1.020333 0.7762098 0.9009402 5.917259
#>
#> 2 -step-ahead
#> Log.Score Energy.Score Jokulsa.APE Vatnsdalsa.APE
#> Gaussian.2.15.4.2 3.032747 1.639617 2.301814 11.871226
#> Laplace.2.15.4.2 2.093742 1.085154 1.556983 5.577137
#> Student-t.2.15.4.2 1.968642 1.213108 1.447799 6.566068
#>
#> 3 -step-ahead
#> Log.Score Energy.Score Jokulsa.APE Vatnsdalsa.APE
#> Gaussian.2.15.4.2 3.223748 1.850762 2.926733 14.934488
#> Laplace.2.15.4.2 2.378543 1.239162 2.010924 6.609058
#> Student-t.2.15.4.2 2.305891 1.466251 1.926638 8.003508
#>
#> 4 -step-ahead
#> Log.Score Energy.Score Jokulsa.APE Vatnsdalsa.APE
#> Gaussian.2.15.4.2 3.333167 1.968623 3.509917 17.344735
#> Laplace.2.15.4.2 2.566196 1.361887 2.329828 6.406729
#> Student-t.2.15.4.2 2.616427 1.691429 2.414252 7.173568
#>
#> 5 -step-ahead
#> Log.Score Energy.Score Jokulsa.APE Vatnsdalsa.APE
#> Gaussian.2.15.4.2 3.405086 2.079208 3.701430 19.487190
#> Laplace.2.15.4.2 2.703894 1.457582 2.616441 7.007454
#> Student-t.2.15.4.2 2.828487 1.838202 2.802228 9.591203Summary of the best model
summary(fits[["Laplace.2.15.4.2"]])
#>
#>
#> Sample size : 1026 time points (1972-01-16 to 1974-11-06)
#>
#> Output Series (OS) : Jokulsa | Vatnsdalsa
#>
#> Threshold Series (TS): Temperature with a estimated delay equal to 0
#>
#> Exogenous Series (ES): Precipitation
#>
#> Error Distribution : Laplace
#>
#> Number of regimes : 2
#>
#> Deterministics : Intercept
#>
#> Autoregressive orders: 15 in each regime
#>
#> Maximum lags for ES : 4 in each regime
#>
#> Maximum lags for TS : 2 in each regime
#>
#>
#> Thresholds (Mean, HDI.Lower, HDI.Upper)
#>
#> Regime 1 (-Inf,-0.44847] (-Inf,-0.49438] (-Inf,-0.40256]
#> Regime 2 (-0.44847,Inf) (-0.49438,Inf) (-0.40256,Inf)
#>
#>
#> Regime1:
#> OS.lag(1) OS.lag(2) OS.lag(3) OS.lag(4) OS.lag(5) OS.lag(6) OS.lag(7)
#> SSVS 1 1 0.04 0.28 0.02 0.43 0.01
#> OS.lag(8) OS.lag(9) OS.lag(10) OS.lag(11) OS.lag(12) OS.lag(13) OS.lag(14)
#> SSVS 0 0.02 0.2 0.02 0 0.01 0.22
#> OS.lag(15) ES.lag(1) ES.lag(2) ES.lag(3) ES.lag(4) TS.lag(1) TS.lag(2)
#> SSVS 0.12 0 0 0 0 0.03 0.05
#>
#> Autoregressive coefficients
#> Mean 2(1-PD) HDI.Lower HDI.Upper Mean
#> (Intercept) 4.52327 0.00001 3.51623 5.56107 | 1.21217
#> Jokulsa.lag( 1) 0.77101 0.00001 0.65580 0.87775 | -0.08284
#> Vatnsdalsa.lag( 1) 0.29727 0.00001 0.17679 0.41320 | 1.08650
#> Jokulsa.lag( 2) -0.00333 0.90550 -0.06202 0.05971 | 0.04302
#> Vatnsdalsa.lag( 2) -0.24739 0.00200 -0.36654 -0.12501 | -0.21791
#> 2(1-PD) HDI.Lower HDI.Upper
#> (Intercept) 0.00050 0.73774 1.67706
#> Jokulsa.lag( 1) 0.00050 -0.12881 -0.03549
#> Vatnsdalsa.lag( 1) 0.00001 0.98105 1.18322
#> Jokulsa.lag( 2) 0.01150 0.00927 0.07605
#> Vatnsdalsa.lag( 2) 0.00001 -0.30260 -0.13781
#>
#> Scale parameter (Mean, HDI.Lower, HDI.Upper)
#> Jokulsa Vatnsdalsa Jokulsa Vatnsdalsa Jokulsa Vatnsdalsa
#> Jokulsa 0.15963 0.02514 . 0.12522 0.01188 . 0.20057 0.03827
#> Vatnsdalsa 0.02514 0.06126 . 0.01188 0.04583 . 0.03827 0.07652
#>
#>
#> Regime2:
#> OS.lag(1) OS.lag(2) OS.lag(3) OS.lag(4) OS.lag(5) OS.lag(6) OS.lag(7)
#> SSVS 1 1 0.65 0 0 0 0
#> OS.lag(8) OS.lag(9) OS.lag(10) OS.lag(11) OS.lag(12) OS.lag(13) OS.lag(14)
#> SSVS 0 0 0 0 0 0 0
#> OS.lag(15) ES.lag(1) ES.lag(2) ES.lag(3) ES.lag(4) TS.lag(1) TS.lag(2)
#> SSVS 0 0 0 0 0 1 1
#>
#> Autoregressive coefficients
#> Mean 2(1-PD) HDI.Lower HDI.Upper Mean
#> (Intercept) 1.59507 0.00200 0.69771 2.59283 | 0.56925
#> Jokulsa.lag( 1) 1.07990 0.00001 1.00905 1.15349 | -0.00026
#> Vatnsdalsa.lag( 1) 0.57932 0.00050 0.33541 0.81015 | 1.16172
#> Jokulsa.lag( 2) -0.20992 0.00001 -0.31271 -0.11674 | 0.00344
#> Vatnsdalsa.lag( 2) -0.51318 0.02100 -1.00275 -0.05125 | -0.34241
#> Jokulsa.lag( 3) -0.01469 0.58150 -0.06674 0.04094 | -0.01004
#> Vatnsdalsa.lag( 3) 0.33952 0.00150 0.15257 0.61809 | 0.16776
#> Temperature.lag(1) 1.11876 0.00001 0.90525 1.34375 | 0.05031
#> Temperature.lag(2) -0.65916 0.00001 -0.85308 -0.45923 | -0.05447
#> 2(1-PD) HDI.Lower HDI.Upper
#> (Intercept) 0.00001 0.32663 0.79163
#> Jokulsa.lag( 1) 0.98150 -0.01345 0.01326
#> Vatnsdalsa.lag( 1) 0.00001 1.09323 1.23958
#> Jokulsa.lag( 2) 0.71200 -0.01303 0.02141
#> Vatnsdalsa.lag( 2) 0.00001 -0.50961 -0.15745
#> Jokulsa.lag( 3) 0.08550 -0.02103 0.00082
#> Vatnsdalsa.lag( 3) 0.00001 0.10495 0.26135
#> Temperature.lag(1) 0.01650 0.01020 0.09275
#> Temperature.lag(2) 0.00300 -0.09647 -0.01850
#>
#> Scale parameter (Mean, HDI.Lower, HDI.Upper)
#> Jokulsa Vatnsdalsa Jokulsa Vatnsdalsa Jokulsa Vatnsdalsa
#> Jokulsa 5.55932 0.32459 . 4.60081 0.20358 . 6.52985 0.44953
#> Vatnsdalsa 0.32459 0.31072 . 0.20358 0.26144 . 0.44953 0.36323
#> Residuals
res <- residuals(fits[["Laplace.2.15.4.2"]])
par(mfrow=c(1,2))
qqnorm(res[["full"]], pch=20, col="blue", main="")
abline(0, 1, lty=3)
hist(res[["full"]], freq=FALSE, xlab="Quantile-type residual",
ylab="Density", main="")
curve(dnorm(x), col="blue", add=TRUE)

Forecasting
pred <- predict(fits[["Laplace.2.15.4.2"]], newdata=newdata,
n.ahead=nrow(newdata), row.names=Date, credible=0.8)
head(pred$summary)
#> Jokulsa.Mean Jokulsa.Lower Jokulsa.Upper Vatnsdalsa.Mean
#> 1974-11-07 20.90878 13.411187 28.81527 6.834375
#> 1974-11-08 21.05299 9.664738 34.06857 6.934579
#> 1974-11-09 22.72315 13.680595 33.14910 7.217351
#> 1974-11-10 23.78405 16.298941 31.40126 7.299724
#> 1974-11-11 24.83764 19.000067 31.43418 7.428469
#> 1974-11-12 25.07040 19.866111 30.16559 7.256866
#> Vatnsdalsa.Lower Vatnsdalsa.Upper
#> 1974-11-07 5.021734 8.633821
#> 1974-11-08 4.189863 10.025282
#> 1974-11-09 4.336131 10.182200
#> 1974-11-10 4.351673 10.005718
#> 1974-11-11 4.559769 10.052750
#> 1974-11-12 4.612109 9.806307
tail(pred$summary)
#> Jokulsa.Mean Jokulsa.Lower Jokulsa.Upper Vatnsdalsa.Mean
#> 1974-12-26 25.60095 22.71138 27.99992 5.865634
#> 1974-12-27 25.57809 22.96257 28.18443 5.862626
#> 1974-12-28 25.58518 23.04160 28.28370 5.857756
#> 1974-12-29 25.60750 22.95674 28.14790 5.865459
#> 1974-12-30 25.60785 22.88612 28.06214 5.865358
#> 1974-12-31 25.62957 22.97055 28.22797 5.842145
#> Vatnsdalsa.Lower Vatnsdalsa.Upper
#> 1974-12-26 3.861787 8.194346
#> 1974-12-27 3.630560 8.033291
#> 1974-12-28 3.604011 7.983446
#> 1974-12-29 3.631105 8.013411
#> 1974-12-30 3.659647 8.036238
#> 1974-12-31 3.650581 7.946888Summary statistics
fitmcmc <- coda::as.mcmc(fits[["Laplace.2.15.4.2"]])
summary(fitmcmc)
#>
#>
#> Iterations = 5001:12999
#>
#> Thinning interval = 2
#>
#> Sample size per chain = 4000
#>
#> Thresholds:
#> Mean Sd Sd(Mean) 2.5% 25% 50% 75%
#> Threshold.1 -0.44847 0.029051 0.0012974 -0.49545 -0.472 -0.44829 -0.42508
#> 97.5%
#> Threshold.1 -0.40322
#>
#>
#> Regime 1
#>
#>
#> Autoregressive coefficients:
#> Mean Sd Sd(Mean) 2.5%
#> Jokulsa:(Intercept) 4.5232663 0.549390 0.03784471 3.5989013
#> Vatnsdalsa:(Intercept) 1.2121652 0.241025 0.00957483 0.7403184
#> Jokulsa:Jokulsa.lag( 1) 0.7710093 0.057605 0.00348468 0.6476008
#> Vatnsdalsa:Jokulsa.lag( 1) -0.0828399 0.024016 0.00080667 -0.1323538
#> Jokulsa:Vatnsdalsa.lag( 1) 0.2972719 0.060628 0.00144518 0.1793622
#> Vatnsdalsa:Vatnsdalsa.lag( 1) 1.0865026 0.052748 0.00229988 0.9746227
#> Jokulsa:Jokulsa.lag( 2) -0.0033294 0.032301 0.00073881 -0.0641367
#> Vatnsdalsa:Jokulsa.lag( 2) 0.0430238 0.017330 0.00044453 0.0097343
#> Jokulsa:Vatnsdalsa.lag( 2) -0.2473945 0.062512 0.00284661 -0.3665407
#> Vatnsdalsa:Vatnsdalsa.lag( 2) -0.2179087 0.041992 0.00200789 -0.2988589
#> 25% 50% 75% 97.5%
#> Jokulsa:(Intercept) 4.159868 4.4710058 4.819705 5.740136
#> Vatnsdalsa:(Intercept) 1.056449 1.2096344 1.367168 1.679998
#> Jokulsa:Jokulsa.lag( 1) 0.738650 0.7758695 0.808087 0.873081
#> Vatnsdalsa:Jokulsa.lag( 1) -0.098745 -0.0824465 -0.066779 -0.037354
#> Jokulsa:Vatnsdalsa.lag( 1) 0.258489 0.2966336 0.335548 0.416860
#> Vatnsdalsa:Vatnsdalsa.lag( 1) 1.054176 1.0897296 1.123070 1.178829
#> Jokulsa:Jokulsa.lag( 2) -0.023571 -0.0036904 0.016285 0.058267
#> Vatnsdalsa:Jokulsa.lag( 2) 0.031575 0.0431486 0.054271 0.077065
#> Jokulsa:Vatnsdalsa.lag( 2) -0.288748 -0.2482934 -0.205662 -0.125011
#> Vatnsdalsa:Vatnsdalsa.lag( 2) -0.246201 -0.2181547 -0.190029 -0.133153
#>
#>
#> Scale parameter:
#> Mean Sd Sd(Mean) 2.5% 25% 50%
#> Jokulsa.Jokulsa 0.159631 0.0195985 0.00063185 0.120718 0.14839 0.159857
#> Jokulsa.Vatnsdalsa 0.025142 0.0067334 0.00020919 0.012864 0.02056 0.024963
#> Vatnsdalsa.Vatnsdalsa 0.061264 0.0081488 0.00030448 0.043378 0.05672 0.061545
#> 75% 97.5%
#> Jokulsa.Jokulsa 0.171538 0.197237
#> Jokulsa.Vatnsdalsa 0.029217 0.039574
#> Vatnsdalsa.Vatnsdalsa 0.066154 0.075921
#>
#>
#> Regime 2
#>
#>
#>
#> Autoregressive coefficients:
#> Mean Sd Sd(Mean) 2.5%
#> Jokulsa:(Intercept) 1.5950744 0.4866782 0.01254526 0.6240658
#> Vatnsdalsa:(Intercept) 0.5692453 0.1224997 0.00295270 0.3364976
#> Jokulsa:Jokulsa.lag( 1) 1.0798968 0.0378132 0.00112223 1.0133909
#> Vatnsdalsa:Jokulsa.lag( 1) -0.0002585 0.0069370 0.00030599 -0.0141654
#> Jokulsa:Vatnsdalsa.lag( 1) 0.5793169 0.1243080 0.00676481 0.3383020
#> Vatnsdalsa:Vatnsdalsa.lag( 1) 1.1617172 0.0386841 0.00105752 1.0961299
#> Jokulsa:Jokulsa.lag( 2) -0.2099242 0.0479443 0.00139261 -0.3114447
#> Vatnsdalsa:Jokulsa.lag( 2) 0.0034406 0.0087519 0.00023009 -0.0128809
#> Jokulsa:Vatnsdalsa.lag( 2) -0.5131848 0.2747070 0.04090219 -1.0067886
#> Vatnsdalsa:Vatnsdalsa.lag( 2) -0.3424101 0.1074206 0.01728081 -0.5180202
#> Jokulsa:Jokulsa.lag( 3) -0.0146910 0.0266602 0.00174071 -0.0683328
#> Vatnsdalsa:Jokulsa.lag( 3) -0.0100354 0.0053239 0.00030481 -0.0200775
#> Jokulsa:Vatnsdalsa.lag( 3) 0.3395239 0.1303270 0.01273838 0.1434232
#> Vatnsdalsa:Vatnsdalsa.lag( 3) 0.1677631 0.0448169 0.00567434 0.1002395
#> Jokulsa:Temperature.lag(1) 1.1187577 0.1113354 0.00323477 0.8863310
#> Vatnsdalsa:Temperature.lag(1) 0.0503070 0.0213888 0.00070939 0.0082298
#> Jokulsa:Temperature.lag(2) -0.6591592 0.1022778 0.00300431 -0.8515034
#> Vatnsdalsa:Temperature.lag(2) -0.0544666 0.0200279 0.00045545 -0.0944949
#> 25% 50% 75% 97.5%
#> Jokulsa:(Intercept) 1.2784933 1.60116882 1.9243651 2.5313755
#> Vatnsdalsa:(Intercept) 0.4883506 0.56613505 0.6468881 0.8061825
#> Jokulsa:Jokulsa.lag( 1) 1.0524123 1.07711812 1.1037520 1.1610065
#> Vatnsdalsa:Jokulsa.lag( 1) -0.0047912 -0.00016617 0.0044499 0.0129182
#> Jokulsa:Vatnsdalsa.lag( 1) 0.4956837 0.58138921 0.6646114 0.8166703
#> Vatnsdalsa:Vatnsdalsa.lag( 1) 1.1341441 1.15792894 1.1855017 1.2474463
#> Jokulsa:Jokulsa.lag( 2) -0.2387094 -0.20861005 -0.1806942 -0.1149627
#> Vatnsdalsa:Jokulsa.lag( 2) -0.0023298 0.00289562 0.0089215 0.0216544
#> Jokulsa:Vatnsdalsa.lag( 2) -0.7234544 -0.54535055 -0.2675414 -0.0519351
#> Vatnsdalsa:Vatnsdalsa.lag( 2) -0.4244335 -0.37135912 -0.2316756 -0.1621547
#> Jokulsa:Jokulsa.lag( 3) -0.0294963 -0.01349073 0.0050789 0.0397651
#> Vatnsdalsa:Jokulsa.lag( 3) -0.0137969 -0.01098968 -0.0070192 0.0019572
#> Jokulsa:Vatnsdalsa.lag( 3) 0.2448703 0.30820270 0.4250323 0.6138676
#> Vatnsdalsa:Vatnsdalsa.lag( 3) 0.1297460 0.16243302 0.2004100 0.2599303
#> Jokulsa:Temperature.lag(1) 1.0462141 1.12098133 1.1958726 1.3269358
#> Vatnsdalsa:Temperature.lag(1) 0.0357892 0.05017823 0.0647723 0.0918519
#> Jokulsa:Temperature.lag(2) -0.7301034 -0.66166113 -0.5907202 -0.4554723
#> Vatnsdalsa:Temperature.lag(2) -0.0678179 -0.05427415 -0.0408837 -0.0157641
#>
#>
#> Scale parameter:
#> Mean Sd Sd(Mean) 2.5% 25% 50% 75%
#> Jokulsa.Jokulsa 5.55932 0.498163 0.0110922 4.63424 5.21730 5.5437 5.88450
#> Jokulsa.Vatnsdalsa 0.32459 0.063650 0.0018542 0.20704 0.28026 0.3223 0.36611
#> Vatnsdalsa.Vatnsdalsa 0.31072 0.026534 0.0012651 0.26365 0.29227 0.3097 0.32780
#> 97.5%
#> Jokulsa.Jokulsa 6.57001
#> Jokulsa.Vatnsdalsa 0.45742
#> Vatnsdalsa.Vatnsdalsa 0.36590Convergence diagnostics
Geweke statistic
geweke_diagTAR(fits[["Laplace.2.15.4.2"]])
#>
#> Fraction in 1st window = 0.1
#>
#> Fraction in 2nd window = 0.5
#> Thresholds:
#> Threshold.1
#> -1.0478
#>
#>
#> Regime 1
#>
#>
#> Autoregressive coefficients:
#> Jokulsa Vatnsdalsa
#> (Intercept) -1.060107 -0.87372
#> Jokulsa.lag( 1) 0.386917 0.28273
#> Vatnsdalsa.lag( 1) -1.207216 0.86248
#> Jokulsa.lag( 2) -0.033279 -1.02879
#> Vatnsdalsa.lag( 2) 1.527347 0.56702
#>
#>
#> Scale parameter:
#> Jokulsa Vatnsdalsa
#> Jokulsa 0.42197 1.1215
#> Vatnsdalsa 1.12153 1.6051
#>
#>
#> Regime 2
#>
#>
#>
#> Autoregressive coefficients:
#> Jokulsa Vatnsdalsa
#> (Intercept) 3.16200 1.9862
#> Jokulsa.lag( 1) -2.50578 2.7219
#> Vatnsdalsa.lag( 1) 4.21032 1.9330
#> Jokulsa.lag( 2) 4.44698 2.8767
#> Vatnsdalsa.lag( 2) -3.74674 -3.5346
#> Jokulsa.lag( 3) -1.61489 1.8916
#> Vatnsdalsa.lag( 3) 3.15800 2.7724
#> Temperature.lag(1) 0.92370 -2.4338
#> Temperature.lag(2) 0.53083 2.3683
#>
#>
#> Scale parameter:
#> Jokulsa Vatnsdalsa
#> Jokulsa -0.58186 -2.3230
#> Vatnsdalsa -2.32302 -2.1004Effective sample size
effectiveSize_TAR(fits[["Laplace.2.15.4.2"]])
#> Thresholds:
#> Threshold.1
#> 501.38
#>
#>
#> Regime 1
#>
#>
#> Autoregressive coefficients:
#> Jokulsa Vatnsdalsa
#> (Intercept) 210.74 633.67
#> Jokulsa.lag( 1) 273.27 886.40
#> Vatnsdalsa.lag( 1) 1759.98 526.02
#> Jokulsa.lag( 2) 1911.51 1519.92
#> Vatnsdalsa.lag( 2) 482.25 437.37
#>
#>
#> Scale parameter:
#> Jokulsa Vatnsdalsa
#> Jokulsa 962.1 1036.11
#> Vatnsdalsa 1036.1 716.23
#>
#>
#> Regime 2
#>
#>
#>
#> Autoregressive coefficients:
#> Jokulsa Vatnsdalsa
#> (Intercept) 1504.959 1721.196
#> Jokulsa.lag( 1) 1135.324 513.953
#> Vatnsdalsa.lag( 1) 337.666 1338.098
#> Jokulsa.lag( 2) 1185.257 1446.768
#> Vatnsdalsa.lag( 2) 45.107 38.641
#> Jokulsa.lag( 3) 234.569 305.070
#> Vatnsdalsa.lag( 3) 104.674 62.381
#> Temperature.lag(1) 1184.625 909.068
#> Temperature.lag(2) 1158.977 1933.732
#>
#>
#> Scale parameter:
#> Jokulsa Vatnsdalsa
#> Jokulsa 2017.0 1178.38
#> Vatnsdalsa 1178.4 439.88