diag.plot: Diagnostic plot to examine model fit

View source: R/diag.plot.R

diag.plotR Documentation

Diagnostic plot to examine model fit

Description

Function to produce plot based on different diagnostic statistics

Usage

diag.plot(x, diag = "Rhat", text = TRUE)

Arguments

x

a bmeta object with results of the model

diag

diagnostic statistics to be used—either the Gelman-Rubin statistic (Rhat) by default or effective sample size (n.eff)

text

should the name of the variables be shown in the graph (TRUE) or not (FALSE)

Value

A plot showing the relevant diagnostic stats for each node in the model

Author(s)

Tao Ding Gianluca Baio

Examples


### Read and format the data (binary)
data = read.csv(url("https://gianluca.statistica.it/software/bmeta/Data-bin.csv"))

### List data for binary outcome 
data.list <- list(y0=data$y0,y1=data$y1,n0=data$n0,n1=data$n1) 

### generate output using bmeta 
x <- bmeta(data=data.list,outcome="bin",model="std.norm",type="fix")

### run the diagnostic plot to examine the Gelman-Rubin statistic 
diag.plot(x)

### run the diagnostic plot to examine the effective sample size 
diag.plot(x,diag="n.eff")



giabaio/bmeta documentation built on May 4, 2023, 3:31 p.m.