Skip to contents

This function plots the expected ranks of all proposals together with their xy

Usage

plot_er_distributions(
  get_mcmc_samples_result,
  n_proposals,
  name_er_or_theta = "rank_theta",
  er = TRUE,
  title = NULL,
  names_proposals = NULL,
  inner_credible = 0.5,
  outer_credible = 0.9,
  ylab = "Expected Ranks",
  number_fundable = NULL,
  outer_show = TRUE,
  size_pt = 1.75,
  size_outer = 0.5,
  size_inner = 2,
  alpha_inner = 0.5,
  alpha_outer = 1,
  proposal = "Proposal ",
  use_outer_inner = "inner",
  change_random_selection_to = NULL,
  change_rejected_to = NULL,
  change_accepted_to = NULL
)

Arguments

get_mcmc_samples_result

the mcmc samples

n_proposals

number of proposals in the panel / call

name_er_or_theta

the name of the parameter estimating the ranks (or the proposal effect) in the Bayesian Hierarchical model (default = "rank_thetta")

er

if TRUE then, the ER are plotted, otherwise the thetas (the proposal effects) are plotted. (default = TRUE)

title

title of the plot (default = NULL, no title).

names_proposals

names of the proposals to be written on the x-axis ticks. Note that the ordering has to be the same as the one they are given to the `get_mcmc_samples()` function (default = NULL, they are simply numerated).

inner_credible

percentage of the inner credible interval (default = .5)

outer_credible

percentage of the outer credible interval (default = .9)

ylab

The y axis label (default = "Expected Ranks") (default = NULL, no FL drawn).

number_fundable

number of proposals that can be funded

outer_show

should the outer credible interval be shown (default = TRUE)

size_pt

the size of the point estimate (mean, ER) (default = 1.5)

size_outer

the size of the line representing the outer CrI (default = .5)

size_inner

the size of the line representing the inner CrI (default = 2)

alpha_inner

alpha for the color of the inner CrI

alpha_outer

alpha for the color of the inner CrI

proposal

Word written infront of number (default = "Proposal")

use_outer_inner

should the inner or outer CRI be used for funding decisions (default = "inner")

change_random_selection_to

Should the "random selection" group be called something else; f.ex "tie group" (default = NULL)

change_rejected_to

Should the "rejected" group be called something else (default = NULL)

change_accepted_to

Should the "accepted" group be called something else (default = NULL)

Value

the result is a plot of the expected rank together with their credible intervals

Examples

data_panel1 <- get_mock_data() %>%
     filter(panel == "p1")
if (FALSE) {
mcmc_samples <- get_mcmc_samples(data = data_panel1,
                                 id_proposal = "application",
                                 id_assessor = "voter",
                                 grade_variable = "num_grade")
plot_er_distributions(mcmc_samples,
                      n_proposals = data_panel1 %>%
                           summarise(n = n_distinct(application)) %>%
                           pull(),
                      number_fundable = 5)
                      }