thibautjombart / covid19_bed_occupancy

Shiny app providing estimates of future bed occupancy given recent admissions
https://cmmid-lshtm.shinyapps.io/hospital_bed_occupancy_projections/
Other
12 stars 5 forks source link

Custom LoS distribution #71

Open samclifford opened 4 years ago

samclifford commented 4 years ago

We can continue to parametrise these in terms of mean and cv for users, but it might be worth considering asking if they want to use a Weibull via a drop-down menu. This would mean reworking los_gamma() to be a more general function that accepts an argument specifying whether the distribution to be used is one of gamma or weibull (or any other).

This would require checking which parameters are to be passed on to the distribution. There's no closed form solution for moment matching a weibull, but we have λ = μ/Γ(1 + 1/k) and then we solve the following for k: CV^2 - (Γ(1 + 2/k))/(Γ(1 + 1/k))^2 + 1 = 0 and substitute the result into the equation for λ

samclifford commented 4 years ago

Considering it might be worth adding a boxplot horizontally under the barplot that we visualise with in order to show more than just the 95% quantile. Gamma and Weibull with the same mean and variance will have different skewness and kurtosis and, probably more importantly, median. Could be useful visual feedback for user.

samclifford commented 4 years ago

And with this implemented it might be worth having the Zhou parameter sets provide feedback with the 95% CI under the selectInput.

samclifford commented 4 years ago

@pearsonca has mentioned that it might be worth moving towards using the same sort of approach to LoS distributions as gets reported in the studies cited by the LoS review paper. This is most often the 25%, 50% and 75% quantiles. Specifying three numbers for a two parameter distribution would require moving to a call to optim as was written for the LoS review. Might be a little more computationally intensive and you'd need to check the sanity of the slider values to ensure you don't specify a median outside the IQR. Alternatively we could just ask for the IQR and return the exact match. Might require a call to optim still, but at least we would be returning what they asked for.

samclifford commented 4 years ago

The weibull_IQR branch contains this now and is complete as of 3730d5cc183e6a062b9967925a547a39e3a6c813

samclifford commented 4 years ago

Feedback from authors of LoS review is to include the China distributions as well as the rest of the world. Added in c721730eea37bd6f9739f6e424678495da4249fc