plot_recovery: Plots to check parameter recovery

View source: R/plot_recovery.R

plot_recoveryR Documentation

Plots to check parameter recovery

Description

plot_recovery produces correlation plots between input and output parameter values, plus a confusability matrix.

Usage

plot_recovery(
  raw_pars,
  rec_pars,
  test = FALSE,
  affect = FALSE,
  alpha_par_nms = NULL,
  plot_together = TRUE,
  incl_legend = !plot_together,
  pal = NULL,
  font = "",
  font_size = 11
)

Arguments

raw_pars

Parameters outputted from simulate_QL().

rec_pars

cmdstanr::summary() containing the fitted parameter values for the relevant model.

test

Boolean indicating whether recovered parameters are from the test phase.

affect

Boolean indicating whether recovered parameters are from an affect model.

alpha_par_nms

Option to rename learning rate parameters, defaults to the names from par_df.

plot_together

If TRUE, returns a panel with all plots plotted, otherwise a named list of plots is returned.

incl_legend

Boolean indicating whether to include legends for affect parameter plots (for the question types).

pal, font, font_size

Same as plot_import().

Value

A named list of ggplot objects.

A list or grid of ggplots.

Examples

## Not run: 
dir.create("outputs/cmdstan/simulated_data")

train_sim_2a <- simulate_QL(
  sample_size = 10,
  alpha_pos_dens = c(shape = 2, scale = 0.1), # default
  alpha_neg_dens = c(shape = 2, scale = 0.1), # default
  beta_dens = c(mean = 3, sd = 1) # default
)

mcmc_2a_train_sim <- fit_learning_model(
  train_sim_2a$sim, model = "2a", exp_part = "training",
  vb = FALSE, model_checks = FALSE, par_recovery = TRUE,
  outputs = c("raw_df", "stan_datalist", "summary", "draws_list"),
  out_dir = "outputs/cmdstan/simulated_data"
)

plot_recovery(train_sim_2a$pars, mcmc_2a_train_sim$summary)

## End(Not run)


qdercon/pstpipeline documentation built on June 1, 2025, 1:11 p.m.