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(210907 + ,120982 + ,176508 + ,179321 + ,123185 + ,52746 + ,385534 + ,33170 + ,101645 + ,149061 + ,165446 + ,237213 + ,173326 + ,133131 + ,258873 + ,180083 + ,324799 + ,230964 + ,236785 + ,135473 + ,202925 + ,215147 + ,344297 + ,153935 + ,132943 + ,174724 + ,174415 + ,225548 + ,223632 + ,124817 + ,221698 + ,210767 + ,170266 + ,260561 + ,84853 + ,294424 + ,101011 + ,215641 + ,325107 + ,7176 + ,167542 + ,106408 + ,96560 + ,265769 + ,269651 + ,149112 + ,175824 + ,152871 + ,111665 + ,116408 + ,362301 + ,78800 + ,183167 + ,277965 + ,150629 + ,168809 + ,24188 + ,329267 + ,65029 + ,101097 + ,218946 + ,244052 + ,341570 + ,103597 + ,233328 + ,256462 + ,206161 + ,311473 + ,235800 + ,177939 + ,207176 + ,196553 + ,174184 + ,143246 + ,187559 + ,187681 + ,119016 + ,182192 + ,73566 + ,194979 + ,167488 + ,143756 + ,275541 + ,243199 + ,182999 + ,135649 + ,152299 + ,120221 + ,346485 + ,145790 + ,193339 + ,80953 + ,122774 + ,130585 + ,112611 + ,286468 + ,241066 + ,148446 + ,204713 + ,182079 + ,140344 + ,220516 + ,243060 + ,162765 + ,182613 + ,232138 + ,265318 + ,85574 + ,310839 + ,225060 + ,232317 + ,144966 + ,43287 + ,155754 + ,164709 + ,201940 + ,235454 + ,220801 + ,99466 + ,92661 + ,133328 + ,61361 + ,125930 + ,100750 + ,224549 + ,82316 + ,102010 + ,101523 + ,243511 + ,22938 + ,41566 + ,152474 + ,61857 + ,99923 + ,132487 + ,317394 + ,21054 + ,209641 + ,22648 + ,31414 + ,46698 + ,131698 + ,91735 + ,244749 + ,184510 + ,79863 + ,128423 + ,97839 + ,38214 + ,151101 + ,272458 + ,172494 + ,108043 + ,328107 + ,250579 + ,351067 + ,158015 + ,98866 + ,85439 + ,229242 + ,351619 + ,84207 + ,120445 + ,324598 + ,131069 + ,204271 + ,165543 + ,141722 + ,116048 + ,250047 + ,299775 + ,195838 + ,173260 + ,254488 + ,104389 + ,136084 + ,199476 + ,92499 + ,224330 + ,135781 + ,74408 + ,81240 + ,14688 + ,181633 + ,271856 + ,7199 + ,46660 + ,17547 + ,133368 + ,95227 + ,152601 + ,98146 + ,79619 + ,59194 + ,139942 + ,118612 + ,72880 + ,65475 + ,99643 + ,71965 + ,77272 + ,49289 + ,135131 + ,108446 + ,89746 + ,44296 + ,77648 + ,181528 + ,134019 + ,124064 + ,92630 + ,121848 + ,52915 + ,81872 + ,58981 + ,53515 + ,60812 + ,56375 + ,65490 + ,80949 + ,76302 + ,104011 + ,98104 + ,67989 + ,30989 + ,135458 + ,73504 + ,63123 + ,61254 + ,74914 + ,31774 + ,81437 + ,87186 + ,50090 + ,65745 + ,56653 + ,158399 + ,46455 + ,73624 + ,38395 + ,91899 + ,139526 + ,52164 + ,51567 + ,70551 + ,84856 + ,102538 + ,86678 + ,85709 + ,34662 + ,150580 + ,99611 + ,19349 + ,99373 + ,86230 + ,30837 + ,31706 + ,89806 + ,62088 + ,40151 + ,27634 + ,76990 + ,37460 + ,54157 + ,49862 + ,84337 + ,64175 + ,59382 + ,119308 + ,76702 + ,103425 + ,70344 + ,43410 + ,104838 + ,62215 + ,69304 + ,53117 + ,19764 + ,86680 + ,84105 + ,77945 + ,89113 + ,91005 + ,40248 + ,64187 + ,50857 + ,56613 + ,62792 + ,72535) > x <-sort(x[!is.na(x)]) > 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] + } + } + } + } > lx <- length(x) > qval <- array(NA,dim=c(99,8)) > mystep <- 25 > mystart <- 25 > if (lx>10){ + mystep=10 + mystart=10 + } > if (lx>20){ + mystep=5 + mystart=5 + } > if (lx>50){ + mystep=2 + mystart=2 + } > if (lx>=100){ + mystep=1 + mystart=1 + } > for (perc in seq(mystart,99,mystep)) { + qval[perc,1] <- q1(x,lx,perc/100,i,f) + qval[perc,2] <- q2(x,lx,perc/100,i,f) + qval[perc,3] <- q3(x,lx,perc/100,i,f) + qval[perc,4] <- q4(x,lx,perc/100,i,f) + qval[perc,5] <- q5(x,lx,perc/100,i,f) + qval[perc,6] <- q6(x,lx,perc/100,i,f) + qval[perc,7] <- q7(x,lx,perc/100,i,f) + qval[perc,8] <- q8(x,lx,perc/100,i,f) + } > postscript(file="/var/fisher/rcomp/tmp/17pmc1355760404.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > myqqnorm <- qqnorm(x,col=2) > qqline(x) > grid() > dev.off() null device 1 > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Percentiles - Ungrouped Data',9,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'p',1,TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/method_1.htm', 'Weighted Average at Xnp',''),1,TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/method_2.htm','Weighted Average at X(n+1)p',''),1,TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/method_3.htm','Empirical Distribution Function',''),1,TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/method_4.htm','Empirical Distribution Function - Averaging',''),1,TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/method_5.htm','Empirical Distribution Function - Interpolation',''),1,TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/method_6.htm','Closest Observation',''),1,TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/method_7.htm','True Basic - Statistics Graphics Toolkit',''),1,TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/method_8.htm','MS Excel (old versions)',''),1,TRUE) > a<-table.row.end(a) > for (perc in seq(mystart,99,mystep)) { + a<-table.row.start(a) + a<-table.element(a,round(perc/100,2),1,TRUE) + for (j in 1:8) { + a<-table.element(a,round(qval[perc,j],6)) + } + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/fisher/rcomp/tmp/25tyg1355760404.tab") > > try(system("convert tmp/17pmc1355760404.ps tmp/17pmc1355760404.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.682 0.293 1.954