iCARH.plotBeta {iCARH} | R Documentation |
Postprocess and plot model parameters
Description
Group of functions to postprocess and plot model parameters of interest, compute WAIC (Watanabe-Akaike Information Criterion) and MADs (Mean Absolute Deviation) for posterior predictive checks and check normality assumptions.
Usage
iCARH.plotBeta(fit, indx = TRUE, indy = TRUE)
iCARH.plotARCoeff(fit, indx = TRUE)
iCARH.plotTreatmentEffect(fit, indx = TRUE)
iCARH.plotPathwayPerturbation(fit, path.names, indpath = TRUE)
iCARH.plotDataImputation(fit, indx = T, indy = T, plotx = T, ploty = T, ...)
iCARH.checkRhats(fit)
iCARH.checkNormality(fit)
iCARH.waic(fit)
iCARH.mad(fit)
Arguments
fit |
object returned by iCARH.model |
indx |
vector to specify X variables to plot. Selects all variables of X by default. |
indy |
vector to specify Y variables to plot. Selects all variables of Y by default. |
path.names |
pathway names |
indpath |
vector to specify pathways to plot. Selects all pathways by default. |
plotx |
plot X data imputation? |
ploty |
plot Y data imputation? |
... |
passed to ggplot2::geom_violin |
Value
the iCARH.plot[*]
functions return a ggplot graph object. iCARH.checkNormality
returns the normalized data.
iCARH.waic
and iCARH.mad
return corresponding waic (scalar) and mad (vector of J*(J+1)/2
) values.
iCARH.checkRhats
checks model convergence.
Functions
-
iCARH.plotBeta
: Plot boxplots of posterior densities of\beta
coefficients. -
iCARH.plotARCoeff
: Plot boxplots of posterior densities of theta (time effect) coefficients. -
iCARH.plotTreatmentEffect
: Plot boxplots of posterior densities of treatment effect coefficients. -
iCARH.plotPathwayPerturbation
: Plot posterior densities of pathway perturbation parameters -
iCARH.plotDataImputation
: Plot imputed values -
iCARH.checkRhats
: check model convergence and return Rhat coefficients -
iCARH.checkNormality
: Check normality assumptions. Returns normalized data and performs quantile-quantile plot -
iCARH.waic
: Compute Watanabe-Akaike Information Criterion (WAIC) -
iCARH.mad
: Compute MADs (Mean Absolute Deviation) between true covariance matrix and inferred covariance matrix for posterior predictive checks
Examples
data.sim = iCARH.simulate(4, 10, 14, 8, 2, path.probs=0.3, Zgroupeff=c(0,4),
beta.val=c(1,-1,0.5, -0.5))
XX = data.sim$XX
Y = data.sim$Y
Z = data.sim$Z
pathways = data.sim$pathways
rstan_options(auto_write = TRUE)
options(mc.cores = 2)
fit = iCARH.model(XX, Y, Z, groups=rep(c(0,1), each=5), pathways,
control = list(adapt_delta = 0.99, max_treedepth=10), iter = 2, chains = 2)
if(!is.null(fit$icarh))
gplot = iCARH.plotBeta(fit, indx=1:3, indy=1:2)