{"success":true,"version":"v1","request":{"tool":"get_calculator_schema","calculator_id":"outlier-detection"},"result":{"entity_type":"calculator","id":"outlier-detection","calculator_id":"outlier-detection","canonical_url":"https://tttkmbb.com/statistics/outlier-detection","name":"Outlier Detection Calculator","title":"Outlier Detection Calculator – IQR (Tukey Fences) and Z-Score Methods with Cleaned Statistics","category":"statistics","category_name":"Statistics & Probability","tool_name":"detect_outliers","featured_mcp_tool":false,"description":"Flags outliers in a list of numbers using Tukey's interquartile-range fences (Q1 − 1.5·IQR, Q3 + 1.5·IQR) or a z-score threshold, and reports the bounds, the outliers and the mean and standard deviation of the remaining values.","use_when":"You want to screen a data set for unusually large or small values before summarising it, or need the fences used by box plots.","do_not_use_when":"You need a formal single-outlier test (Grubbs' test), the data are strongly skewed or multimodal (transform first), or you only want quartiles and summary statistics (use descriptive-statistics).","inputs":[{"name":"values","label":"Values","type":"number_list","required":true,"description":"The data set (order does not matter).","example":[1,2,3,4,5,6,7,8,9,50]},{"name":"method","label":"Method","type":"enum","required":false,"default":"iqr","values":[{"value":"iqr","label":"IQR / Tukey fences (default multiplier 1.5)","aliases":["tukey","box_plot","interquartile"]},{"value":"z_score","label":"Z-score (default threshold 3)","aliases":["z","zscore","standard_deviation"]}],"description":"Detection rule. The IQR rule is robust; the z-score rule uses the mean and SD, which the outliers themselves inflate.","example":"iqr"},{"name":"threshold","label":"Threshold","type":"number","required":false,"exclusive_min":0,"description":"IQR multiplier (1.5 = usual outliers, 3 = extreme outliers) or |z| cut-off (commonly 2, 2.5 or 3). Defaults: 1.5 for iqr, 3 for z_score.","example":1.5}],"outputs":[{"name":"method_description","label":"Rule applied","type":"string","decimals":4,"description":"The rule and threshold used."},{"name":"outliers","label":"Outliers","type":"number_list","decimals":4,"description":"Values outside the bounds, sorted ascending (first 60 when there are more)."},{"name":"outlier_count","label":"Number of outliers","type":"integer","decimals":4,"description":"How many values were flagged."},{"name":"lower_bound","label":"Lower bound","type":"number","decimals":4,"description":"Values below this are outliers."},{"name":"upper_bound","label":"Upper bound","type":"number","decimals":4,"description":"Values above this are outliers."},{"name":"q1","label":"Q1","type":"number","decimals":4,"description":"First quartile by linear interpolation (iqr method)."},{"name":"q3","label":"Q3","type":"number","decimals":4,"description":"Third quartile (iqr method)."},{"name":"iqr","label":"IQR","type":"number","decimals":4,"description":"Q3 − Q1 (iqr method)."},{"name":"mean","label":"Mean (all values)","type":"number","decimals":4,"description":"Mean of the full data set."},{"name":"std_dev","label":"SD (all values)","type":"number","decimals":4,"description":"Sample standard deviation of the full data set."},{"name":"cleaned_count","label":"Values kept","type":"integer","decimals":4,"description":"Number of values within the bounds."},{"name":"cleaned_mean","label":"Mean without outliers","type":"number","decimals":4,"description":"Mean of the values within the bounds."},{"name":"cleaned_std_dev","label":"SD without outliers","type":"number","decimals":4,"description":"Sample standard deviation of the values within the bounds (needs ≥ 2 kept values)."}],"input_schema":{"type":"object","properties":{"values":{"description":"The data set (order does not matter).","type":"array","items":{"type":"number"},"minItems":3,"examples":[[1,2,3,4,5,6,7,8,9,50]]},"method":{"description":"Detection rule. The IQR rule is robust; the z-score rule uses the mean and SD, which the outliers themselves inflate.","type":"string","enum":["iqr","z_score"],"default":"iqr","examples":["iqr"]},"threshold":{"description":"IQR multiplier (1.5 = usual outliers, 3 = extreme outliers) or |z| cut-off (commonly 2, 2.5 or 3). Defaults: 1.5 for iqr, 3 for z_score.","type":"number","exclusiveMinimum":0,"examples":[1.5]}},"additionalProperties":false,"required":["values"]},"output_schema":{"type":"object","properties":{"method_description":{"description":"The rule and threshold used.","type":"string"},"outliers":{"description":"Values outside the bounds, sorted ascending (first 60 when there are more).","type":"array","items":{"type":"number"}},"outlier_count":{"description":"How many values were flagged.","type":"integer"},"lower_bound":{"description":"Values below this are outliers.","type":"number"},"upper_bound":{"description":"Values above this are outliers.","type":"number"},"q1":{"description":"First quartile by linear interpolation (iqr method).","type":"number"},"q3":{"description":"Third quartile (iqr method).","type":"number"},"iqr":{"description":"Q3 − Q1 (iqr method).","type":"number"},"mean":{"description":"Mean of the full data set.","type":"number"},"std_dev":{"description":"Sample standard deviation of the full data set.","type":"number"},"cleaned_count":{"description":"Number of values within the bounds.","type":"integer"},"cleaned_mean":{"description":"Mean of the values within the bounds.","type":"number"},"cleaned_std_dev":{"description":"Sample standard deviation of the values within the bounds (needs ≥ 2 kept values).","type":"number"}}},"formula":"iqr: outlier if x < Q1 − threshold × IQR or x > Q3 + threshold × IQR (quartiles by linear interpolation, Excel PERCENTILE.INC). z_score: outlier if |x − mean| > threshold × s (sample SD)","method":"Tukey's fences with multiplier 1.5 are the box-plot convention (NIST). The z-score rule cannot flag anything when the threshold exceeds (n − 1)/√n, the largest |z| a sample of size n can contain; a note is added in that case.","sources":[{"name":"NIST/SEMATECH e-Handbook of Statistical Methods, 7.1.6 What are outliers in the data?","url":"https://www.itl.nist.gov/div898/handbook/prc/section1/prc16.htm","type":"government","retrieved_at":"2026-09-24"},{"name":"Wikipedia – Outlier","url":"https://en.wikipedia.org/wiki/Outlier","type":"reference","retrieved_at":"2026-09-24"},{"name":"Wikipedia – Interquartile range","url":"https://en.wikipedia.org/wiki/Interquartile_range","type":"reference","retrieved_at":"2026-09-24"}],"freshness":{"type":"static","max_age_seconds":null,"note":"Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output."},"examples":[{"name":"1…9 and 50, IQR rule","inputs":{"values":[1,2,3,4,5,6,7,8,9,50],"method":"iqr"},"expected":{"outliers":[50],"outlier_count":1,"lower_bound":-3.5,"upper_bound":14.5,"q1":3.25,"q3":7.75,"iqr":4.5,"cleaned_count":9,"cleaned_mean":5},"url":"https://tttkmbb.com/api/v1/calculate/outlier-detection?values=1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C50&method=iqr"},{"name":"10…18 and 100, z-score threshold 2","inputs":{"values":[10,11,12,13,14,15,16,17,18,100],"method":"z_score","threshold":2},"expected":{"outliers":[100],"outlier_count":1,"mean":22.6,"std_dev":27.3179,"lower_bound":-32.0358,"upper_bound":77.2358,"cleaned_mean":14,"cleaned_std_dev":2.7386},"url":"https://tttkmbb.com/api/v1/calculate/outlier-detection?values=10%2C11%2C12%2C13%2C14%2C15%2C16%2C17%2C18%2C100&method=z_score&threshold=2"}],"faq":[{"q":"Why did the z-score method miss an obvious outlier?","a":"The outlier inflates the mean and SD used to judge it (masking). In a sample of 10 the largest possible |z| is 2.85, so a threshold of 3 can never trigger; use the IQR rule or a lower threshold."},{"q":"Should I delete outliers?","a":"Not automatically. Check for data-entry errors first; genuine extreme values may be the most important observations. Report results with and without them."}],"tags":["outlier detection","iqr rule","tukey fences","z score outliers","remove outliers","box plot"],"related":[{"calculator_id":"descriptive-statistics","reason":"Full summary statistics of the same data."},{"calculator_id":"z-score","reason":"Standardise a single value."},{"calculator_id":"percentile","reason":"Any percentile of the data by the same interpolation method."}],"links":{"html":"https://tttkmbb.com/statistics/outlier-detection","markdown":"https://tttkmbb.com/statistics/outlier-detection.md","json":"https://tttkmbb.com/statistics/outlier-detection.json","api":"https://tttkmbb.com/api/v1/calculate/outlier-detection","schema":"https://tttkmbb.com/api/v1/calculators/outlier-detection","openapi":"https://tttkmbb.com/openapi.json","mcp":"https://tttkmbb.com/mcp"},"version":"v1","updated_at":"2026-09-24"},"timestamp":"2026-09-24T01:46:44Z","next_actions":[{"tool":"run_calculator","calculator_id":"outlier-detection","reason":"Run Outlier Detection Calculator with the inputs above."}],"links":{"markdown":"https://tttkmbb.com/statistics/outlier-detection.md"}}