Plot posterior densities of group summaries of individual parameters. The respondents can be grouped by any categorical variable and the function works whether the fitted model is of "MULTI"-type or not.
Arguments
- object
An instance of class
stanfitproduced byhbam().- par
Character: Name of the parameter to be plotted. One of the following:
"alpha","beta","abs_beta","lambda", or"chi". Defaults to"abs_beta", which means the absolute values of the draws for beta will be used. Further individual-level parameters like"eta"can be specified if these have been passed tohbam()via the argumentextra_parswhen fitting the model. (Note that homoskedastic models have no"eta"parameters and "NF"-type models have no"lambda"or"kappa"parameters.)- group_id
An optional vector that will be used to split the respondents into groups. The vector must either be as long as the number of rows in the original dataset, or as long as the number of respondents included in the analysis. If a
group_idwas previously supplied toprep_data()orhbam()and if nogroup_idis supplied here, the default is to use the existinggroup_id. If agroup_idis supplied here, it will be used instead of any previously supplied vector. Thegroup_idsupplied here does not have to coincide with thegroup_idused to fit a "MULTI"-type model: Any vector that can be used to group the respondents is allowed.- ascending_means
Logical: Should the groups be placed in ascending order based on their posterior means (
TRUE) or should they be ordered based on their names (FALSE)? Defaults toTRUE.- fill
Fill color. Passed on to
ggplot2::geom_density().- color
Color of outer lines. Passed on to
ggplot2::geom_density().- alpha
Number in [0,1]: Inverse level of transparency.
- ncol
Number of columns. The default uses a formula to have approximately ten subplots per column.
