cmu-delphi / epipredict

Tools for building predictive models in epidemiology.
https://cmu-delphi.github.io/epipredict/
Other
8 stars 8 forks source link

Can we improve `dist_quantile` printing when 0.5 quantile level is not present? #305

Closed dshemetov closed 2 months ago

dshemetov commented 3 months ago

When 0.5 quantile is not present, the object is printed like this

r$> new_quantiles(c(1,2),c(0.1,0.2))
quantiles(NA)[2]
r$> new_quantiles(c(1,2),c(0.1,0.5))
quantiles(2)[2]

Can we improve this somehow?

dajmcdon commented 3 months ago

That printing error is a bit more subtle, it's if the median can't reasonably be computed. This currently happens if (a) 0.5 doesn't exist and (b) the available quantile_levels don't straddle 0.5.

new_quantiles(c(1, 2), c(0.1, 0.9))
#> quantiles(1.5)[2]
dshemetov commented 3 months ago

Gotcha thanks for that detail.