plotHistTrace {fkbma} | R Documentation |
Generate Histogram and Trace Plots for MCMC Samples
Description
This internal function creates histogram or trace plots for MCMC samples from an rjMCMC
model,
displaying the posterior distributions or sampling trajectories of specified variables.
Usage
plotHistTrace(
results,
variables = NULL,
sample_type = "fitted",
effect_type = "exposure_effect",
plot_type = "cred",
aux_vars = list(),
facet_by = NULL
)
Arguments
results |
A fitted model object from |
variables |
A vector of variable names to include in the plot, representing the estimand or covariates of interest. |
sample_type |
Character string specifying the sample type: |
plot_type |
Character string specifying the plot type: |
aux_vars |
A list of auxiliary variables and their values. Used to generate data for |
facet_by |
A vector of variable names to facet by in the plot. Automatically set to binary model variables if |
Details
-
Sample and Plot Compatibility:
For
sample_type = "estimand"
, onlyplot_type = "hist"
or "trace" is compatible, as it represents the posterior distribution or MCMC trajectory of individual parameters.For
sample_type = "fitted"
or"predictive"
, this function plots either the main effect (no interaction with exposure) or exposure effect for an individual using auxiliary variable values.
-
Effect Types:
For
sample_type = "fitted"
or"predictive"
,"outcome"
generates plots without exposure interaction, and"exposure_effect"
plots the interaction effect with exposure.
Value
A ggplot2
object displaying histograms or trace plots of the MCMC samples.
Note
This is an internal function not intended for direct use by package users.