R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- c(-14.503729838712200 + ,21.199495967741400 + ,27.367237903224700 + ,42.389818548385200 + ,23.628528225806400 + ,-9.697278225805260 + ,13.373689516130700 + ,27.218850806451500 + ,26.625302419354800 + ,10.667237903225800 + ,17.196270161289900 + ,31.928528225806400 + ,37.667916666667700 + ,75.671142473118300 + ,88.838884408602100 + ,117.161465053763000 + ,161.600174731183000 + ,133.874368279570000 + ,198.845336021505000 + ,186.790497311828000 + ,171.796948924731000 + ,202.538884408602000 + ,158.667916666667000 + ,168.200174731183000 + ,190.739563172043000 + ,195.142788978495000 + ,169.610530913978000 + ,143.733111559140000 + ,124.071821236559000 + ,80.146014784946200 + ,79.416982526881700 + ,40.262143817204300 + ,45.068595430107500 + ,17.010530913978500 + ,25.039563172043000 + ,27.871821236559200 + ,-21.388790322580600 + ,-42.385564516129100 + ,-41.617822580645100 + ,-41.195241935483800 + ,-37.456532258064500 + ,-73.982338709677400 + ,-57.211370967741900 + ,-52.666209677419400 + ,-27.559758064516100 + ,-25.317822580645100 + ,-23.788790322580600 + ,-45.656532258064500 + ,-72.717143817204300 + ,-74.413918010752700 + ,-85.946176075268800 + ,-63.623595430107400 + ,-48.484885752688200 + ,-96.210692204301100 + ,-68.139724462365600 + ,-53.694563172043000 + ,-55.588111559139800 + ,-64.946176075268800 + ,-75.617143817204300 + ,-82.984885752688100 + ,-97.545497311828000 + ,-124.242271505376000 + ,-115.574529569892000 + ,-83.051948924731000 + ,-85.313239247311900 + ,-138.439045698925000 + ,-117.868077956989000 + ,-106.522916666667000 + ,-78.716465053763400 + ,-67.974529569892500 + ,-45.545497311827900 + ,-13.313239247311800 + ,33.126149193548500 + ,65.429375000000000 + ,93.097116935483900 + ,112.919697580645000 + ,114.658407258064000 + ,44.232600806451600 + ,66.803568548387000 + ,77.048729838709600 + ,90.455181451612900 + ,55.497116935483800 + ,52.026149193548400 + ,38.958407258064500 + ,31.697795698924800 + ,11.801021505376300 + ,6.868763440860210 + ,32.291344086021500 + ,5.630053763440860 + ,-46.795752688172100 + ,-47.124784946236600 + ,-28.579623655914000 + ,-31.273172043010700 + ,-21.231236559139700 + ,-18.102204301075300 + ,-14.069946236559100 + ,-40.830557795698800 + ,-48.127331989247400 + ,-25.559590053763400 + ,-25.137009408602100 + ,4.301700268817190 + ,-30.424106182795700 + ,-27.153138440860300 + ,-47.707977150537700 + ,-50.001525537634400 + ,-52.759590053763400 + ,-24.030557795698900 + ,-20.398299731182700 + ,-39.058911290322500 + ,-61.055685483871000 + ,-65.087943548387100 + ,-45.665362903225800 + ,-24.326653225806500 + ,-47.452459677419400 + ,-53.481491935483900 + ,-54.036330645161300 + ,-39.229879032258100 + ,-27.587943548387100 + ,16.541088709677400 + ,34.573346774193600 + ,74.512735215053800 + ,129.815961021505000 + ,155.983702956989000 + ,185.806283602151000 + ,183.144993279570000 + ,149.519186827957000 + ,159.790154569892000 + ,141.835315860215000 + ,104.041767473118000 + ,88.683702956989200 + ,70.112735215053700 + ,95.944993279570000 + ,83.684381720430200 + ,75.787607526881700 + ,58.055349462365600 + ,22.977930107526900 + ,20.416639784946200 + ,-7.009166666666710 + ,-1.738198924731260 + ,3.606962365591360 + ,5.513413978494600 + ,24.555349462365600 + ,42.984381720430100 + ,29.016639784946300 + ,15.556028225806500 + ,-17.640745967741900 + ,32.426995967741900 + ,15.649576612903300 + ,13.488286290322600 + ,19.962479838709600 + ,13.933447580645100 + ,27.778608870967700 + ,5.285060483870950 + ,42.926995967741900 + ,63.856028225806500 + ,111.688286290323000 + ,124.927674731183000 + ,146.930900537634000 + ,146.098642473118000 + ,131.421223118280000 + ,130.359932795699000 + ,121.834126344086000 + ,109.405094086021000 + ,88.450255376344000 + ,64.956706989247300 + ,63.298642473118300 + ,49.027674731182800 + ,56.559932795699000 + ,41.299321236559200 + ,17.402547043010700 + ,23.870288978494600 + ,16.792869623656000 + ,46.231579301075300 + ,0.205772849462304 + ,-16.023259408602200 + ,16.421901881720400 + ,-5.171646505376360 + ,-11.829711021505400 + ,15.299321236559200 + ,16.231579301075300 + ,29.670967741935500 + ,44.074193548387100 + ,23.541935483871000 + ,17.564516129032300 + ,33.703225806451600 + ,21.477419354838600 + ,2.848387096774120 + ,-4.506451612903250 + ,-15.900000000000000 + ,-8.058064516129040 + ,16.270967741935500 + ,6.803225806451660 + ,6.542614247311900 + ,-9.054159946236560 + ,-10.386418010752700 + ,-10.863837365591300 + ,-20.625127688172000 + ,-0.850934139784974 + ,-55.879966397849500 + ,-37.134805107526900 + ,-48.928353494623700 + ,-39.886418010752700 + ,-49.957385752688200 + ,-43.325127688172000 + ,-63.385739247311700 + ,-50.182513440860200 + ,-75.214771505376400 + ,-56.992190860215000 + ,-64.253481182795700 + ,-52.679287634408600 + ,-92.708319892473200 + ,-87.963158602150600 + ,-103.156706989247000 + ,-101.014771505376000 + ,-105.185739247312000 + ,-117.653481182796000 + ,-145.314092741935000 + ,-168.710866935484000 + ,-158.343125000000000 + ,-145.420544354839000 + ,-118.581834677419000 + ,-111.407641129032000 + ,-142.836673387097000 + ,-134.591512096774000 + ,-149.285060483871000 + ,-137.643125000000000 + ,-148.314092741936000 + ,-142.181834677419000 + ,-166.042446236559000 + ,-173.439220430108000 + ,-174.171478494624000 + ,-164.248897849462000 + ,-164.310188172043000 + ,-120.035994623656000 + ,-135.165026881721000 + ,-134.719865591398000 + ,-122.313413978495000 + ,-101.171478494624000 + ,-128.142446236559000 + ,-148.910188172043000 + ,-186.770799731183000 + ,-175.367573924731000 + ,-188.899831989247000 + ,-193.777251344086000 + ,-191.938541666667000 + ,-133.564348118280000 + ,-150.593380376344000 + ,-163.948219086022000 + ,-163.341767473118000 + ,-157.599831989247000 + ,-173.070799731183000 + ,-191.338541666667000 + ,-218.899153225806000 + ,-223.995927419355000 + ,-219.328185483871000 + ,-200.905604838710000 + ,-204.566895161290000 + ,-168.292701612903000 + ,-166.321733870968000 + ,-166.376572580645000 + ,-140.470120967742000 + ,-136.828185483871000 + ,-171.899153225806000 + ,-182.666895161290000 + ,-178.027506720430000 + ,-149.124280913979000 + ,-132.956538978495000 + ,-112.133958333333000 + ,-108.395248655914000 + ,-52.621055107526900 + ,-45.750087365591500 + ,-43.604926075268800 + ,-19.298474462365600 + ,-7.156538978494660 + ,5.572493279569910 + ,6.004751344086080 + ,10.544139784946300 + ,3.447365591397890 + ,-0.98489247311826 + ,-10.162311827957000 + ,-19.623602150537600 + ,17.250591397849400 + ,24.021559139785000 + ,28.266720430107500 + ,23.273172043010800 + ,11.715107526881700 + ,14.144139784946300 + ,-0.323602150537566 + ,1.615786290322700 + ,-11.780987903225800 + ,-9.213245967741910 + ,-22.090665322580600 + ,-36.851955645161300 + ,-1.377762096774150 + ,-3.906794354838740 + ,-4.361633064516130 + ,-7.155181451612840 + ,-10.513245967741900 + ,-52.984213709677300 + ,-70.451955645161200 + ,-87.812567204301000 + ,-80.709341397849500 + ,-91.741599462365600 + ,-86.619018817204300 + ,-103.580309139785000 + ,-71.506115591397900 + ,-78.435147849462400 + ,-81.489986559139800 + ,-68.683534946236500 + ,-93.441599462365600 + ,-86.212567204301000 + ,-88.480309139784900 + ,-66.740920698924700 + ,-63.437694892473100 + ,-79.669952956989200 + ,-86.147372311827900 + ,-81.308662634408600 + ,-30.434469086021500 + ,-19.663501344086000 + ,-26.018340053763500 + ,22.788111559139900 + ,22.430047043010800 + ,64.459079301075400 + ,104.091337365592000 + ,238.230725806452000 + ,241.233951612903000 + ,268.501693548387000 + ,253.524274193548000 + ,254.362983870968000 + ,276.237177419355000 + ,263.008145161290000 + ,242.853306451613000 + ,242.559758064516000 + ,230.201693548387000 + ,206.830725806452000 + ,200.762983870968000 + ,225.402372311828000 + ,201.405598118280000 + ,172.873340053763000 + ,148.295920698925000 + ,110.234630376344000 + ,172.608823924731000 + ,187.579791666667000 + ,193.224952956989000 + ,180.731404569893000 + ,176.873340053763000 + ,181.002372311828000 + ,171.234630376344000 + ,180.574018817204000 + ,196.777244623656000 + ,163.744986559140000 + ,103.867567204301000 + ,82.706276881720500 + ,140.180470430107000 + ,111.751438172043000 + ,124.496599462366000 + ,109.603051075269000 + ,103.444986559140000 + ,93.874018817204300 + ,44.806276881720600 + ,73.245665322580700 + ,47.548891129032200 + ,43.816633064516100 + ,3.639213709677500 + ,1.077923387096840 + ,15.252116935483900 + ,49.223084677419300 + ,29.668245967742000 + ,33.374697580645200 + ,15.116633064516200 + ,9.945665322580720 + ,17.077923387096900) > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., (2012), Mean versus Median (v1.0.2) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_meanversusmedian.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > library(Hmisc) Loading required package: survival Loading required package: splines Hmisc library by Frank E Harrell Jr Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview') to see overall documentation. NOTE:Hmisc no longer redefines [.factor to drop unused levels when subsetting. To get the old behavior of Hmisc type dropUnusedLevels(). Attaching package: 'Hmisc' The following object(s) are masked from 'package:survival': untangle.specials The following object(s) are masked from 'package:base': format.pval, round.POSIXt, trunc.POSIXt, units > m <- mean(x) > e <- median(x) > postscript(file="/var/wessaorg/rcomp/tmp/13d781355329175.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow=c(2,1)) > mydensity1 <- density(x,kernel='gaussian',na.rm=TRUE) > plot(mydensity1,main='Density Plot - Gaussian Kernel',xlab='Median (0 -> full line) | Mean (0 -> dashed line)',ylab='density') > abline(v=e,lty=1) > abline(v=m,lty=5) > grid() > myseq <- seq(0.01, 0.99, 0.01) > hd <- hdquantile(x, probs = myseq, se = TRUE, na.rm = FALSE, names = TRUE, weights=FALSE) > plot(myseq,hd,col=2,main='Harrell-Davis Quantiles',xlab='quantiles',ylab='Median (0 -> full) | Mean (0 -> dashed)') > abline(h=m,lty=5) > abline(h=e,lty=1) > grid() > par(op) > dev.off() null device 1 > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Median versus Mean',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'mean',header=TRUE) > a<-table.element(a,mean(x)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'median',header=TRUE) > a<-table.element(a,median(x)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/2take1355329175.tab") > > try(system("convert tmp/13d781355329175.ps tmp/13d781355329175.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.940 0.211 2.127