R version 2.12.0 (2010-10-15) Copyright (C) 2010 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(40.9545 + ,41.1575 + ,41.539 + ,41.651 + ,41.813 + ,42.304 + ,42.4125 + ,42.463 + ,42.391 + ,42.3173 + ,42.3215 + ,42.1962 + ,42.17 + ,41.922 + ,42.28 + ,42.7017 + ,42.815 + ,43.31 + ,43.43 + ,43.1885 + ,43.1555 + ,42.8993 + ,42.7523 + ,42.55 + ,42.3172 + ,42.2875 + ,42.4705 + ,42.4507 + ,43.0028 + ,42.695 + ,42.29 + ,42.3575 + ,42.565 + ,42.3188 + ,42.0055 + ,41.68 + ,41.575 + ,41.593 + ,41.5745 + ,41.36 + ,41.64 + ,41.8045 + ,41.8 + ,41.6923 + ,41.3725 + ,41.15 + ,41.2235 + ,41.374 + ,41.3557 + ,41.456 + ,40.7955 + ,40.55 + ,40.485 + ,40.5875 + ,40.1 + ,39.557 + ,39.3325 + ,39.282 + ,39.2763 + ,39.2301 + ,39.2537 + ,39.4398 + ,39.382 + ,39.388 + ,39.3572 + ,39.1038 + ,39.0046 + ,39.07 + ,39.089 + ,39.029 + ,38.9655 + ,38.913 + ,38.9199 + ,39.0908 + ,39.1614 + ,39.1144 + ,39.1325 + ,39.1183 + ,39.1906 + ,39.3685 + ,39.4723 + ,39.64 + ,39.35 + ,39.301 + ,39.3261 + ,39.384 + ,39.4305 + ,39.4173 + ,39.4514 + ,39.297 + ,39.355 + ,39.185 + ,39.143 + ,39.1355 + ,39.0437 + ,39.2795 + ,39.5095 + ,39.4907 + ,39.1644 + ,38.849 + ,38.691 + ,38.7665 + ,39.0275 + ,39.14 + ,39.1503 + ,39.1015 + ,39.0387 + ,39.0801 + ,38.581 + ,38.282 + ,38.13 + ,38.2615 + ,38.31 + ,38.235 + ,38.0524 + ,38.0075 + ,38.1375 + ,38.384 + ,38.214 + ,38.35 + ,38.48 + ,38.431 + ,38.091 + ,38.0912 + ,38.0615 + ,38.007 + ,37.969 + ,37.745 + ,37.9828 + ,38.063 + ,38.029 + ,38.034 + ,37.92 + ,37.795 + ,38.2885 + ,38.505 + ,38.45 + ,39.0459 + ,38.559 + ,37.78 + ,37.603 + ,37.626 + ,37.7325 + ,37.72 + ,38.0277 + ,38.384 + ,38.8691 + ,38.898 + ,38.615 + ,38.511 + ,38.54 + ,38.78 + ,38.839 + ,38.7577 + ,38.8205 + ,38.79 + ,38.77 + ,38.8592 + ,38.9285 + ,38.9845 + ,39.2535 + ,39.2675 + ,39.295 + ,39.33 + ,39.4845 + ,39.5025 + ,39.3946 + ,39.2025 + ,39.1742 + ,39.1435 + ,39.2735 + ,39.5985 + ,39.695 + ,39.6675 + ,39.8145 + ,39.525 + ,39.5415 + ,39.62 + ,39.8828 + ,39.954 + ,39.675 + ,39.95 + ,40.127 + ,40.251 + ,40.2696 + ,40.3055 + ,40.245 + ,40.2815 + ,40.3985 + ,40.6165 + ,40.522 + ,40.7 + ,40.7 + ,40.5145 + ,40.5471 + ,40.7305 + ,40.595 + ,40.69 + ,40.794 + ,40.858 + ,40.633 + ,40.819 + ,41.185 + ,41.1587 + ,41.137 + ,41.088 + ,41.373 + ,41.58 + ,41.764 + ,41.706 + ,41.735 + ,41.685 + ,41.86 + ,42.0475 + ,42.251 + ,42.34 + ,42.465 + ,42.615 + ,42.7345 + ,42.605 + ,42.1824 + ,41.8618 + ,42.014 + ,42.3735 + ,42.538 + ,42.5015 + ,42.673 + ,43.04 + ,42.6974 + ,42.6285 + ,42.5 + ,42.6175 + ,42.85 + ,43.1 + ,43.16 + ,43.154 + ,43.5 + ,43.3316 + ,42.755 + ,42.71 + ,43.1707 + ,43.6041 + ,43.79 + ,43.9685 + ,44.191 + ,44.094 + ,43.9725 + ,44.075 + ,44.373 + ,44.8505 + ,44.8737 + ,45.07 + ,44.14 + ,44.1582 + ,44.03 + ,44.11 + ,43.92 + ,43.98 + ,43.7769 + ,43.831 + ,43.45 + ,43.1625 + ,43.1274 + ,43.08 + ,42.9468 + ,42.9048 + ,42.7995 + ,42.9545 + ,42.9278 + ,43.007 + ,43.08 + ,43.0194 + ,43.0865 + ,43.0866 + ,43.2461 + ,43.1972 + ,43.0487 + ,43.1401 + ,43.01 + ,43.1957 + ,43.236 + ,43.3745 + ,43.385 + ,43.5325 + ,43.606 + ,43.589 + ,43.639 + ,43.7425 + ,43.699 + ,43.751 + ,43.8216 + ,43.8885 + ,43.5885 + ,43.6587 + ,43.6939 + ,43.7065 + ,43.9 + ,43.955 + ,43.9119 + ,43.7294 + ,43.98 + ,43.8814 + ,44.112 + ,44.1365 + ,44.259 + ,44.407 + ,44.5532 + ,44.54 + ,44.5 + ,44.6026 + ,44.9271 + ,45.095 + ,44.9152 + ,44.8015 + ,44.9614 + ,45.2 + ,45.37 + ,45.1005 + ,45.1308 + ,45.34 + ,45.3921 + ,45.5685 + ,45.4645 + ,45.3466 + ,45.1935 + ,44.9315 + ,44.9399 + ,45.041 + ,45.39 + ,45.22 + ,45.056 + ,45.105 + ,45.48 + ,45.12 + ,45.412 + ,46.09 + ,45.769 + ,45.0035 + ,45.445 + ,44.951 + ,44.8946 + ,44.842 + ,44.4465 + ,44.54 + ,44.506 + ,44.217 + ,43.8914 + ,43.8435 + ,44.099 + ,44.361 + ,44.2661 + ,44.11 + ,43.98 + ,44.801 + ,44.9351 + ,44.9035 + ,45.189 + ,45.89 + ,45.4005 + ,44.52 + ,44.125 + ,44.0625 + ,43.811 + ,43.7877 + ,43.8009 + ,43.887 + ,43.881 + ,43.8375 + ,43.858 + ,43.54 + ,43.8104 + ,43.93 + ,43.41 + ,43.4098 + ,43.4455 + ,43.324 + ,43.2647 + ,43.2745 + ,43.3717 + ,43.263 + ,43.632 + ,43.5033 + ,43.5215 + ,43.5789 + ,43.644 + ,43.6217 + ,43.5755 + ,43.5185 + ,43.4455 + ,43.3105 + ,43.3886 + ,43.6023 + ,43.4875 + ,43.5016 + ,43.3869 + ,43.332 + ,43.3374 + ,43.3415 + ,43.528 + ,43.7155 + ,43.5957 + ,43.8935 + ,43.8726 + ,43.598 + ,43.6295 + ,43.736 + ,43.9435 + ,43.7095 + ,43.863 + ,43.93 + ,43.671 + ,43.865 + ,43.991 + ,43.937 + ,43.9595 + ,44.1807 + ,43.7864 + ,43.6835 + ,44.047 + ,44.1005 + ,44.3217 + ,44.5043 + ,44.6317 + ,44.479 + ,44.7815 + ,44.8257 + ,44.833 + ,44.879 + ,45.032 + ,44.8913 + ,44.7692 + ,45.4005 + ,45.411 + ,45.2115 + ,45.2775 + ,45.492 + ,45.6515 + ,45.1795 + ,44.7465 + ,45.1465 + ,44.7265 + ,44.9973 + ,44.7644 + ,44.7625 + ,44.791 + ,45.2865 + ,45.0615 + ,45.2445 + ,45.7697 + ,45.5782 + ,45.4977 + ,45.535 + ,45.8005 + ,45.9195 + ,46.0205 + ,45.5664 + ,45.697 + ,45.3942 + ,45.7558 + ,44.9847 + ,44.4395 + ,44.6081 + ,45.55 + ,46.4113 + ,46.7135 + ,46.4607 + ,46.601 + ,46.527 + ,46.5075 + ,46.1685 + ,45.7585 + ,45.7293 + ,44.7265 + ,43.535 + ,42.8528 + ,42.2975 + ,42.3687 + ,42.4185 + ,43.116 + ,43.5998 + ,43.1521 + ,42.2892 + ,41.84 + ,41.4113 + ,41.6005 + ,41.5613 + ,41.47 + ,39.9068 + ,38.8859 + ,39.5915 + ,40.7819) > 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: Wessa, P., (2007), Central Tendency (v1.0.2) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_centraltendency.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] 42.26087 > sqrtn <- sqrt(length(x)) > (armse <- sd(x) / sqrtn) [1] 0.1082181 > (armose <- arm / armse) [1] 390.5159 > (geo <- geomean(x)) [1] 42.19200 > (har <- harmean(x)) [1] 42.12220 > (qua <- quamean(x)) [1] 42.32871 > (win <- winmean(x)) [,1] [,2] [1,] 42.26069 0.10819495 [2,] 42.26077 0.10813734 [3,] 42.26073 0.10812123 [4,] 42.26045 0.10808214 [5,] 42.26030 0.10801218 [6,] 42.25752 0.10777045 [7,] 42.25818 0.10753966 [8,] 42.25785 0.10739260 [9,] 42.25625 0.10724129 [10,] 42.25614 0.10715957 [11,] 42.25415 0.10702149 [12,] 42.25389 0.10693088 [13,] 42.25391 0.10692686 [14,] 42.25375 0.10689531 [15,] 42.25423 0.10684459 [16,] 42.25366 0.10676325 [17,] 42.25260 0.10668509 [18,] 42.25195 0.10649375 [19,] 42.24912 0.10631010 [20,] 42.25031 0.10615920 [21,] 42.25054 0.10612808 [22,] 42.25323 0.10581222 [23,] 42.25352 0.10569114 [24,] 42.25299 0.10547587 [25,] 42.25374 0.10537721 [26,] 42.25345 0.10531095 [27,] 42.25378 0.10516709 [28,] 42.25495 0.10492404 [29,] 42.25501 0.10465151 [30,] 42.25495 0.10464775 [31,] 42.25725 0.10438398 [32,] 42.25849 0.10429152 [33,] 42.26008 0.10411567 [34,] 42.26167 0.10397878 [35,] 42.26195 0.10393806 [36,] 42.26261 0.10369200 [37,] 42.26227 0.10347971 [38,] 42.26347 0.10332456 [39,] 42.26192 0.10287204 [40,] 42.26738 0.10238338 [41,] 42.27019 0.10182399 [42,] 42.26885 0.10164647 [43,] 42.26841 0.10158086 [44,] 42.26827 0.10145708 [45,] 42.26859 0.10135772 [46,] 42.27103 0.10113334 [47,] 42.27189 0.10095675 [48,] 42.26964 0.10070009 [49,] 42.26909 0.10053839 [50,] 42.26900 0.10040486 [51,] 42.26919 0.10019430 [52,] 42.27000 0.10007856 [53,] 42.27102 0.09993313 [54,] 42.26903 0.09972301 [55,] 42.26904 0.09960250 [56,] 42.27263 0.09927875 [57,] 42.27310 0.09902955 [58,] 42.27441 0.09880832 [59,] 42.27374 0.09842835 [60,] 42.27316 0.09837316 [61,] 42.27280 0.09820377 [62,] 42.27049 0.09799599 [63,] 42.26944 0.09790234 [64,] 42.27113 0.09761087 [65,] 42.27184 0.09748601 [66,] 42.27255 0.09737916 [67,] 42.27219 0.09732934 [68,] 42.27203 0.09713892 [69,] 42.27071 0.09702622 [70,] 42.27095 0.09685542 [71,] 42.27103 0.09679155 [72,] 42.27131 0.09655374 [73,] 42.27097 0.09648075 [74,] 42.26815 0.09624378 [75,] 42.26731 0.09614236 [76,] 42.26600 0.09606117 [77,] 42.26592 0.09592807 [78,] 42.26384 0.09560243 [79,] 42.26424 0.09556612 [80,] 42.26421 0.09537230 [81,] 42.26442 0.09516990 [82,] 42.26330 0.09499742 [83,] 42.26450 0.09482108 [84,] 42.26890 0.09449304 [85,] 42.27018 0.09407858 [86,] 42.26671 0.09388855 [87,] 42.26916 0.09372857 [88,] 42.25324 0.09275903 [89,] 42.24947 0.09250252 [90,] 42.24905 0.09241162 [91,] 42.24036 0.09190816 [92,] 42.24032 0.09162140 [93,] 42.24070 0.09159655 [94,] 42.23764 0.09135062 [95,] 42.23978 0.09089449 [96,] 42.24021 0.09082771 [97,] 42.23986 0.09075222 [98,] 42.23916 0.09031142 [99,] 42.23362 0.08991517 [100,] 42.23264 0.08981435 [101,] 42.22828 0.08932847 [102,] 42.22402 0.08879505 [103,] 42.22192 0.08864349 [104,] 42.21444 0.08818013 [105,] 42.20397 0.08751189 [106,] 42.20733 0.08711751 [107,] 42.20106 0.08649184 [108,] 42.19738 0.08608695 [109,] 42.19767 0.08581073 [110,] 42.19731 0.08526797 [111,] 42.19596 0.08489545 [112,] 42.19657 0.08476600 [113,] 42.19664 0.08446569 [114,] 42.19525 0.08421949 [115,] 42.19841 0.08396164 [116,] 42.20231 0.08370855 [117,] 42.20374 0.08336389 [118,] 42.21167 0.08281083 [119,] 42.21215 0.08264497 [120,] 42.21277 0.08209067 [121,] 42.21461 0.08163073 [122,] 42.21760 0.08101364 [123,] 42.21522 0.08069709 [124,] 42.21042 0.07992270 [125,] 42.23804 0.07785154 [126,] 42.25557 0.07674177 [127,] 42.26177 0.07635054 [128,] 42.27108 0.07555321 [129,] 42.27108 0.07543905 [130,] 42.30735 0.07292346 [131,] 42.31336 0.07242353 [132,] 42.34199 0.07033774 [133,] 42.34185 0.07015711 [134,] 42.34502 0.06976003 [135,] 42.34829 0.06956150 [136,] 42.35217 0.06903038 [137,] 42.37586 0.06736301 [138,] 42.39682 0.06575763 [139,] 42.40334 0.06517706 [140,] 42.40488 0.06502269 [141,] 42.41125 0.06455846 [142,] 42.41166 0.06448878 [143,] 42.42095 0.06377046 [144,] 42.42303 0.06363597 [145,] 42.42690 0.06314816 [146,] 42.42954 0.06275577 [147,] 42.44601 0.06173392 [148,] 42.44752 0.06148844 [149,] 42.44312 0.06128284 [150,] 42.45060 0.06065727 [151,] 42.46441 0.05965152 [152,] 42.46525 0.05930004 [153,] 42.46241 0.05911917 [154,] 42.46959 0.05868681 [155,] 42.47890 0.05784155 [156,] 42.50610 0.05593496 [157,] 42.54805 0.05350295 [158,] 42.56340 0.05260779 [159,] 42.56454 0.05222913 [160,] 42.55854 0.05169543 [161,] 42.55615 0.05154259 [162,] 42.56268 0.05096240 [163,] 42.57327 0.05015584 > (tri <- trimean(x)) [,1] [,2] [1,] 42.26087 0.10785750 [2,] 42.26129 0.10751155 [3,] 42.26247 0.10718668 [4,] 42.26247 0.10685914 [5,] 42.26373 0.10653357 [6,] 42.26443 0.10621458 [7,] 42.26561 0.10593077 [8,] 42.26561 0.10567537 [9,] 42.26786 0.10543326 [10,] 42.26921 0.10520310 [11,] 42.27057 0.10497567 [12,] 42.27214 0.10475595 [13,] 42.27375 0.10453858 [14,] 42.27537 0.10431530 [15,] 42.27701 0.10408823 [16,] 42.27701 0.10385863 [17,] 42.28032 0.10362844 [18,] 42.28208 0.10339707 [19,] 42.28389 0.10317185 [20,] 42.28588 0.10295171 [21,] 42.28783 0.10273438 [22,] 42.28978 0.10251239 [23,] 42.29161 0.10230195 [24,] 42.29344 0.10209179 [25,] 42.29532 0.10188666 [26,] 42.29718 0.10168030 [27,] 42.29907 0.10147082 [28,] 42.30096 0.10126185 [29,] 42.30283 0.10105796 [30,] 42.30471 0.10086026 [31,] 42.30661 0.10065632 [32,] 42.30661 0.10045763 [33,] 42.31024 0.10025653 [34,] 42.31200 0.10005640 [35,] 42.31373 0.09985548 [36,] 42.31546 0.09964959 [37,] 42.31719 0.09944685 [38,] 42.31895 0.09924572 [39,] 42.32068 0.09904392 [40,] 42.32248 0.09885252 [41,] 42.32414 0.09867307 [42,] 42.32573 0.09850799 [43,] 42.32737 0.09834324 [44,] 42.32904 0.09817474 [45,] 42.33073 0.09800440 [46,] 42.33243 0.09783125 [47,] 42.33408 0.09765955 [48,] 42.33572 0.09748752 [49,] 42.33744 0.09731758 [50,] 42.33920 0.09714657 [51,] 42.34097 0.09697346 [52,] 42.34275 0.09680063 [53,] 42.34454 0.09662496 [54,] 42.34632 0.09644725 [55,] 42.34816 0.09626930 [56,] 42.35002 0.09608826 [57,] 42.35182 0.09591054 [58,] 42.35363 0.09573363 [59,] 42.35543 0.09555661 [60,] 42.35726 0.09538417 [61,] 42.35913 0.09520637 [62,] 42.36102 0.09502652 [63,] 42.36299 0.09484552 [64,] 42.36299 0.09465988 [65,] 42.36699 0.09447552 [66,] 42.36899 0.09428734 [67,] 42.37100 0.09409465 [68,] 42.37304 0.09389551 [69,] 42.37511 0.09369384 [70,] 42.37722 0.09348713 [71,] 42.37936 0.09327700 [72,] 42.38152 0.09306011 [73,] 42.38370 0.09284134 [74,] 42.38591 0.09261567 [75,] 42.38820 0.09238747 [76,] 42.39053 0.09215275 [77,] 42.39292 0.09191062 [78,] 42.39534 0.09166240 [79,] 42.39782 0.09141331 [80,] 42.40033 0.09115497 [81,] 42.40287 0.09089160 [82,] 42.40544 0.09062326 [83,] 42.40806 0.09034870 [84,] 42.41069 0.09006799 [85,] 42.41327 0.08978561 [86,] 42.41586 0.08950367 [87,] 42.41854 0.08921507 [88,] 42.42122 0.08891918 [89,] 42.42422 0.08863761 [90,] 42.42732 0.08835089 [91,] 42.43046 0.08805427 [92,] 42.43380 0.08775848 [93,] 42.43719 0.08745807 [94,] 42.44061 0.08714511 [95,] 42.44414 0.08682517 [96,] 42.44767 0.08650492 [97,] 42.45124 0.08617236 [98,] 42.45487 0.08582708 [99,] 42.45856 0.08547956 [100,] 42.46239 0.08512752 [101,] 42.46629 0.08476233 [102,] 42.47032 0.08439466 [103,] 42.47448 0.08402575 [104,] 42.47874 0.08364396 [105,] 42.48318 0.08325735 [106,] 42.48786 0.08287129 [107,] 42.49255 0.08247985 [108,] 42.49741 0.08208796 [109,] 42.50241 0.08168897 [110,] 42.50748 0.08127928 [111,] 42.51262 0.08086672 [112,] 42.51787 0.08044530 [113,] 42.52318 0.08000713 [114,] 42.52858 0.07955682 [115,] 42.53408 0.07909150 [116,] 42.53961 0.07861202 [117,] 42.54517 0.07811767 [118,] 42.55079 0.07761010 [119,] 42.55636 0.07709765 [120,] 42.56202 0.07656441 [121,] 42.56776 0.07602290 [122,] 42.57356 0.07546965 [123,] 42.57356 0.07490996 [124,] 42.58539 0.07433079 [125,] 42.59156 0.07374677 [126,] 42.59737 0.07321591 [127,] 42.60299 0.07270185 [128,] 42.60299 0.07217542 [129,] 42.61416 0.07165192 [130,] 42.61981 0.07110291 [131,] 42.62496 0.07062870 [132,] 42.63011 0.07014748 [133,] 42.63487 0.06972471 [134,] 42.63972 0.06928333 [135,] 42.64461 0.06883143 [136,] 42.64953 0.06836087 [137,] 42.65448 0.06788355 [138,] 42.65912 0.06744947 [139,] 42.66350 0.06705672 [140,] 42.66786 0.06666331 [141,] 42.67227 0.06625110 [142,] 42.67666 0.06583271 [143,] 42.68113 0.06539005 [144,] 42.68553 0.06495087 [145,] 42.68998 0.06448902 [146,] 42.69446 0.06401836 [147,] 42.69898 0.06353388 [148,] 42.70332 0.06306658 [149,] 42.70771 0.06257864 [150,] 42.71228 0.06206459 [151,] 42.71681 0.06154602 [152,] 42.72120 0.06104226 [153,] 42.72567 0.06051933 [154,] 42.73029 0.05996635 [155,] 42.73488 0.05939734 [156,] 42.73941 0.05883201 [157,] 42.74356 0.05832918 [158,] 42.74705 0.05792102 [159,] 42.75035 0.05752917 [160,] 42.75370 0.05712519 [161,] 42.75725 0.05671305 [162,] 42.76092 0.05627459 [163,] 42.76456 0.05583286 > (midr <- midrange(x)) [1] 42.15825 > midm <- array(NA,dim=8) > for (j in 1:8) midm[j] <- midmean(x,j) > midm [1] 42.56757 42.57356 42.57356 42.57356 42.57941 42.56757 42.57356 42.57356 > postscript(file="/var/www/rcomp/tmp/1vg0e1291668922.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/www/rcomp/tmp/2vg0e1291668922.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/www/rcomp/tmp/303tt1291668923.tab") > > try(system("convert tmp/1vg0e1291668922.ps tmp/1vg0e1291668922.png",intern=TRUE)) character(0) > try(system("convert tmp/2vg0e1291668922.ps tmp/2vg0e1291668922.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.260 0.330 3.639