CZ_ANOVA: RJMCMC convergence assessment of a single parameter

View source: R/functions.R

CZ_ANOVAR Documentation

RJMCMC convergence assessment of a single parameter

Description

This function creates an object of class CZ_ANOVA with the necessary information to plot the diagnostic graphics proposed by the \insertCiteCZ;textualconvRJMCMC criteria for a single parameter.

Usage

CZ_ANOVA(theta,chains,models,mcmciterations,nbatches,batchsize,confidence,division)

Arguments

theta

Observed values for the parameter in the different chains.

chains

Chain index for the observed parameter value. The number of iterations per chain must be equal.

models

Model index for the observed parameter value.

mcmciterations

For a given chain is the iteration index value.

nbatches

Numbers of batches. The standard value is 20.

batchsize

It is the size of a batch given by iterations in a chain/nbatches consecutive integer. The function disregard nbatches value in case both are available. There is only a need to supply the nbatches or batchsize value.

confidence

It is the confidence level for the upper bound of both potential scale reduction factors. The standard value is 0.95.

division

Division criteria to make the batches. If division="Batch" the batches are partitions with size=batchsize of the iterations set. If division="Sequential" all the batches will have size=number of iterations/2, with the first batch starting at first iteration and the others at iteration 1+(number of iterations/2)/nbatches. Standard is division="Batch".

Details

The function output can be different from \insertCiteCZ;textualconvRJMCMC criteria in cases that at least one model is visited only for some chains as the degrees of freedom are automatically calculated by aov function. We recommend not to use the original criteria from \insertCiteCZ;textualconvRJMCMC in the situation above and to use this function instead.

Value

An object of class CZ_ANOVA which saves a list for every batch with the summary of the ANOVA 1 model, the summary of the ANOVA 2 Model, the summary of the ANOVA 3 model, PSRF1, PSRF2, the upper bound of PSRF1, the upper bound of PSRF2, V, Wc, Wm, and WcWm. For more details see \insertCiteCZ;textualconvRJMCMC article.

Author(s)

Tiago Pereira Marques and Miriam Harumi Tsunemi

References

\insertAllCited

Examples

#Example 1

set.seed(634963)
#Create parameters observations for the 3 chains
#theta 1 - chains 1 ...
theta1<-rnorm(100000,mean=20,sd=1.5)
theta2<-rnorm(100000,mean=20,sd=1.5)
theta3<-rnorm(100000,mean=20,sd=1.5)
#Merge generate observations in theta object
theta<-c(theta1,theta2,theta3)
#Create chain index
chains<-c(rep(1,100000),rep(2,100000),rep(3,100000))
#Create model index
  #In these configuration there will be 3 models in
  #proportions 1:2:1
models<-factor(sample(c(1,2,3),300000,TRUE,c(0.25,0.5,0.25)))
#Create iterations index
mcmciterations<-rep(seq(1:100000),3)
#Create CZ_ANOVA object and save to test 1
teste_1<-CZ_ANOVA(theta,chains,models,mcmciterations)

TPMarques/RJCA documentation built on Feb. 22, 2024, 8:05 p.m.