nhs-r-community / NHSRwaitinglist

R-package to implement the waiting list management approach described in this paper by Fong et al: https://www.medrxiv.org/content/10.1101/2022.08.23.22279117v1.full-text
https://nhs-r-community.github.io/NHSRwaitinglist/
Other
15 stars 0 forks source link

average_wait() function requires factor to be pre-calculated #36

Open kaituna opened 10 months ago

kaituna commented 10 months ago

I think this was touched upon at the last Teams meeting, but the function for 'average_wait' is actually the target mean wait required to achieve the specified waitlist performance criteria (is this correct?). Now that I am reading the documentation I think that there is some room for confusion and the code examples will make more sense if the function could be named 'mean_target_wait'.

I'm also thinking that instead of specifying a factor to achieve your desired performance % it would be better if you could specify the proportion and have the function do the factor calculation.

For example if I had a waitlist target of 95% of patients to be seen within 42 days I could call the function thus:

mean_target_wait(42,0.95)

This may have consequences for the other functions, but I think end users would assume they can just put their targets directly into the code without having to do some pre-calculations.

Apologies if I have misunderstood anything!

ThomUK commented 10 months ago

I think this was touched upon at the last Teams meeting, but the function for 'average_wait' is actually the target mean wait required to achieve the specified waitlist performance criteria (is this correct?). Now that I am reading the documentation I think that there is some room for confusion and the code examples will make more sense if the function could be named 'mean_target_wait'.

I tend to agree here. I wonder if there is room for a word like "equilibrium". Some of the functions (including this one) describe an equilibrium (or target) state:

Some describe the system in whatever state it happens to be in:

And one describes the process of getting from an uncontrolled state to an equilibrium state:

ThomUK commented 10 months ago

I'm also thinking that instead of specifying a factor to achieve your desired performance % it would be better if you could specify the proportion and have the function do the factor calculation. For example if I had a waitlist target of 95% of patients to be seen within 42 days I could call the function thus: mean_target_wait(42,0.95)

This is a really interesting proposal. One that we should put to Neil.

kaituna commented 10 months ago

I think the same logic would have to be applied to the other functions so it is all coherent. For example, the target_queue_size() function would also need to accept inputs for demand, target wait, and % compliance:

#Target queue size for a service with weekly demand of 100 patients, waiting target of 6 weeks and 95% compliance
target_queue_size(demand = 100, target = 6, performance = 0.95)
kaituna commented 10 months ago

Looking at the paper it seems like we can calculate the factor thus:

Factor = log1/e(1-Target Performance)

Therefore to get the factor necessary to achieve a 95% compliance with the target we would have:

log1/e(1 - 0.95) = log1/e(0.05) = ~2.996

Is this correct??

ThomUK commented 10 months ago

@kaituna I think we have 2 issues combined into 1 here. It may be worth separating them out.

The compliance target spec questions may be best addressed to @neilwalton.

kaituna commented 10 months ago

@ThomUK Agreed, I have changed the title of this issue to focus on the factor calculation and logged a separate issue for the ambiguous function name (#37).

chrismainey commented 1 week ago

@neilwalton to review. May be sorted already through the evolution of the functions.