if (requireNamespace("neojags", quietly = TRUE)){
neojags::load.neojagsmodule()
}
#> module neojags loaded
if (requireNamespace("neojags", quietly = TRUE)){
library(rjags)
}
#> Loading required package: coda
#> Linked to JAGS 4.3.2
#> Loaded modules: basemod,bugs,neojags
modelv <- jags.model(textConnection(mod), n.chains=1, inits = list(".RNG.name" = "base::Wichmann-Hill",".RNG.seed" = 314159))
#> Compiling model graph
#> Resolving undeclared variables
#> Allocating nodes
#> Graph information:
#> Observed stochastic nodes: 0
#> Unobserved stochastic nodes: 100
#> Total graph size: 103
#>
#> Initializing model
model <- jags.model(textConnection(model_string), data = list(x=c(x)),n.chains=2)
#> Compiling model graph
#> Resolving undeclared variables
#> Allocating nodes
#> Graph information:
#> Observed stochastic nodes: 100
#> Unobserved stochastic nodes: 4
#> Total graph size: 107
#>
#> Initializing model
summary(samples)
#>
#> Iterations = 1001:3000
#> Thinning interval = 1
#> Number of chains = 2
#> Sample size per chain = 2000
#>
#> 1. Empirical mean and standard deviation for each variable,
#> plus standard error of the mean:
#>
#> Mean SD Naive SE Time-series SE
#> mu 1.9984 0.01006 0.000159 0.000204
#> nu1 0.7443 0.06441 0.001018 0.002304
#> nu2 1.1678 0.15583 0.002464 0.005184
#> tau 0.9505 0.25700 0.004064 0.009835
#>
#> 2. Quantiles for each variable:
#>
#> 2.5% 25% 50% 75% 97.5%
#> mu 1.9787 1.9918 1.9984 2.0054 2.0182
#> nu1 0.6310 0.6983 0.7395 0.7849 0.8853
#> nu2 0.9065 1.0575 1.1560 1.2606 1.5152
#> tau 0.5373 0.7643 0.9222 1.0974 1.5286
model_string1 <- "
model {
d <- djskew.ep(0.5,2,2,2,2)
p <- pjskew.ep(0.5,2,2,2,2)
q <- qjskew.ep(0.5,2,2,2,2)
}
"
summary(samples1)
#>
#> Iterations = 1:2
#> Thinning interval = 1
#> Number of chains = 2
#> Sample size per chain = 2
#>
#> 1. Empirical mean and standard deviation for each variable,
#> plus standard error of the mean:
#>
#> Mean SD Naive SE Time-series SE
#> d 0.008864 0 0 0
#> p 0.001350 0 0 0
#> q 2.000000 0 0 0
#>
#> 2. Quantiles for each variable:
#>
#> 2.5% 25% 50% 75% 97.5%
#> d 0.008864 0.008864 0.008864 0.008864 0.008864
#> p 0.001350 0.001350 0.001350 0.001350 0.001350
#> q 2.000000 2.000000 2.000000 2.000000 2.000000