Skip to contents

This function plots the results of the deterministic sensitivity analyses (DSA) in a Tornado diagram.

Usage

plot_tornado(df, df_basecase, outcome)

Arguments

df

a dataframe. This dataframe should contain the results of the function dsa_lm_metamodel.

df_basecase

a dataframe. This object should contain the original probabilistic analysis inputs and outputs, and the variable defined in `outcome`.

outcome

character. Name of the output variable of the DSA.

Value

A ggplot graph.

Details

The code to draw the Tornado diagram was obtained from https://stackoverflow.com/questions/55751978/tornado-both-sided-horizontal-bar-plot-in-r-with-chart-axes-crosses-at-a-givenStakoverflow. The `df` object should contain the following variables; "Parameters" (the parameters to include in the Tornado diagram), "Lower_Bound" (the model outcomes when using the lower bound of the parameter value), "Upper_Bound" (the model outcomes when using the upper bound of the parameter value).

Examples

# Fitting meta model with two variables using the summary data
data(df_pa)
lm_res_2 <- fit_lm_metamodel(df = df_pa,
                 y = "Inc_QALY",
                 x = c("p_pfsd", "p_pdd")
                 )
#> Error in fit_lm_metamodel(df = df_pa, y = "Inc_QALY", x = c("p_pfsd",     "p_pdd")): argument 3 matches multiple formal arguments

# Estimating DSA inputs
df_res_dsa <- dsa_lm_metamodel(df = df_pa,
                               lm_metamodel = lm_res_2)
#> Error in eval(expr, envir, enclos): object 'lm_res_2' not found

# Plotting Tornado diagram
plot_tornado(df = df_res_dsa,
             df_basecase = df_pa,
             outcome = "Inc_QALY")
#> Error in eval(expr, envir, enclos): object 'df_res_dsa' not found