0

General problem:

I am trying to visualize model estimates (coefficients) of a hierarchical generalized mixed model together with the factorial design of an experiment in one plot using R.

I do not intend to plot the predicted values for the response variables for different coefficient values (as discussed here), I intend to actually plot the coefficients from the model, as these are my DV. I also asked a related question (together with more background information, the model and an example figure; focusing on appropriatedness) on StackExchange Psychology & Neuroscience here, and another related question (focusing on data visualization) at StackExchange Cross Validated here.

Concrete Question:

One option would be to extract model parameters and sum up intercepts and estimates by hand/code. Are there recommondations on how to best accomplish it? My actual attempt would be

BROOM <- data.frame(broom.mixed::tidy(mymodel))
rownames(BROOM) <- BROOM$term
"combination of conditions A" <-  BROOM["(Intercept)", "estimate"]
"combination of conditions B" <-  BROOM["(Intercept)", "estimate"] +  BROOM["condition B", "estimate"]
...

and then assign the values "combination of conditions X" to corresponding cells of a dataframe, and use ggplot to plot it the way I use to plot descriptives. The code above works fine. I will add a minimal reproducible example at a later edit if needed. My question is quite general whether there are more efficient ways to call model parameters (lme4::glmer model) so that they can be used in calculations.

Any hints and answers would be appreciated.

atsi
  • 1
  • 2
  • This doesn't appear to be a specific programming question that's appropriate for Stack Overflow. If you have general questions about the appropriate use of various statistical methods or data visualization techniques, then you should ask such questions over at [stats.se] instead. You are more likely to get better answers there. At the very least question here should have a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to run and test the code. – MrFlick Oct 28 '21 at 17:21
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Oct 28 '21 at 17:39
  • @MrFlick Thank you much for your suggestions. I edited my question here and, as you suggested, asked an adapted version at [Cross Validated](https://stats.stackexchange.com/questions/550161/visualize-estimates-of-glmer-model-and-factorial-design-in-one-plot). I will provide a reproducible example in a later edit. – atsi Oct 28 '21 at 19:40

0 Answers0