-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculated travel time to GPs, pharmacies, and sports facilities #16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the GP, pharmacies and sport centre scripts use almost identical logic, it would make a lot of sense to extract this code out into functions so that should a change need to be made, it can be made once.
GP_travel_time_fastest <- | ||
GP_travel_time |> | ||
select(-osm_id) |> # We don't need to know the GP ID for this | ||
group_by(sdz21_code) |> | ||
filter(travel_time_mins == min(travel_time_mins)) |> | ||
ungroup() |> | ||
distinct() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we calculate/use the fastest travel time here. Wouldn't something like the mean be better:
GP_travel_time |>
select(-osm_id) |>
summarize(travel_time_mins = mean(travel_time_mins), .by = "sdz21_code")
Or alternatively, the slowest travel time, so those most in need are covered by the analysis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because the England Health Index calculates average minimum distance to travel to the nearest GP/pharmacy/sports centre. Replicating that here, but with travel time instead of distance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the term "average minimum" unclear here. How can something be both an average and a minimum? Do we have access to any code or maths which shows how they calculate this?
I feel like the approach taken in this index isn't quite right. By taking the minimum, is this metric not sensitive to highly skewed left tails on the distribution of travel times? What do you think instead about taking the first quartile mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm reading "average minimum" as the average of the minimum travel times/distances for the neighbourhoods within a Local Authority. But appreciate it's unclear. As far as I'm aware, there aren't any detailed technical docs nor code published anywhere.
I take your point about skewed tails. I'll explore the data a bit more this week and have a think about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking through the other indicators included in the Health Index, many of them are averages (e.g. crude death rate, percentage of people with (physical health condition), crude crime rates, etc.). For consistency, I'm now wondering whether we should take the mean travel time from neighbourhoods (Super Data Zones, in this case) in each Local Authority. What do you think @MikeJohnPage ?
The travel times from each Super Data Zone to GPs, pharmacies and sports centres are relatively normally distributed:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you calculate this plot. Is this all travel times from all super data zones per local authority, or the minimum travel ttimes from all super data zones per local authority? I presume the former, but it isn't obvious.
To answer your question I think we need to know how the travel times are distributed within each super data zone. If they are normal, then yes the mean makes more sens than the minimum to me (i.e., I don't think we want to know the best case travel time scenario, but the average...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthewgthomas bumping this thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right - these are all the travel times from the centroid of each super data zone within each local authority. We don't know how travel times are distributed within a super data zone because we don't have any more spatially granular data (e.g. the equivalents of output areas).
@MikeJohnPage I've updated the code to calculate mean travel times. Once we merge these changes, I'll change the Scotland Health Index. |
No description provided.