back

by apwheele·2y ago·view on hn ↗
Not SPC, but in a similar spirit usecase, I have code examples here of calculating confidence intervals around proportions in SQL, https://andrewpwheeler.com/2020/11/30/confidence-intervals-a...

I am one of the folks that for dashboarding prefer to push everything to SQL VIEWS and functions. So I use this to monitor proportions for different processes month to month, which may have error bars +/- five to ten percent.

It is technically not the right test to know if the process changed, but is useful by eye to know typical variation.

1 comments
I think the SPC tests for detecting process shift would be EWMA and Cusum. The code has EWMA support, but it relies on a function to work and so is tied directly to PostgreSQL.
Agreed a bit of different use cases. (Or maybe should say the SPC approach is a better/more principled approach, whereas this is an easy graphical approach and I don't need to worry about "resetting" the CUSUM.)

I use the binomial CIs in dashboarding scenarios, so if the user selects a different subset of data, all the graphs are auto-updated (on the SQL side). Which when you get people subset into tinier slices of data it becomes more important.

So if you can upfront identify the processes you want to monitor, then when flagged have this send an alert. That is better than a dashboard forcing people to click on stuff and hope they identify a anomaly in the process.

More dashboards need this I think. I’ve also added relative standard error values on aggregations before to serve as a reliability filter that doesn’t even show users data when they slice it too then.