Skip to content

SUMM/ENH/Design overview control charts #8533

Open

Description

@josef-pkt

trying again for an overall design or design requirements for control chart
main original issue #4191 plus 2 PRs for earlier implementation

newer topics

  • control charts based on beta distribution or regression and other distributions on (0, 1) or [0, 1]
  • tolerance interval, currently only for poisson stats

traditional control charts
one letter or short names, x, u, p, np, c, u, xbar, ...., based on k * sigma limits
we can add it mainly for familiarity by users
almost one liners, but it would be good to have a collection
all that is needed is mean or expected value and variance of mean

more general and more interesting components

quantiles
use quantile estimate for control limits instead of k*sigma limits
either parametric or nonparametric/flexible distribution, misspecified model (eg. over dispersion)
with or without parameter uncertainty
simple example: one sample tolerance interval for Poisson
We could compare with QuantReg or M-quantiles using less restrictive distributional assumptions.

parameter estimation using clean data
fit assuming data does not have outliers or out of control observations
This can be either simple estimators like mean, or we connect to models, e.g. beta regression, or regression control charts.
Advantage of using models is that we have built-in inference, e.g. standard errors of parameter estimates, including misspecification robust inference, and get_distribution method.

parameter estimation and outlier detection using dirty data
fit assuming historical data might have outlier, out-of-control periods

  • robust estimation, currently we only have RLM, but nothing for discrete, nonlinear or link models.
  • outlier identification
    We have get_influence for some outlier candidate identification, but no robust estimation besides dropping outliers.
    GLM has freq_weights, that we could use to adaptively downweigh outlier candidates.
    We also need something for grouped outlier, e.g. several outlier periods in a row, need to look at outlier windows.
    We can also reuse control chart itself iteratively to identify outliers, e.g. if we have tolerance intervals, ppf, isf, quantiles

I did not look at implementation issues again.

We could start with Poisson, tolerance interval versus k-sigma limits versus quantreg.
With overdispersion and count distributions that are alternatives to Poisson.
Example: u-chart versus Laney u' Chart (u Prime) versus NBP or GPP, versus zero-inflated, ...
u prime chart adds heterogeneity in mean across batches, (a bit similar to meta-analysis correction for random effects), e.g. empirical standard deviation versus standard deviation implied by the distribution.
https://www.qimacros.com/control-chart-formulas/u-prime-chart-formula/

more difficult multi-link or multi distribution parameter models
e.g. equivalence to tolerance interval or quantiles under parameter uncertainty for BetaModel.

Activity

  1. added this to the 0.15 milestone on Nov 22, 2022
  2. josef-pkt commented on Nov 22, 2022

    @josef-pkt
    MemberAuthor

    meta: monitor or control the control chart

    If we use control charts based on predictive distribution properties using a specific model, then we need specification testing or model comparisons to choose the model appropriate for historical data.

    Similarly, we could base control charts on distributional properties other than a mean measure.
    E.g. a control chart for variance is also a monitor for the mean control chart. Even if mean stays unchanged, the control limits might change, i.e. we need to monitor for changes in the control limits.
    Other gof and specification measures could also be monitored to check whether the control chart and it's underlying distributional assumptions are still appropriate. Main problem is that many of those statistics require larger sample sizes, e.g. quantiles close to the tails, or higher order moments, or cdf in tails.

  3. josef-pkt commented on Nov 24, 2022

    @josef-pkt
    MemberAuthor

    possible class SigmaControlChart:
    generic class that uses k * sigma control charts, where sigma could be empirical or from model (poisson, binomial, normal, ...) and k is user given or ppf of standard normal.

    with different chart updating (method?) types

    • shewart: expected value of each observation
    • EWMA
    • CUSUM
    • MA
    • batched
    • ...
  4. josef-pkt commented on Nov 24, 2022

    @josef-pkt
    MemberAuthor

    two more on integration with models and stats

    • prediction/tolerance interval using predict which. What should be the api?
      • confint_obs or similar name as currently in OLS get_prediction, is extra when predicting mean, or
      • use separate which for prediction interval, e.g. predict="obs". disadvantage duplicate computation if we want confint and confint_obs
    • reusing 2 sample tests for batched control charts like xbar chart
      • consider historical sample and test sample as the 2indep samples, with null that they have the same mean. We can just call current functions directly.
      • asymmetric treatment of samples:
        Add shortcut for fixed reference sample to avoid recomputing statistics for it. e.g. summary data for reference sample, full data for test sample.
        Possibly or optionally, fix auxiliary parameters like variance to be only from reference sample
  5. josef-pkt commented on Aug 31, 2023

    @josef-pkt
    MemberAuthor

    again, semi-random design idea

    chart class (for independent, i.i.d. data, not sure what changes with cusum and emwa with moving limits):

    • __init__: method for control limits, optional historical data (phase 1)
      • method could be for fixed thresholds (e.g. 3 sigma), or
      • estimation method plus confint method (e.g. poisson tolerance interval)
      • possibly option for dirty (with out of control observations) or clean data (dirty data needs robust estimator)
    • update_fit: recompute control limits with possible new, updated phase 1 data, using same method as in __init__
    • get_limits: helper method (maybe attribute with also set_limits)
    • method to add phase 2 data
    • method to evaluate phase 2 data
    • plot method

    for univariate data (y, endog), we might need extra data, e.g. sample size for xbar, binomial, exposure for Poisson, ...
    plus exog for attribute charts, regression prediction intervals

    choice of distribution
    e.g. for count data, we could have any available model, poisson, binomial, negative binomial, zip, ...
    for continuous data, we could have normal, t, ...
    This is mainly relevant if we estimate control limits from quantile function, ppf (or tolerance interval)

    model diagnostics:
    If we estimate phase 1 parameters using a model, then returning its results would provide additional diagnostics for, e.g., goodness-of-fit.
    (simplest case: Poisson count chart for individual i.i.d. observations)

    (aside: if we trim outlying observations by threshold, then using truncated model would be more appropriate for estimation, e.g. tail truncated Poisson)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions