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(426.113 + ,383.703 + ,232.444 + ,70.939 + ,226.731 + ,947.293 + ,611.281 + ,158.047 + ,33.999 + ,37.028 + ,388.3 + ,506.652 + ,392.25 + ,180.818 + ,198.296 + ,217.465 + ,275.562 + ,1030.944 + ,57.47 + ,136.452 + ,556.277 + ,213.361 + ,274.482 + ,220.553 + ,236.71 + ,260.642 + ,2763.544 + ,213.923 + ,169.861 + ,403.064 + ,449.594 + ,406.167 + ,206.893 + ,156.187 + ,257.102 + ,62.156 + ,662.883 + ,251.422 + ,171.328 + ,350.089 + ,221.588 + ,4.813 + ,183.186 + ,190.379 + ,223.166 + ,232.669 + ,356.725 + ,109.215 + ,475.834 + ,315.955 + ,694.87 + ,8.95 + ,278.741 + ,308.16 + ,207.533 + ,192.797 + ,601.162 + ,289.714 + ,293.671 + ,386.688 + ,699.645 + ,85.094 + ,131.812 + ,645.285 + ,197.549 + ,308.174 + ,86.58 + ,242.205 + ,238.502 + ,187.881 + ,140.321 + ,440.31 + ,421.403 + ,218.761 + ,1305.923 + ,137.55 + ,262.517 + ,348.821 + ,150.034 + ,64.016 + ,261.596 + ,259.7 + ,171.26 + ,203.077 + ,249.148 + ,211.655 + ,252.64 + ,438.555 + ,239.89 + ,401.915 + ,216.886 + ,184.641 + ,380.155 + ,653.641 + ,313.906 + ,366.936 + ,236.302 + ,229.641 + ,235.577 + ,103.898 + ,263.906 + ,241.171 + ,216.548 + ,295.281 + ,193.299 + ,204.386 + ,257.567 + ,136.813 + ,240.755 + ,59.609 + ,213.511 + ,380.531 + ,242.344 + ,250.407 + ,183.613 + ,191.835 + ,266.793 + ,246.542 + ,330.563 + ,403.556 + ,208.108 + ,324.04 + ,308.532 + ,199.297 + ,200.156 + ,262.875 + ,287.069 + ,190.157 + ,199.746 + ,265.777 + ,435.956 + ,72.844 + ,756.46 + ,206.771 + ,4202.361 + ,401.422 + ,216.046 + ,39.047 + ,441.437) > 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/wessaorg/rcomp/tmp/1636t1356090967.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/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,'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/wessaorg/rcomp/tmp/29jup1356090967.tab") > > try(system("convert tmp/1636t1356090967.ps tmp/1636t1356090967.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.678 0.173 1.830