R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(-20.27090547 + ,13.09906119 + ,16.93353478 + ,29.0528023 + ,7.388200695 + ,-29.55792205 + ,-10.10725016 + ,-0.152685277 + ,-4.636820184 + ,-26.74516269 + ,-26.36640366 + ,-23.72636888 + ,-29.80269557 + ,-6.210335191 + ,-7.453467875 + ,6.324311334 + ,36.21822142 + ,-4.158315579 + ,48.16194206 + ,27.45685656 + ,3.813071273 + ,32.36525685 + ,-13.69545605 + ,0.971265782 + ,28.92162614 + ,44.09178164 + ,29.32644407 + ,16.92668567 + ,10.74305815 + ,-17.81499658 + ,-3.176256667 + ,-25.47607901 + ,-3.81460113 + ,-16.53900414 + ,6.823694366 + ,22.04717893 + ,-14.54569797 + ,-26.44319984 + ,-16.57619477 + ,-10.56187803 + ,-1.231430405 + ,-34.34551084 + ,-14.16279665 + ,-7.165294777 + ,20.39350731 + ,24.60814111 + ,28.10987643 + ,8.197222561 + ,-16.63179278 + ,-15.88863222 + ,-24.98096471 + ,-0.023620959 + ,17.74985367 + ,-27.80762943 + ,2.431682105 + ,19.32042171 + ,19.87046153 + ,13.53110943 + ,5.878858861 + ,2.479150209 + ,-7.836919915 + ,-30.8115267 + ,-18.42162656 + ,14.31387913 + ,12.2655157 + ,-47.29743855 + ,-33.16359817 + ,-35.25099103 + ,-20.87708367 + ,-27.87735236 + ,-23.19051952 + ,-8.874810406 + ,19.92453723 + ,37.01159205 + ,49.46315381 + ,59.26275569 + ,50.97848844 + ,-22.44259766 + ,-2.86688912 + ,11.1756737 + ,28.37953674 + ,0.425431909 + ,3.958428602 + ,-0.594897645 + ,0.935414634 + ,-9.638161803 + ,-5.247231302 + ,28.03068284 + ,9.224727853 + ,-37.67881633 + ,-32.48556589 + ,-9.776699193 + ,-8.30653228 + ,3.683657757 + ,8.760949318 + ,12.67954801 + ,-13.91821478 + ,-20.63534996 + ,2.512021797 + ,4.341180502 + ,35.18647008 + ,1.255525989 + ,5.321376528 + ,-13.93886097 + ,-14.93779826 + ,-15.60736534 + ,15.2101691 + ,20.45434662 + ,3.682162662 + ,-17.6808173 + ,-21.07929033 + ,-3.002725372 + ,16.98997046 + ,-12.24921285 + ,-24.39160153 + ,-38.27211642 + ,-36.7913311 + ,-43.6359683 + ,-17.99350398 + ,-19.52838075 + ,1.120381008 + ,39.92514868 + ,49.59442329 + ,69.81981419 + ,57.56133598 + ,22.16958918 + ,30.67463702 + ,18.28821122 + ,-13.93691437 + ,-18.29283679 + ,-25.8616577 + ,12.60047989 + ,13.246256 + ,16.26529601 + ,9.448842953 + ,-18.30111861 + ,-13.53494929 + ,-35.79222958 + ,-25.35271524 + ,-16.53135376 + ,-11.14869207 + ,8.682040314 + ,27.89987422 + ,13.03895964 + ,-1.038316416 + ,-34.80153384 + ,14.69975566 + ,-3.589269165 + ,-7.262163117 + ,-6.587034949 + ,-18.41511215 + ,-14.86810261 + ,-47.65979286 + ,-21.2939047 + ,-11.64091502 + ,26.18993652 + ,29.70442658 + ,45.46466455 + ,38.38940946 + ,23.09816729 + ,21.42305599 + ,18.24177057 + ,11.15727978 + ,-0.715531051 + ,-15.12704166 + ,-7.221308409 + ,-11.92847363 + ,4.366851475 + ,-1.854184893 + ,-18.39693339 + ,-4.57517496 + ,-6.367007752 + ,28.35729033 + ,-15.13850615 + ,-28.83750799 + ,3.691409338 + ,-17.81837312 + ,-25.45406909 + ,0.697336464 + ,0.513021946 + ,13.11234595 + ,27.37574971 + ,6.703660396 + ,1.72995279 + ,18.87237606 + ,8.456757361 + ,-8.362066705 + ,-13.13090143 + ,-21.93843593 + ,-11.31621011 + ,15.79311723 + ,9.193042813 + ,12.07660692 + ,-0.15854253 + ,1.870814958 + ,5.561329377 + ,-0.032025328 + ,24.39518598 + ,-25.98080808 + ,-2.755736589 + ,-10.06936488 + ,3.018100073 + ,-3.007333447 + ,7.284903863 + ,-8.839220301 + ,8.433324544 + ,-12.52962367 + ,10.58494652 + ,8.215647595 + ,25.78336247 + ,-8.252128021 + ,3.961945683 + ,-3.762680397 + ,5.601932724 + ,8.653647369 + ,1.610185382 + ,-20.34963808 + ,-39.78261452 + ,-25.45108403 + ,-9.779510729 + ,19.80819345 + ,28.36416371 + ,-1.683071403 + ,7.852903374 + ,-5.549821634 + ,8.427960424 + ,0.092844006 + ,7.89581562 + ,-14.01757424 + ,-21.8600192 + ,-23.03795723 + ,-15.16791154 + ,-17.28173498 + ,25.33011244 + ,8.5387545 + ,9.137448334 + ,21.69744238 + ,45.24159336 + ,20.67284586 + ,3.136447656 + ,-31.21631202 + ,-16.38338635 + ,-26.48595374 + ,-28.49659812 + ,-23.79111162 + ,36.69683353 + ,21.7815733 + ,10.68583046 + ,13.55138783 + ,22.27837801 + ,9.792469716 + ,-5.804661742 + ,-30.41815467 + ,-34.83585311 + ,-29.48904461 + ,-12.97103997 + ,-18.53690445 + ,14.10796047 + ,12.44962003 + ,7.09166281 + ,27.69500581 + ,24.82046264 + ,-16.766979 + ,-35.66628456 + ,-38.8819516 + ,-20.17550548 + ,-14.20455243 + ,-6.650802614 + ,-16.18092192 + ,24.25663153 + ,15.79097961 + ,4.427743978 + ,15.22580856 + ,18.17291664 + ,21.70712624 + ,16.22815529 + ,15.13282287 + ,4.221479788 + ,-4.025356356 + ,-15.2689129 + ,-26.79633857 + ,9.456791794 + ,15.60671679 + ,20.00867369 + ,15.1719308 + ,4.98222086 + ,8.779612446 + ,-3.120796043 + ,1.662433994 + ,-8.779007713 + ,-3.255942484 + ,-13.06118154 + ,-24.75028972 + ,15.28708152 + ,17.32124739 + ,22.78235303 + ,25.90475889 + ,29.28335366 + ,-6.450950051 + ,-16.84580409 + ,-26.85701961 + ,-13.33006875 + ,-17.93861095 + ,-8.811079108 + ,-21.76741639 + ,11.09391952 + ,4.952050071 + ,0.829786516 + ,12.56882318 + ,-13.56260833 + ,-7.706938304 + ,-12.59406354 + ,6.802449754 + ,4.752069695 + ,-16.83380343 + ,-33.11449211 + ,-38.07904992 + ,-4.390619601 + ,-10.80539465 + ,-42.5701834 + ,-19.17367194 + ,-48.90715649 + ,-36.25353951 + ,-24.42630006 + ,82.18457793 + ,62.31468142 + ,66.70929185 + ,36.76723424 + ,22.64130752 + ,39.5702183 + ,21.39592372 + ,4.891826209 + ,8.249028909 + ,4.319956044 + ,-10.6220153 + ,-7.707930757 + ,26.18979231 + ,8.756155686 + ,-13.212974 + ,-33.82770471 + ,-67.92630454 + ,-3.506438968 + ,13.51022124 + ,19.62654245 + ,7.604163885 + ,5.258515067 + ,10.89996777 + ,5.566749751 + ,19.61717026 + ,42.4005549 + ,15.94844648 + ,-36.60241093 + ,-50.43713745 + ,15.77575859 + ,-3.914550728 + ,17.95886229 + ,12.19357552 + ,14.93931015 + ,14.27214631 + ,-26.01025379 + ,11.49098464 + ,-6.155754594 + ,-1.837986892 + ,-37.29463141 + ,-35.13514505 + ,-16.50443739 + ,21.92306492 + ,6.305807161 + ,13.94984962 + ,-0.724386281 + ,-2.311520658 + ,8.289109243) > ylimmax = '' > ylimmin = '' > main = 'Robustness of Central Tendency' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > geomean <- function(x) { + return(exp(mean(log(x)))) + } > harmean <- function(x) { + return(1/mean(1/x)) + } > quamean <- function(x) { + return(sqrt(mean(x*x))) + } > winmean <- function(x) { + x <-sort(x[!is.na(x)]) + n<-length(x) + denom <- 3 + nodenom <- n/denom + if (nodenom>40) denom <- n/40 + sqrtn = sqrt(n) + roundnodenom = floor(nodenom) + win <- array(NA,dim=c(roundnodenom,2)) + for (j in 1:roundnodenom) { + win[j,1] <- (j*x[j+1]+sum(x[(j+1):(n-j)])+j*x[n-j])/n + win[j,2] <- sd(c(rep(x[j+1],j),x[(j+1):(n-j)],rep(x[n-j],j)))/sqrtn + } + return(win) + } > trimean <- function(x) { + x <-sort(x[!is.na(x)]) + n<-length(x) + denom <- 3 + nodenom <- n/denom + if (nodenom>40) denom <- n/40 + sqrtn = sqrt(n) + roundnodenom = floor(nodenom) + tri <- array(NA,dim=c(roundnodenom,2)) + for (j in 1:roundnodenom) { + tri[j,1] <- mean(x,trim=j/n) + tri[j,2] <- sd(x[(j+1):(n-j)]) / sqrt(n-j*2) + } + return(tri) + } > midrange <- function(x) { + return((max(x)+min(x))/2) + } > q1 <- function(data,n,p,i,f) { + np <- n*p; + i <<- floor(np) + f <<- np - i + qvalue <- (1-f)*data[i] + f*data[i+1] + } > q2 <- function(data,n,p,i,f) { + np <- (n+1)*p + i <<- floor(np) + f <<- np - i + qvalue <- (1-f)*data[i] + f*data[i+1] + } > q3 <- function(data,n,p,i,f) { + np <- n*p + i <<- floor(np) + f <<- np - i + if (f==0) { + qvalue <- data[i] + } else { + qvalue <- data[i+1] + } + } > q4 <- function(data,n,p,i,f) { + np <- n*p + i <<- floor(np) + f <<- np - i + if (f==0) { + qvalue <- (data[i]+data[i+1])/2 + } else { + qvalue <- data[i+1] + } + } > q5 <- function(data,n,p,i,f) { + np <- (n-1)*p + i <<- floor(np) + f <<- np - i + if (f==0) { + qvalue <- data[i+1] + } else { + qvalue <- data[i+1] + f*(data[i+2]-data[i+1]) + } + } > q6 <- function(data,n,p,i,f) { + np <- n*p+0.5 + i <<- floor(np) + f <<- np - i + qvalue <- data[i] + } > q7 <- function(data,n,p,i,f) { + np <- (n+1)*p + i <<- floor(np) + f <<- np - i + if (f==0) { + qvalue <- data[i] + } else { + qvalue <- f*data[i] + (1-f)*data[i+1] + } + } > q8 <- function(data,n,p,i,f) { + np <- (n+1)*p + i <<- floor(np) + f <<- np - i + if (f==0) { + qvalue <- data[i] + } else { + if (f == 0.5) { + qvalue <- (data[i]+data[i+1])/2 + } else { + if (f < 0.5) { + qvalue <- data[i] + } else { + qvalue <- data[i+1] + } + } + } + } > midmean <- function(x,def) { + x <-sort(x[!is.na(x)]) + n<-length(x) + if (def==1) { + qvalue1 <- q1(x,n,0.25,i,f) + qvalue3 <- q1(x,n,0.75,i,f) + } + if (def==2) { + qvalue1 <- q2(x,n,0.25,i,f) + qvalue3 <- q2(x,n,0.75,i,f) + } + if (def==3) { + qvalue1 <- q3(x,n,0.25,i,f) + qvalue3 <- q3(x,n,0.75,i,f) + } + if (def==4) { + qvalue1 <- q4(x,n,0.25,i,f) + qvalue3 <- q4(x,n,0.75,i,f) + } + if (def==5) { + qvalue1 <- q5(x,n,0.25,i,f) + qvalue3 <- q5(x,n,0.75,i,f) + } + if (def==6) { + qvalue1 <- q6(x,n,0.25,i,f) + qvalue3 <- q6(x,n,0.75,i,f) + } + if (def==7) { + qvalue1 <- q7(x,n,0.25,i,f) + qvalue3 <- q7(x,n,0.75,i,f) + } + if (def==8) { + qvalue1 <- q8(x,n,0.25,i,f) + qvalue3 <- q8(x,n,0.75,i,f) + } + midm <- 0 + myn <- 0 + roundno4 <- round(n/4) + round3no4 <- round(3*n/4) + for (i in 1:n) { + if ((x[i]>=qvalue1) & (x[i]<=qvalue3)){ + midm = midm + x[i] + myn = myn + 1 + } + } + midm = midm / myn + return(midm) + } > (arm <- mean(x)) [1] 0.09243392 > sqrtn <- sqrt(length(x)) > (armse <- sd(x) / sqrtn) [1] 1.154332 > (armose <- arm / armse) [1] 0.08007569 > (geo <- geomean(x)) [1] NaN Warning message: In log(x) : NaNs produced > (har <- harmean(x)) [1] -5.351959 > (qua <- quamean(x)) [1] 22.23419 > (win <- winmean(x)) [,1] [,2] [1,] 0.106209196 1.1418656 [2,] 0.097711662 1.1382024 [3,] 0.072330639 1.1316240 [4,] 0.043410516 1.1264238 [5,] 0.069755282 1.1178368 [6,] -0.019229600 1.1020501 [7,] 0.007180417 1.0935317 [8,] 0.023726512 1.0913063 [9,] 0.006999660 1.0860933 [10,] -0.060317840 1.0771363 [11,] -0.055079167 1.0752651 [12,] -0.079776806 1.0699301 [13,] -0.121290364 1.0618084 [14,] -0.207340914 1.0513238 [15,] -0.207585227 1.0485477 [16,] -0.238531417 1.0415805 [17,] -0.295740639 1.0348440 [18,] -0.287469556 1.0318540 [19,] -0.285148426 1.0309664 [20,] -0.294789296 1.0270271 [21,] -0.351095945 1.0213290 [22,] -0.490972786 1.0036880 [23,] -0.563485461 0.9917356 [24,] -0.583234100 0.9826265 [25,] -0.605336012 0.9802309 [26,] -0.564390499 0.9760807 [27,] -0.489000800 0.9666946 [28,] -0.468406562 0.9632833 [29,] -0.480000121 0.9572340 [30,] -0.431606083 0.9529794 [31,] -0.411781071 0.9512432 [32,] -0.427139046 0.9490240 [33,] -0.376366681 0.9437197 [34,] -0.357163878 0.9402272 [35,] -0.318176762 0.9340004 [36,] -0.334476083 0.9316057 [37,] -0.247993261 0.9235266 [38,] -0.362926115 0.9134147 [39,] -0.357576021 0.9129953 [40,] -0.360352845 0.9084340 [41,] -0.369020435 0.9070276 [42,] -0.411523289 0.9023996 [43,] -0.429266560 0.8947120 [44,] -0.450897034 0.8925381 [45,] -0.462244383 0.8894828 [46,] -0.431698374 0.8845388 [47,] -0.575282657 0.8734730 [48,] -0.615647715 0.8704788 [49,] -0.621269111 0.8681391 [50,] -0.620083490 0.8608044 [51,] -0.603373290 0.8573292 [52,] -0.575195523 0.8526784 [53,] -0.587934826 0.8510430 [54,] -0.521306042 0.8430499 [55,] -0.522740820 0.8415538 [56,] -0.443533110 0.8354924 [57,] -0.462199706 0.8307843 [58,] -0.373605127 0.8237322 [59,] -0.408325696 0.8098716 [60,] -0.430919650 0.8064992 [61,] -0.425711119 0.8047167 [62,] -0.410931440 0.7946431 [63,] -0.388834375 0.7910881 [64,] -0.363349479 0.7879974 [65,] -0.331991237 0.7842887 [66,] -0.313528823 0.7785341 [67,] -0.301036489 0.7774348 [68,] -0.337842140 0.7724942 [69,] -0.300916181 0.7585578 [70,] -0.344093391 0.7465666 [71,] -0.231423484 0.7377739 [72,] -0.222438201 0.7353847 [73,] -0.263165125 0.7324749 [74,] -0.301125903 0.7294527 [75,] -0.368220964 0.7224269 [76,] -0.434209212 0.7178661 [77,] -0.383932118 0.7129618 [78,] -0.373858393 0.7121020 [79,] -0.488780421 0.7012809 [80,] -0.496041535 0.7007184 [81,] -0.527729417 0.6948679 [82,] -0.473998901 0.6868529 [83,] -0.377211693 0.6804419 [84,] -0.377938871 0.6800451 [85,] -0.401294991 0.6765812 [86,] -0.443936438 0.6698494 [87,] -0.445263644 0.6680962 [88,] -0.440165518 0.6672900 [89,] -0.447483595 0.6665929 [90,] -0.450433166 0.6655721 [91,] -0.468159007 0.6606666 [92,] -0.477331818 0.6537040 [93,] -0.500728525 0.6429669 [94,] -0.440201102 0.6377411 [95,] -0.395697534 0.6296136 [96,] -0.410435467 0.6254255 [97,] -0.506667916 0.6185394 [98,] -0.508989860 0.6180197 [99,] -0.464185651 0.6144749 [100,] -0.516408659 0.6089488 [101,] -0.465231364 0.6011913 [102,] -0.375334053 0.5950870 [103,] -0.380413662 0.5933479 [104,] -0.440294519 0.5847050 [105,] -0.440394678 0.5819663 [106,] -0.448860462 0.5813870 [107,] -0.477768744 0.5789841 [108,] -0.466546499 0.5717315 [109,] -0.448699935 0.5680417 [110,] -0.475108676 0.5654605 [111,] -0.588717098 0.5512645 [112,] -0.648395091 0.5434807 [113,] -0.629051845 0.5416006 [114,] -0.627102926 0.5391335 [115,] -0.659194783 0.5338950 [116,] -0.590571799 0.5237560 [117,] -0.588303452 0.5214551 [118,] -0.531356754 0.5141127 [119,] -0.682262056 0.4931609 [120,] -0.697784415 0.4812885 [121,] -0.594753543 0.4746898 [122,] -0.613314944 0.4671657 [123,] -0.510281819 0.4596942 [124,] -0.467686862 0.4549561 > (tri <- trimean(x)) [,1] [,2] [1,] 0.054397687 1.1241420 [2,] 0.002023009 1.1056964 [3,] -0.046605650 1.0884660 [4,] -0.087122408 1.0729573 [5,] -0.120657109 1.0582999 [6,] -0.160009004 1.0450334 [7,] -0.184389794 1.0343170 [8,] -0.212986953 1.0246298 [9,] -0.244080670 1.0149203 [10,] -0.273563588 1.0055578 [11,] -0.296228565 0.9969571 [12,] -0.319663145 0.9882563 [13,] -0.319663145 0.9798024 [14,] -0.359445200 0.9718438 [15,] -0.371262826 0.9645706 [16,] -0.383201662 0.9572766 [17,] -0.393153092 0.9502978 [18,] -0.399497180 0.9436001 [19,] -0.406429029 0.9368840 [20,] -0.413581278 0.9299851 [21,] -0.420276826 0.9231089 [22,] -0.424013076 0.9163666 [23,] -0.420539984 0.9105331 [24,] -0.413404219 0.9052347 [25,] -0.405229179 0.9002911 [26,] -0.405229179 0.8953002 [27,] -0.388344450 0.8903590 [28,] -0.383955777 0.8857574 [29,] -0.380382564 0.8811640 [30,] -0.376286882 0.8767151 [31,] -0.374074114 0.8723144 [32,] -0.372605011 0.8678280 [33,] -0.370533253 0.8632745 [34,] -0.370316941 0.8588029 [35,] -0.370793464 0.8543216 [36,] -0.372657599 0.8499585 [37,] -0.373981566 0.8455298 [38,] -0.378260936 0.8412967 [39,] -0.378771547 0.8373547 [40,] -0.379463919 0.8332639 [41,] -0.380076792 0.8292045 [42,] -0.380425112 0.8250333 [43,] -0.379462032 0.8208871 [44,] -0.377944894 0.8168977 [45,] -0.375757741 0.8128268 [46,] -0.373204326 0.8087072 [47,] -0.371502747 0.8046164 [48,] -0.365658920 0.8008090 [49,] -0.358588069 0.7969520 [50,] -0.351256335 0.7930149 [51,] -0.351256335 0.7892008 [52,] -0.343848654 0.7853523 [53,] -0.330373364 0.7815145 [54,] -0.323525675 0.7775609 [55,] -0.318325343 0.7737474 [56,] -0.313007682 0.7698103 [57,] -0.309646977 0.7659304 [58,] -0.305757886 0.7620507 [59,] -0.304044665 0.7582653 [60,] -0.301435535 0.7548448 [61,] -0.298224329 0.7513824 [62,] -0.295089408 0.7478120 [63,] -0.295089408 0.7444563 [64,] -0.289927005 0.7410640 [65,] -0.288163500 0.7376134 [66,] -0.287118377 0.7341252 [67,] -0.286492919 0.7306769 [68,] -0.286150761 0.7270840 [69,] -0.284942290 0.7234915 [70,] -0.284571083 0.7202537 [71,] -0.283195785 0.7173027 [72,] -0.284385511 0.7145215 [73,] -0.285801711 0.7116661 [74,] -0.286316682 0.7087524 [75,] -0.285981338 0.7057809 [76,] -0.284127208 0.7029046 [77,] -0.280757429 0.7000284 [78,] -0.278449770 0.6971664 [79,] -0.276323481 0.6941567 [80,] -0.271604471 0.6913851 [81,] -0.266634793 0.6884536 [82,] -0.260869884 0.6855649 [83,] -0.256176301 0.6828094 [84,] -0.253517125 0.6801279 [85,] -0.250789350 0.6772763 [86,] -0.247495933 0.6743696 [87,] -0.243204421 0.6715375 [88,] -0.238796373 0.6685776 [89,] -0.234408526 0.6654422 [90,] -0.229769953 0.6621149 [91,] -0.224969561 0.6585975 [92,] -0.219681598 0.6550462 [93,] -0.214080506 0.6515485 [94,] -0.207849027 0.6482705 [95,] -0.202796714 0.6449835 [96,] -0.198600275 0.6418134 [97,] -0.193988694 0.6385871 [98,] -0.187175394 0.6354174 [99,] -0.180154811 0.6320210 [100,] -0.173949768 0.6285254 [101,] -0.166455961 0.6250099 [102,] -0.166455961 0.6215843 [103,] -0.159905723 0.6181760 [104,] -0.155172712 0.6145693 [105,] -0.143807450 0.6110842 [106,] -0.137240162 0.6074393 [107,] -0.130318574 0.6035128 [108,] -0.122575256 0.5993746 [109,] -0.114881815 0.5952649 [110,] -0.107386623 0.5909970 [111,] -0.099096163 0.5864945 [112,] -0.088009056 0.5823621 [113,] -0.075260548 0.5782751 [114,] -0.062600127 0.5739188 [115,] -0.049627861 0.5693006 [116,] -0.035543458 0.5645538 [117,] -0.022645498 0.5599750 [118,] -0.009421217 0.5550949 [119,] 0.002858066 0.5502063 [120,] 0.019083218 0.5461032 [121,] 0.036177754 0.5423017 [122,] 0.051331837 0.5385258 [123,] 0.067416185 0.5348062 [124,] 0.081506381 0.5311722 > (midr <- midrange(x)) [1] 7.129137 > midm <- array(NA,dim=8) > for (j in 1:8) midm[j] <- midmean(x,j) > midm [1] -0.2994647 -0.2140805 -0.2994647 -0.2140805 -0.2140805 -0.2994647 -0.2140805 [8] -0.2196816 > postscript(file="/var/wessaorg/rcomp/tmp/1rnw11322745607.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > lb <- win[,1] - 2*win[,2] > ub <- win[,1] + 2*win[,2] > if ((ylimmin == '') | (ylimmax == '')) plot(win[,1],type='b',main=main, xlab='j', pch=19, ylab='Winsorized Mean(j/n)', ylim=c(min(lb),max(ub))) else plot(win[,1],type='l',main=main, xlab='j', pch=19, ylab='Winsorized Mean(j/n)', ylim=c(ylimmin,ylimmax)) > lines(ub,lty=3) > lines(lb,lty=3) > grid() > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/2f2171322745607.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > lb <- tri[,1] - 2*tri[,2] > ub <- tri[,1] + 2*tri[,2] > if ((ylimmin == '') | (ylimmax == '')) plot(tri[,1],type='b',main=main, xlab='j', pch=19, ylab='Trimmed Mean(j/n)', ylim=c(min(lb),max(ub))) else plot(tri[,1],type='l',main=main, xlab='j', pch=19, ylab='Trimmed Mean(j/n)', ylim=c(ylimmin,ylimmax)) > lines(ub,lty=3) > lines(lb,lty=3) > grid() > 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,'Central Tendency - Ungrouped Data',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Measure',header=TRUE) > a<-table.element(a,'Value',header=TRUE) > a<-table.element(a,'S.E.',header=TRUE) > a<-table.element(a,'Value/S.E.',header=TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/arithmetic_mean.htm', 'Arithmetic Mean', 'click to view the definition of the Arithmetic Mean'),header=TRUE) > a<-table.element(a,arm) > a<-table.element(a,hyperlink('http://www.xycoon.com/arithmetic_mean_standard_error.htm', armse, 'click to view the definition of the Standard Error of the Arithmetic Mean')) > a<-table.element(a,armose) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/geometric_mean.htm', 'Geometric Mean', 'click to view the definition of the Geometric Mean'),header=TRUE) > a<-table.element(a,geo) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/harmonic_mean.htm', 'Harmonic Mean', 'click to view the definition of the Harmonic Mean'),header=TRUE) > a<-table.element(a,har) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/quadratic_mean.htm', 'Quadratic Mean', 'click to view the definition of the Quadratic Mean'),header=TRUE) > a<-table.element(a,qua) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > for (j in 1:length(win[,1])) { + a<-table.row.start(a) + mylabel <- paste('Winsorized Mean (',j) + mylabel <- paste(mylabel,'/') + mylabel <- paste(mylabel,length(win[,1])) + mylabel <- paste(mylabel,')') + a<-table.element(a,hyperlink('http://www.xycoon.com/winsorized_mean.htm', mylabel, 'click to view the definition of the Winsorized Mean'),header=TRUE) + a<-table.element(a,win[j,1]) + a<-table.element(a,win[j,2]) + a<-table.element(a,win[j,1]/win[j,2]) + a<-table.row.end(a) + } > for (j in 1:length(tri[,1])) { + a<-table.row.start(a) + mylabel <- paste('Trimmed Mean (',j) + mylabel <- paste(mylabel,'/') + mylabel <- paste(mylabel,length(tri[,1])) + mylabel <- paste(mylabel,')') + a<-table.element(a,hyperlink('http://www.xycoon.com/arithmetic_mean.htm', mylabel, 'click to view the definition of the Trimmed Mean'),header=TRUE) + a<-table.element(a,tri[j,1]) + a<-table.element(a,tri[j,2]) + a<-table.element(a,tri[j,1]/tri[j,2]) + a<-table.row.end(a) + } > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/median_1.htm', 'Median', 'click to view the definition of the Median'),header=TRUE) > a<-table.element(a,median(x)) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/midrange.htm', 'Midrange', 'click to view the definition of the Midrange'),header=TRUE) > a<-table.element(a,midr) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > a<-table.row.start(a) > mymid <- hyperlink('http://www.xycoon.com/midmean.htm', 'Midmean', 'click to view the definition of the Midmean') > mylabel <- paste(mymid,hyperlink('http://www.xycoon.com/method_1.htm','Weighted Average at Xnp',''),sep=' - ') > a<-table.element(a,mylabel,header=TRUE) > a<-table.element(a,midm[1]) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > a<-table.row.start(a) > mymid <- hyperlink('http://www.xycoon.com/midmean.htm', 'Midmean', 'click to view the definition of the Midmean') > mylabel <- paste(mymid,hyperlink('http://www.xycoon.com/method_2.htm','Weighted Average at X(n+1)p',''),sep=' - ') > a<-table.element(a,mylabel,header=TRUE) > a<-table.element(a,midm[2]) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > a<-table.row.start(a) > mymid <- hyperlink('http://www.xycoon.com/midmean.htm', 'Midmean', 'click to view the definition of the Midmean') > mylabel <- paste(mymid,hyperlink('http://www.xycoon.com/method_3.htm','Empirical Distribution Function',''),sep=' - ') > a<-table.element(a,mylabel,header=TRUE) > a<-table.element(a,midm[3]) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > a<-table.row.start(a) > mymid <- hyperlink('http://www.xycoon.com/midmean.htm', 'Midmean', 'click to view the definition of the Midmean') > mylabel <- paste(mymid,hyperlink('http://www.xycoon.com/method_4.htm','Empirical Distribution Function - Averaging',''),sep=' - ') > a<-table.element(a,mylabel,header=TRUE) > a<-table.element(a,midm[4]) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > a<-table.row.start(a) > mymid <- hyperlink('http://www.xycoon.com/midmean.htm', 'Midmean', 'click to view the definition of the Midmean') > mylabel <- paste(mymid,hyperlink('http://www.xycoon.com/method_5.htm','Empirical Distribution Function - Interpolation',''),sep=' - ') > a<-table.element(a,mylabel,header=TRUE) > a<-table.element(a,midm[5]) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > a<-table.row.start(a) > mymid <- hyperlink('http://www.xycoon.com/midmean.htm', 'Midmean', 'click to view the definition of the Midmean') > mylabel <- paste(mymid,hyperlink('http://www.xycoon.com/method_6.htm','Closest Observation',''),sep=' - ') > a<-table.element(a,mylabel,header=TRUE) > a<-table.element(a,midm[6]) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > a<-table.row.start(a) > mymid <- hyperlink('http://www.xycoon.com/midmean.htm', 'Midmean', 'click to view the definition of the Midmean') > mylabel <- paste(mymid,hyperlink('http://www.xycoon.com/method_7.htm','True Basic - Statistics Graphics Toolkit',''),sep=' - ') > a<-table.element(a,mylabel,header=TRUE) > a<-table.element(a,midm[7]) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > a<-table.row.start(a) > mymid <- hyperlink('http://www.xycoon.com/midmean.htm', 'Midmean', 'click to view the definition of the Midmean') > mylabel <- paste(mymid,hyperlink('http://www.xycoon.com/method_8.htm','MS Excel (old versions)',''),sep=' - ') > a<-table.element(a,mylabel,header=TRUE) > a<-table.element(a,midm[8]) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Number of observations',header=TRUE) > a<-table.element(a,length(x)) > a<-table.element(a,'') > a<-table.element(a,'') > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/33sel1322745607.tab") > > try(system("convert tmp/1rnw11322745607.ps tmp/1rnw11322745607.png",intern=TRUE)) character(0) > try(system("convert tmp/2f2171322745607.ps tmp/2f2171322745607.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.298 0.132 2.432