plot_trace: Trace plot the estimands of a 'bartCause::bartc()' model

View source: R/plot_trace.R

plot_traceR Documentation

Trace plot the estimands of a 'bartCause::bartc()' model

Description

Returns a ggplot of the estimated effect over each iteration of the model fit. This is used to visually assess the convergence of Markov chain Monte Carlo (MCMC) sampling. Chains should be well mixed such that no single color is notably separate from others.

Usage

plot_trace(.model, type = c("cate", "sate", "pate", "sigma"))

Arguments

.model

a model produced by 'bartCause::bartc()'

type

parameter to plot options are average treatment effects: 'cate', 'sate' and 'pate' as well as posterior predicitve uncertainty 'sigma'

Value

ggplot object

Author(s)

Joseph Marlo, George Perrett

Examples


data(lalonde)
confounders <- c('age', 'educ', 'black', 'hisp', 'married', 'nodegr')
model_results <- bartCause::bartc(
 response = lalonde[['re78']],
 treatment = lalonde[['treat']],
 confounders = as.matrix(lalonde[, confounders]),
 estimand = 'ate',
 commonSup.rule = 'none'
)
plot_trace(.model = model_results)


joemarlo/plotBart documentation built on May 31, 2024, 12:22 p.m.