Learn R Programming

zoib (version 1.0)

check.psrf: Convergence Check for Markov Chain Monte Carlo simulations via Potential Scale Reduction Factor

Description

Computes and summarizes univariate potential scale reduction factor; checks whether the multivariate potential scale reduction factor can be calculated.

Usage

check.psrf(post1 = NULL, post2 = NULL, post3 = NULL, post4 = NULL, post5 = NULL, 
save=FALSE)

Arguments

post1
Monte Carlo Posterior draws (data frame) from the 1st Markov Chain.
post2
Monte Carlo Posterior draws (data frame) from the 2nd Markov Chain.
post3
Monte Carlo Posterior draws (data frame) from the 3rd Markov Chain.
post4
Monte Carlo Posterior draws (data frame) from the 4th Markov Chain.
post5
Monte Carlo Posterior draws (data frame) from the 5th Markov Chain.
save
A logical argument: whether the psrf plots are to be saved as a pdf file

Value

  • The function outputs
  • "psrf.pdf"A pdf file containing plots from gelman.plot( ).
  • "psrf_boxplot.pdf"A pdf file containing a box plot of the univaraite psrf values, and a box plot of the 95% upper bound of the univaraite psrf values from all model parameters.
  • "psrf.txt"a text file containin the univaraite psrf values and 95% confidence interval from all model parameters.
  • psrf.sunivaraite psrf values and the 95% confidence interval from all model parameters.
  • psrf.mmultivariate psrf if the covariance matrix of the parameters are positive definite.
  • psrf.s.summthe summary of the univariate psrf across parameter.

Details

Each argument is a dataframe, with each column representing a parameter from the model, and each row presenting a posterior draw on the parameters. The command takes up to 5 chains though it is not necessary to have 5 chain; but at least 2 chains are necessary.

See Also

zoib

Examples

Run this code
#\dontrun{
	post1= data.frame(cbind(rnorm(400,0,1), rbeta(400,2,3)))
	post2= data.frame(cbind(rnorm(400,0,1), rbeta(400,2,3)))
	check.psrf(post1,post2)
	#}

Run the code above in your browser using DataLab