| mlm_spaghetti_plot | R Documentation | 
Plot population-level fitted values and X values, for M and Y.
mlm_spaghetti_plot(
  mod = NULL,
  d = NULL,
  id = "id",
  x = "x",
  m = "m",
  y = "y",
  level = 0.95,
  n = 12,
  binary_y = FALSE,
  mx = "fitted",
  fixed = TRUE,
  random = TRUE,
  h_jitter = 0,
  v_jitter = 0,
  bar_width = 0.2,
  bar_size = 0.75,
  n_samples = NA
)
| mod | A multilevel mediation model estimated with  | 
| d | A  | 
| id | Name of id variable (identifying subjects) in data ( | 
| x | Name of X variable in  | 
| m | Name of M variable in  | 
| y | Name of Y variable in  | 
| level | X level for Credible Intervals. (Defaults to .95.) | 
| n | Number of points along X to evaluate fitted values on. See details. | 
| binary_y | Set to TRUE if the outcome variable (Y) is 0/1. | 
| mx | Should the X axis of the M-Y figure be "fitted" values, or "data" values. Defaults to "fitted". | 
| fixed | Should the population-level ("fixed") fitted values be shown? | 
| random | Should the subject-level ("random") fitted values be shown? | 
| h_jitter | Horizontal jitter of points. Defaults to 0. | 
| v_jitter | Vertical jitter of points. Defaults to 0. | 
| bar_width | Width of the error bars. Defaults to 0.2. | 
| bar_size | Thickness of the error bars. Defaults to 0.75. | 
| n_samples | Number of MCMC samples to use in calculating fitted values. See details. | 
If n = 2, the fitted values will be represented as points
with X
line with a Confidence Ribbon instead.
If a very large model is fitted with a large number of MCMC iterations,
the function might take a long time to run. In these cases, users can set
n_samples to a smaller value (e.g. 1000), in which case the fitted
values (and the CIs) will be based on a random subset of n_samples
MCMC samples. The default value is NA, meaning that all MCMC samples are
used.
A list of two ggplot2 objects.
Matti Vuorre mv2521@columbia.edu
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.