labqc.proficiency¶
Proficiency-testing performance statistics (ISO 13528:2022, ISO/IEC 17043).
z = (x - x_pt) / sigma_pt zeta = (x - x_pt) / sqrt(u_x^2 + u_pt^2) E_n = (x - x_pt) / sqrt(U_x^2 + U_pt^2) (expanded uncertainties)
z and zeta: |score| <= 2 satisfactory, 2 < |score| < 3 questionable, |score| >= 3 unsatisfactory. E_n: |E_n| <= 1 satisfactory, otherwise not.
classify ¶
classify(score: float, kind: str = 'z') -> str
Interpret a score. kind is "z" (also for zeta) or "en".
Source code in src/labqc/proficiency.py
31 32 33 34 35 36 37 38 | |
robust_mean_sd ¶
robust_mean_sd(values, tol: float = 1e-06, max_iter: int = 100) -> tuple[float, float]
Algorithm A from ISO 13528 Annex C: robust mean and standard deviation.
Useful when the assigned value is the consensus of participants.
Source code in src/labqc/proficiency.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
pt_history ¶
pt_history(df: DataFrame, date_col: str = 'date', z_col: str = 'z') -> pd.DataFrame
Review z-scores across PT rounds, one row per round, oldest first.
Control-chart rules applied to a laboratory's z-scores over time:
two_beyond_2 |z| > 2 in this round and the one before (any side): a repeated questionable result needs action even though each round alone is only questionable. trend_9 nine rounds in a row on the same side of zero (Nelson's rule 2): a persistent bias, even when every score is small.
Columns: date, z, classification (as classify), the two flags, and
action (True if either flag or the round itself is unsatisfactory).
Source code in src/labqc/proficiency.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |