/
2graphbox—Boxplots 2graphbox—Boxplots

2graphbox—Boxplots - PDF document

alida-meadow
alida-meadow . @alida-meadow
Follow
363 views
Uploaded On 2016-03-04

2graphbox—Boxplots - PPT Presentation

boxlook optionsDescription noout sidesdonotplotoutsidevaluesboxbarlook optionslookofthboxpcyc leboxstylesbeforepstylesrecycleinten sityintensityoflllinten sityintensityofoutlineme ID: 241519

boxlook optionsDescription noout sidesdonotplotoutsidevaluesbox(# barlook options)lookof#thboxpcyc le(#)boxstylesbeforepstylesrecycleinten sity(*#)intensityoflllinten sity(*#)intensityofoutlineme

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "2graphbox—Boxplots" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

2graphbox—Boxplots boxlook optionsDescription noout sidesdonotplotoutsidevaluesbox(#,barlook options)lookof#thboxpcyc le(#)boxstylesbeforepstylesrecycleinten sity(*#)intensityoflllinten sity(*#)intensityofoutlinemedt ype(linejclinejmarker)howmedianisindicatedinboxmedl ine(line options)lookoflineifmedtype(cline)medm arker(marker options)lookofmarkerifmedtype(marker)cwhi skersusecustomwhiskersline s(line options)lookofcustomwhiskersal size(#)widthofadjacentline;defaultis67cap size(#)heightofcaponadjacentline;defaultis0m arker(#,marker optionslookof#thmarkerandlabelforoutsidevaluesmarker label options)outergap(*#)gapbetweenedgeandrstboxandbetweenlastboxandedgeboxgap(#)gapbetweenboxes;defaultis33 See[G-3]barlook options,[G-3]line options,[G-3]marker options,and[G-3]marker label options.legending optionsDescription legend optionscontrolofyvarlegendnolab eluseyvarnames,notlabels,inlegendyvar options(over subopts)over suboptsforyvars;seldomspeciedshowyvarslabelyvarsonxaxis;seldomspecied See[G-3]legend options.axis optionsDescription yalt ernateputnumericalyaxisonright(top)xalt ernateputcategoricalxaxisontop(right)yrev ersereverseyaxisaxis scale optionsy-axisscalingandlookaxis label optionsy-axislabelingytitle(:::)y-axistitling See[G-3]axis scale options,[G-3]axis label options,and[G-3]axis title options. 4graphbox—Boxplots Theencodingandthewordsusedtodescribetheencodingareooutsidevaluesoadjacentline upperadjacentvalue whiskers 75thpercentile(upperhinge) box median 25thpercentile(lowerhinge)whiskers adjacentline loweradjacentvalueooutsidevaluegraphhboxdrawshorizontalboxplots.Inahorizontalboxplot,thenumericalaxisisstillcalledtheyaxis,andthecategoricalaxisisstillcalledthexaxis,butyispresentedhorizontally,andxvertically..graphhboxy1y2,over(cat_var)x | ofirst group | sameconceptuallayout asforgraphbox: y1,y2appearonyaxis o | cat_varappearsonxaxissecond group | o y2468OptionsOptionsarepresentedunderthefollowingheadings:group optionsyvar optionsboxlook optionslegending optionsaxis optionstitle and other optionsSuboptionsforusewithover()andyvaroptions() graphbox—Boxplots7 outergap(*#)speciesthatthedefaultbemodied.Specifyingoutergap(*1.2)increasesthegapby20%,andspecifyingoutergap(*.8)reducesthegapby20%.outergap(#)speciesthegapasapercentage-of-box-widthunits.outergap(50)speciesthatthegapbehalftheboxwidth.boxgap(#)speciesthegaptobeleftbetweenyvarboxesasapercentage-of-box-widthunits.Thedefaultisboxgap(33).boxgap()affectsonlytheyvarboxes.Ifyouwanttochangethegapfortherst,second,orthirdover()group,specifytheover suboptgap()insidetheover()itself;seeSuboptionsforusewithover()andyvaroptions()below.legending optionslegend optionsallowsyoutocontrolthelegend.Ifmorethanoneyvarisspecied,alegendisproduced.Otherwise,nolegendisneededbecausetheover()groupsarelabeledonthecategoricalxaxis.See[G-3]legend options,andseeTreatmentofmultipleyvarsversustreatmentofover()groupsunderRemarksandexamplesbelow.nolabelspeciesthat,inautomaticallyconstructingthelegend,thevariablenamesoftheyvarsbeusedinpreferencetotheirlabels.yvaroptions(over subopts)allowsyoutospecifyover suboptsfortheyvars.Thisisseldomdone.showyvarsspeciesthat,inadditiontobuildingalegend,theidentitiesoftheyvarsbeshownonthecategoricalxaxis.Ifshowyvarsisspecied,itistypicaltoalsospecifylegend(off).axis optionsyalternateandxalternateswitchthesideonwhichtheaxesappear.Usedwithgraphbox,yalternatemovesthenumericalyaxisfromthelefttotheright;xalternatemovesthecategoricalxaxisfromthebottomtothetop.Usedwithgraphhbox,yalternatemovesthenumericalyaxisfromthebottomtothetop;xalternatemovesthecategoricalxaxisfromthelefttotheright.Ifyourschemebydefaultputstheaxesontheoppositesides,thenyalternateandxalternatereversetheiractions.yreversespeciesthatthenumericalyaxishaveitsscalereversedsothatitrunsfrommaximumtominimum.axis scale optionsspecifyhowthenumericalyaxisisscaledandhowitlooks;see[G-3]axis scale options.Thereyouwillalsoseeoptionxscale()inadditiontoyscale().Ignorexscale(),whichisirrelevantforboxplots.axis label optionsspecifyhowthenumericalyaxisistobelabeled.Theaxis label optionsalsoallowyoutoaddandsuppressgridlines;see[G-3]axis label options.Thereyouwillseethat,inadditiontooptionsylabel(),ytick(),:::,ymtick(),optionsxlabel(),:::,xmtick()areallowed.Ignorethex*()options,whichareirrelevantforboxplots.ytitle()overridesthedefaulttitleforthenumericalyaxis;see[G-3]axis title options.Thereyouwillalsondoptionxtitle()documented,whichisirrelevantforboxplots. graphbox—Boxplots9 sort(varname)andsort(#)controlhowtheboxesareordered.SeeHowboxesareorderedandReorderingtheboxesunderRemarksandexamplesbelow.sort(varname)putstheboxesintheorderofvarname;seePuttingtheboxesinaprespeciedorderunderRemarksandexamplesbelow.sort(#)putstheboxesinorderoftheirmedians.#referstotheyvarnumberonwhichtheorderingshouldbeperformed;seePuttingtheboxesinmedianorderunderRemarksandexamplesbelow.descendingspeciesthattheorderoftheboxes—defaultorasspeciedbysort()—bereversed.Remarksandexamplesstata.comRemarksarepresentedunderthefollowingheadings:IntroductionExamplesofsyntaxTreatmentofmultipleyvarsversustreatmentofover()groupsHowboxesareorderedReorderingtheboxesPuttingtheboxesinaprespeciedorderPuttingtheboxesinmedianorderUsewithby()VideoexampleHistoryAlsosee[G-2]graphbar.Mostofwhatissaidthereappliesequallywelltoboxplots.Introductiongraphboxdrawsverticalboxplots:.usehttp://www.stata-press.com/data/r13/bplong(fictionalbloodpressuredata).graphboxbp,over(when)over(sex)ytitle("Systolicbloodpressure")title("ResponsetoTreatment,bySex")subtitle("(120PreoperativePatients)""")note("Source:FictionalDrugTrial,StataCorp,2003") 12graphbox—Boxplots Intheseconddataset,thedataareorganizedthelongway;eachpatientisapairofobservations.Thecorrespondingobservationsintheseconddatasetare patientsexagegrpwhenbp 1Male30-45Before143 1Male30-45After153 2Male30-45Before163 2Male30-45After170 3Male30-45Before153 3Male30-45After168 Usingtherstdataset,wemighttype.usehttp://www.stata-press.com/data/r13/bpwide,clear(fictionalbloodpressdata).graphboxbp_beforebp_after,over(sex) graphbox—Boxplots15 Ifyouwantedthelargestrst,youwouldtype.graphhboxwage,over(industry,sort(1)descending)The1insort(1)referstotherst(andhereonly)yvar.Ifyouhadmultipleyvars,youmighttype.graphhboxwagebenefits,over(industry,sort(1))andyouwouldhaveachartshowingwageandbenefitssortedonwage.Ifyoutyped.graphhboxwagebenefits,over(industry,sort(2))thegraphwouldbesortedonbenefits.Usewithby()graphboxandgraphhboxmaybeusedwithby(),butingeneral,youwillwanttouseover()inpreferencetoby().Boxchartsareexplicitlycategoricalanddoanexcellentjobofpresentingsummarystatisticsformultiplegroupsinonechart.Agooduseofby(),however,iswhenthegraphwouldotherwisebelong.Considerthegraph.usehttp://www.stata-press.com/data/r13/nlsw88,clear(NLSW,1988extract).graphhboxwage,over(ind)over(union)Intheabovegraph,thereare12industrycategoriesandtwounioncategories,resultingin24separateboxes.Thegraph,presentedatnormalsize,wouldbevirtuallyunreadable.Onewayaroundthatproblemwouldbetomakethegraphlongerthanusual,.graphhboxwage,over(ind)over(union)ysize(7)SeeChartswithmanycategoriesin[G-2]graphbarformoreinformationaboutthatsolution.Theothersolutionwouldbetointroduceunionasaby()categoryratherthananover()category:.graphhboxwage,over(ind)by(union)

Related Contents


Next Show more