Skip to contents

This function plots the moving average of a outcome variable

Usage

plot_convergence(
  df,
  outcome,
  block_size = 500,
  conv_limit = 0,
  breaks = NULL,
  variance = FALSE
)

Arguments

df

a dataframe.

outcome

character string. Name of variable of the dataframe for which to plot the moving average.

block_size

numeric. Define the number of iterations at which the mean outcome has to be defined and plotted.

conv_limit

numeric. Define the convergence limit, under which the relative change between block of iterations should lie.

breaks

numeric. Number of iterations at which the breaks should be placed on the plot. Default is NULL, hence a tenth of the length of the vector `outcome` is used.

variance

logical. Determine whether the variance of the vector should be plotted instead of the mean. Default is FALSE.

Value

A ggplot graph.

Examples

# Checking the moving average of the incremental QALYs using the example data.
data(df_pa)
plot_convergence(df = df_pa,
                 outcome = "inc_qaly"
                 )