Quartiles, Interquartile range and outlier boundaries.

Needs["Statistics`DescriptiveStatistics`"]

Needs["Statistics`DataManipulation`"]

This notebook describes a method to determine potential and actual outliers. Below is data on computer use for metropolitan areas in 1994. Data were obtained from the US Census. First variable is the name of the city, second variable is the proportion of survey respondents who said that they had a computer at home.

\(\(Computer = {{"Birmingham,_AL ", 0.1298701299\ }, 
        
{"Boston,_MA ", 0.0542168675\ }, 
        
{"Boulder-Longmont,_CO ", 0.3\ }, 
        
{"Bridgeport-Milford,_CT ", 0.025\ }, 
        
{"Canton,_OH ", 0.0285714286\ }, 
        
{"Charleston,_SC ", 0.1219512195\ }, 
        
{"Chattanooga,_TN-GA ", 0.1428571429\ }, 
        
{"Chicago,_IL ", 0.0759837178\ }, 
        
{"Cincinnati,_OH-KY-IN ", 0.0875912409\ }, 
        
{"Cleveland,_OH ", 0.0912547529\ }, 
        
{"Colorado_Springs,_CO ", 0.1351351351\ }, 
        
{"Columbia,_SC ", 0.0243902439\ }, 
        
{"Columbus,_OH ", 0.0863309353\ }, 
        
{"Corpus_Christi,_TX ", 0.0357142857\ }, 
        
{"Dallas,_TX ", 0.1144278607\ }, 
        
{"Davenport-Rock_Island-Moli ", 0.0476190476\ }, 
        
{"Denver,_CO ", 0.0921052632\ }, 
        
{"Des_Moines,_IA ", 0.1551724138\ }, 
        
{"Detroit,_MI ", 0.0760095012\ }, 
        
{"Duluth,_MN-WI ", 0.1666666667\ }, 
        
{"El_Paso,_TX ", 0.0666666667\ }, 
        
{"Erie, ", 0.0588235294\ }, 
        
{"Eugene-Springfield,_OR ", 0.3333333333\ }, 
        
{"Flint, ", 0.1041666667\ }, 
        
{"Fort_Lauderdale-Hollywood- ", 0.0864197531\ }, 
        
{"Fort_Myers-Cape_Coral,_FL ", 0.078125\ }, 
        
{"Fort_Wayne,_IN ", 0.05\ }, 
        
{"Fort_Worth-Arlington,_TX ", 0.1214953271\ }, 
        
{"Fresno,_CA ", 0.0363636364\ }, 
        
{"Gary-Hammond,_IN ", 0.1162790698\ }, 
        
{"Grand_Rapids,_MI ", 0.1217391304\ }, 
        
{"Greensboro-Winston_Salem-H ", 0.0700636943\ }, 
        
{"Greenville-Spartanburg,_SC ", 0.1333333333\ }, 
        
{"Hartford,_CT ", 0.0752688172\ }, 
        
{"Honolulu,_HI ", 0.1123595506\ }, 
        
{"Houston,_TX ", 0.1020408163\ }, 
        
{"Indianpolis,_IN ", 0.0963855422\ }, 
        
{"Jackson,_MS ", 0.0983606557\ }, 
        
{"Jacksonville,_FL ", 0.0952380952\ }, 
        
{"Jersey_City,_NJ ", 0.0285714286\ }, 
        
{"Kansas_City,_MO-KS ", 0.108974359\ }, 
        
{"Knoxville,_TN ", 0.0425531915\ }, 
        
{"Lakeland-Winter_Haven,_FL ", 0.1\ }, 
        
{"Lancaster,_PA ", 0.05\ }, 
        
{"Lansing-East_Lansing,_MI ", 0.0833333333\ }, 
        
{"Las_Vegas,_NV ", 0.0739299611\ }, 
        
{"Lexington-Fayette,_KY ", 0.023255814\ }, 
        
{"Little_Rock-North_Little_Rock ", 0.0673076923\ }, 
        
{"Los_Angeles-Long_Beach,_CA ", 0.0863477246\ }, 
        
{"Madison,_WI ", 0.1612903226\ }, 
        
{"Melbourne-Titusville-Palm ", 0.1489361702\ }, 
        
{"Memphis,_TN-AR-MS ", 0.0847457627\ }, 
        
{"Miami-Hialeah,_FL ", 0.0810810811\ }, 
        
{"Middlesex-Somerset-Hunterd ", 0.0625\ }, 
        
{"Milwaukee,_WI ", 0.1238095238\ }, 
        
{"Minneapolis-St_Paul,_MN ", 0.1627906977\ }, 
        
{"Modesto,_CA ", 0.0454545455\ }, 
        
{"Monmouth-Ocean,_NJ ", 0.0752688172\ }, 
        
{"Montogomery,_AL ", 0.0454545455\ }, 
        
{"Nashville,_TN ", 0.0735294118\ }, 
        
{"Nassau-Suffolk,_NY ", 0.108490566\ }, 
        
{"New_Haven,_Meriden,_CT ", 0.0877192982\ }, 
        
{"New_Orleans,_LA ", 0.0364963504\ }, 
        
{"New_York_City,_NY ", 0.0653465347\ }, 
        
{"Newark,_NJ ", 0.0717948718\ }, 
        
{"Norfolk-Virginia_Beach-New ", 0.0568181818\ }, 
        
{"Oakland,_CA ", 0.2380952381\ }, 
        
{"Oklahoma_City,_OK ", 0.0948275862\ }, 
        
{"Omaha,_NE-IA ", 0.093220339\ }, 
        
{"Orlando,_FL ", 0.1061946903\ }, 
        
{"Pensacola,_FL ", 0.0555555556\ }, 
        
{"Peoria,_IL ", 0.0975609756\ }, 
        
{"Philadelphia,_PA-NJ ", 0.093220339\ }, 
        
{"Phoenix,_AZ ", 0.119047619\ }, 
        
{"Pittsburgh,_PA ", 0.0570469799\ }, 
        
{"Providence,_RI ", 0.0544871795\ }, 
        
{"Raleigh,Durham,_NC ", 0.112244898\ }, 
        
{"Riverside-San_Bernardino ", 0.1493506494\ }, 
        
{"Rochester,_NY ", 0.1067961165\ }, 
        
{"Rockford,_IL ", 0.125\ }, 
        
{"Sacramento,_CA ", 0.193877551\ }, 
        
{"St_Louis,_MO-IL ", 0.0813953488\ }, 
        
{"Salinas-Seaside-Monterey ", 0.1666666667\ }, 
        
{"Salt_Lake_City-Ogden,_UT ", 0.1646341463\ }, 
        
{"San_Antonio,_TX ", 0.0989010989\ }, 
        
{"San_Diego,_CA ", 0.1176470588\ }, 
        
{"San_Francisco,_CA ", 0.0833333333\ }, 
        
{"San_Jose,_CA ", 0.0833333333\ }, 
        
{"Santa_Barbara-Santa_Maria- ", 0.0588235294\ }, 
        
{"Santa_Rosa-Petaluma,_CA ", 0.1578947368\ }, 
        
{"Sarasota,_FL ", 0.1538461538\ }, 
        
{"Scranton-Wilkes_Barre,_PA ", 0.0666666667\ }, 
        
{"Seattle,_WA ", 0.1444444444\ }, 
        
{"Shreveport,_LA ", 0.025\ }, 
        
{"Spokane,_WA ", 0.0869565217\ }, 
        
{"Springfield,_MA ", 0.0967741935\ }, 
        
{"Stockton,_CA ", 0.0294117647\ }, 
        
{"Syracuse,_NY ", 0.0327868852\ }, 
        
{"Tacoma,_WA ", 0.1851851852\ }, 
        
{"Tampa-St_Petersburg-Clear ", 0.0794979079\ }, 
        
{"Toledo,_OH ", 0.1272727273\ }, 
        
{"Trenton,_NJ ", 0.0322580645\ }, 
        
{"Tucson,_AZ ", 0.1066666667\ }, 
        
{"Tulsa,_OK ", 0.1891891892\ }, 
        
{"Utica-Rome,_NY ", 0.1071428571\ }, 
        
{"Vallejo-Fairfield-Napa,_Ca ", 0.2173913043\ }, 
        
{"Washington,_DC-MD-VA ", 0.1129707113\ }, 
        
{"West_Palm_Beach-Boca_Raton ", 0.0582524272\ }, 
        
{"Wichita,_KS ", 0.0422535211\ }, 
        
{"Worcester,_MA ", 0.0408163265\ }, 
        
{"Youngstown-Warren,_OH ", 0.0537634409\ }
}; \)\)

Descriptive statistics.

Min[Column[Computer, 2]]

Max[Column[Computer, 2]]

Mean[Column[Computer, 2]]

Median[Column[Computer, 2]]

StandardDeviation[Column[Computer, 2]]

Qstats =  Quartiles[Column[Computer, 2]]

ICQ =  Qstats[[3]]  -  Qstats[[1]]

InnerLeft  =  Qstats[[1]]  -  1.5*ICQ

InnerRight  =  Qstats[[1]]   + 1.5*ICQ

OuterLeft  =  Qstats[[1]]  -  3. *ICQ

OuterRight =  Qstats[[1]]  +  3. *ICQ

FenceLeft1  =  
      Select[Computer, 
        And[#[[2]]  <= InnerLeft, #[[2]]  >  OuterLeft]&]

FenceLeft2  =  Select[Computer, #[[2]]  <= OuterLeft&]

FenceRight1  =  
      TableForm[
        Select[Computer, 
          And[#[[2]]  >= InnerRight, #[[2]]  <  OuterRight]&]]

FenceRight2  =  
      TableForm[Select[Computer, #[[2]]  >= OuterRight&]]