Data frames specified in arguments df_data, df_signal, df_fit, and df_fit_err must have a format where

  • the first column is the grouping factor (usually id)

  • the second column is the x-axis variable (usually age)

  • a column named y must contain the y-axis variable (not for df_fit_err)

  • a column named lower (upper) must contain the lower (upper) bound of error bar (only for df_fit_err)

  • a column named draw must be a factor that specifies the posterior draw using which the fit has been computed (only for df_fit)

plot_api_g(
  df_data,
  df_signal = NULL,
  df = NULL,
  df_err = NULL,
  teff_signal = NULL,
  teff_obs = NULL,
  i_test = NULL,
  color_signal = color_palette(2)[1],
  color = color_palette(2)[2],
  color_err = colorset("red", "light_highlight"),
  color_vlines = colorset("gray", "mid_highlight"),
  alpha = 1,
  alpha_err = 0.5,
  nrow = NULL,
  ncol = NULL,
  y_transform = function(x) x
)

Arguments

df_data

A data frame containing the observations.

df_signal

A data frame containing the true signal. Omitted if NULL.

df

A data frame containing the model fit, or a list of data frames. The list version can be used for example so that each list element corresponds to the fit computed using one parameter draw. Omitted if NULL.

df_err

A data frame containing error bars. Omitted if NULL. Must be NULL if df_fit is a list.

teff_signal

A named vector containing true effect times used to generate the signal. Omitted if NULL.

teff_obs

A named vector containing observed effect times. Omitted if NULL.

i_test

Indices of test points.

color_signal

Line color for true signal.

color

Line color for model fit.

color_err

Color of the error ribbon.

color_vlines

Two line colors for vertical lines (true and obs. effect time).

alpha

Line opacity for model fit.

alpha_err

Opacity of the error ribbon.

nrow

number of rows, an argument for facet_wrap

ncol

number of columns, an argument for facet_wrap

y_transform

A function to be applied to the third column of df_data.

Value

A ggplot object.

See also

Other internal plot API functions: plot_api_c()