-
Notifications
You must be signed in to change notification settings - Fork 3
Description
When calculating vincent ensembles, if the projection ever reports the same value for all quantiles in a specific grouping, the vincent function throws the error "'quant_vals' not found."
In the files attached, there is one subset that triggers this error in vincent (several of the groupings report 1 unique value for all quantiles) and another subset that does not trigger the error (all groups report more than 1 unique value for all quantiles).
Using this file to illustrate the issue:
ExcelVincente_issue_example.xlsx
And using the subsequent code:
`data <- read_excel("Vincente_issue_example.xlsx")
####version of quant_old that does not work in Vincente function
quant_old_bad<-quant_old_example %>%filter(model=="A" | model=="B")
###in quant_old_bad, there are instances where all the quantiles for one location, model, age_group report the same value. In quant_old_bad_unique this is represented when the last column has a value=1
quant_old_bad_unique<-quant_old_bad%>%group_by(model, location_name.x,age_group, population.y, scenario_id, value_r)%>%summarise(unique.value=length(unique(quantile.value)))
vincent function not working. throwing error:"quant_vals not found"
vincent_not_working=aggregate_cdfs(data=quant_old_bad %>% dplyr::rename(value=quantile.value),
id_var = "model",
group_by = c("location_name.x", "age_group", "population.y",
"scenario_id","value_r"),
method = "vincent",
ret_quantiles = quantile.vec)
####Following subset does work in vincente function:
####version of quant_old that does not work:
quant_old_good<-quant_old_example%>%filter(age_group=="0-130" &(model=="C" | model=="B"))
###in quant_old_good, there is high variability in quantiles
quant_old_good_unique<-quant_old_good%>%group_by(model, location_name.x,age_group, population.y, scenario_id, value_r)%>%summarise(unique.value=length(unique(quantile.value)))
vincent function works here
vincent_working=aggregate_cdfs(data=quant_old_good %>% dplyr::rename(value=quantile.value),
id_var = "model",
group_by = c("location_name.x", "age_group", "population.y",
"scenario_id","value_r"),
method = "vincent",
ret_quantiles = quantile.vec)`