-
Notifications
You must be signed in to change notification settings - Fork 11
Description
When the DARTH framework is uses, it would be nice to show the sampled distributions in an illustrative way.
Example to get started with. But we can improve this
Melt the dataset
df_melt <- melt(df_psa_random, variable.name = "Parameter")
Create a new column to classify parameters by prefix
df_melt <- df_melt %>%
mutate(Group = case_when(
str_starts(Parameter, "p_") ~ "Probabilities",
str_starts(Parameter, "u_") ~ "Utilities",
str_starts(Parameter, "c_") ~ "Costs",
TRUE ~ "Other"
))
Optionally check the groups
table(df_melt$Group)
df_probs <- df_melt %>% filter(Group == "Probabilities")
Probabilities:
ggplot(df_probs, aes(x = value, y = Parameter)) +
geom_density_ridges(scale = 1.5, rel_min_height = 0.01) +
theme_bw(base_size = 14) +
ggtitle("Probabilities")
df_utils <- df_melt %>% filter(Group == "Utilities")
ggplot(df_utils, aes(x = value, y = Parameter)) +
geom_density_ridges(scale = 1.5, rel_min_height = 0.01) +
theme_bw(base_size = 14) +
ggtitle("Utilities")
df_costs <- df_melt %>% filter(Group == "Costs")
ggplot(df_costs, aes(x = value, y = Parameter)) +
geom_density_ridges(scale = 1.5, rel_min_height = 0.01) +
theme_bw(base_size = 14) +
ggtitle("Costs")
df_other <- df_melt %>% filter(Group == "Other")
ggplot(df_other, aes(x = value, y = Parameter)) +
geom_density_ridges(scale = 1.5, rel_min_height = 0.01) +
theme_bw(base_size = 14) +
ggtitle("Other")