brmViolin {pcvr} | R Documentation |
Function to visualize hypotheses tested on brms models similar to those made using growthSS outputs.
Description
Function to visualize hypotheses tested on brms models similar to those made using growthSS outputs.
Usage
brmViolin(fit, ss, hypothesis)
Arguments
fit |
A brmsfit object or a dataframe of draws. If you need to combine multiple models then use combineDraws to merge their draws into a single dataframe for testing. |
ss |
A |
hypothesis |
A hypothesis expressed as a character string in the style of that used by
|
Value
Returns a ggplot showing a brms model's posterior distributions as violins and filled by posterior probability of some hypothesis.
Examples
set.seed(123)
simdf <- growthSim(
"logistic",
n = 20, t = 25,
params = list("A" = c(200, 180, 190, 160), "B" = c(13, 11, 10, 10), "C" = c(3, 3, 3.25, 3.5))
)
ss <- growthSS(
model = "logistic", form = y ~ time | id / group, sigma = "int",
list("A" = 130, "B" = 10, "C" = 3),
df = simdf, type = "brms"
)
fit <- fitGrowth(ss, backend = "cmdstanr", iter = 500, chains = 1, cores = 1)
brmViolin(fit, ss, ".../A_groupd > 1.05") # all groups used
brmViolin(fit, ss, "A_groupa/A_groupd > 1.05") # only these two groups