R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
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(15561600,14917500,14805920,16958000,17605000,17131200,18474600,17286700,18574400,18056000,19701600,19061700,19681900,34521200,19922700,20177900,19759900,23076700,22532000,22029400,22587000,23256600,22680300,21916400,19640200,18813100,18730000,18154700,17848800,18077500,17133100,16602600,15878900,15789100,15422000,14661400,15879200,14339300,13169600,14528900,13375800,12309900,11933900,10061900,12609600,11156500,12187200,11284300,10177000,10970720,10820680,11492390,14573750,13992820,14727070,15685360,16736210,17950180,17002730,17415160,17929810,17865790,19202360,19085000,18188880,18466410,18520400,20025500,20636100,20672000,22589100,21864800,22750100,22548746,21325495,21556563,21415269,20401054,19062253,19085706,19279967,18552045,17800733,17142490,17593173,17633859,17336613,17008347,17951965,14520929,16941217,15436824,14744261,14248004,11540953,12881661,15185757,13554339,13575106,12238400,13303614,14151478,14172009,14022320)
> ylimmax = ''
> ylimmin = ''
> #'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!)
>
> #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/rcomp/createtable")
>
> x <-sort(x[!is.na(x)])
> num <- 50
> res <- array(NA,dim=c(num,3))
> 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]
+ }
+ }
+ }
+ }
> iqd <- 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)
+ }
+ iqdiff <- qvalue3 - qvalue1
+ return(c(iqdiff,iqdiff/2,iqdiff/(qvalue3 + qvalue1)))
+ }
> 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)
+ }
> range <- max(x) - min(x)
> lx <- length(x)
> biasf <- (lx-1)/lx
> varx <- var(x)
> bvarx <- varx*biasf
> sdx <- sqrt(varx)
> mx <- mean(x)
> bsdx <- sqrt(bvarx)
> x2 <- x*x
> mse0 <- sum(x2)/lx
> xmm <- x-mx
> xmm2 <- xmm*xmm
> msem <- sum(xmm2)/lx
> axmm <- abs(x - mx)
> medx <- median(x)
> axmmed <- abs(x - medx)
> xmmed <- x - medx
> xmmed2 <- xmmed*xmmed
> msemed <- sum(xmmed2)/lx
> qarr <- array(NA,dim=c(8,3))
> for (j in 1:8) {
+ qarr[j,] <- iqd(x,j)
+ }
> sdpo <- 0
> adpo <- 0
> for (i in 1:(lx-1)) {
+ for (j in (i+1):lx) {
+ ldi <- x[i]-x[j]
+ aldi <- abs(ldi)
+ sdpo = sdpo + ldi * ldi
+ adpo = adpo + aldi
+ }
+ }
> denom <- (lx*(lx-1)/2)
> sdpo = sdpo / denom
> adpo = adpo / denom
> gmd <- 0
> for (i in 1:lx) {
+ for (j in 1:lx) {
+ ldi <- abs(x[i]-x[j])
+ gmd = gmd + ldi
+ }
+ }
> gmd <- gmd / (lx*(lx-1))
> sumx <- sum(x)
> pk <- x / sumx
> ck <- cumsum(pk)
> dk <- array(NA,dim=lx)
> for (i in 1:lx) {
+ if (ck[i] <= 0.5) dk[i] <- ck[i] else dk[i] <- 1 - ck[i]
+ }
> bigd <- sum(dk) * 2 / (lx-1)
> iod <- 1 - sum(pk*pk)
> res[1,] <- c('Absolute range','http://www.xycoon.com/absolute.htm', range)
> res[2,] <- c('Relative range (unbiased)','http://www.xycoon.com/relative.htm', range/sd(x))
> res[3,] <- c('Relative range (biased)','http://www.xycoon.com/relative.htm', range/sqrt(varx*biasf))
> res[4,] <- c('Variance (unbiased)','http://www.xycoon.com/unbiased.htm', varx)
> res[5,] <- c('Variance (biased)','http://www.xycoon.com/biased.htm', bvarx)
> res[6,] <- c('Standard Deviation (unbiased)','http://www.xycoon.com/unbiased1.htm', sdx)
> res[7,] <- c('Standard Deviation (biased)','http://www.xycoon.com/biased1.htm', bsdx)
> res[8,] <- c('Coefficient of Variation (unbiased)','http://www.xycoon.com/variation.htm', sdx/mx)
> res[9,] <- c('Coefficient of Variation (biased)','http://www.xycoon.com/variation.htm', bsdx/mx)
> res[10,] <- c('Mean Squared Error (MSE versus 0)','http://www.xycoon.com/mse.htm', mse0)
> res[11,] <- c('Mean Squared Error (MSE versus Mean)','http://www.xycoon.com/mse.htm', msem)
> res[12,] <- c('Mean Absolute Deviation from Mean (MAD Mean)', 'http://www.xycoon.com/mean2.htm', sum(axmm)/lx)
> res[13,] <- c('Mean Absolute Deviation from Median (MAD Median)', 'http://www.xycoon.com/median1.htm', sum(axmmed)/lx)
> res[14,] <- c('Median Absolute Deviation from Mean', 'http://www.xycoon.com/mean3.htm', median(axmm))
> res[15,] <- c('Median Absolute Deviation from Median', 'http://www.xycoon.com/median2.htm', median(axmmed))
> res[16,] <- c('Mean Squared Deviation from Mean', 'http://www.xycoon.com/mean1.htm', msem)
> res[17,] <- c('Mean Squared Deviation from Median', 'http://www.xycoon.com/median.htm', msemed)
> mylink1 <- hyperlink('http://www.xycoon.com/difference.htm','Interquartile Difference','')
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_1.htm','(Weighted Average at Xnp)',''),sep=' ')
> res[18,] <- c('', mylink2, qarr[1,1])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_2.htm','(Weighted Average at X(n+1)p)',''),sep=' ')
> res[19,] <- c('', mylink2, qarr[2,1])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_3.htm','(Empirical Distribution Function)',''),sep=' ')
> res[20,] <- c('', mylink2, qarr[3,1])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_4.htm','(Empirical Distribution Function - Averaging)',''),sep=' ')
> res[21,] <- c('', mylink2, qarr[4,1])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_5.htm','(Empirical Distribution Function - Interpolation)',''),sep=' ')
> res[22,] <- c('', mylink2, qarr[5,1])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_6.htm','(Closest Observation)',''),sep=' ')
> res[23,] <- c('', mylink2, qarr[6,1])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_7.htm','(True Basic - Statistics Graphics Toolkit)',''),sep=' ')
> res[24,] <- c('', mylink2, qarr[7,1])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_8.htm','(MS Excel (old versions))',''),sep=' ')
> res[25,] <- c('', mylink2, qarr[8,1])
> mylink1 <- hyperlink('http://www.xycoon.com/deviation.htm','Semi Interquartile Difference','')
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_1.htm','(Weighted Average at Xnp)',''),sep=' ')
> res[26,] <- c('', mylink2, qarr[1,2])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_2.htm','(Weighted Average at X(n+1)p)',''),sep=' ')
> res[27,] <- c('', mylink2, qarr[2,2])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_3.htm','(Empirical Distribution Function)',''),sep=' ')
> res[28,] <- c('', mylink2, qarr[3,2])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_4.htm','(Empirical Distribution Function - Averaging)',''),sep=' ')
> res[29,] <- c('', mylink2, qarr[4,2])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_5.htm','(Empirical Distribution Function - Interpolation)',''),sep=' ')
> res[30,] <- c('', mylink2, qarr[5,2])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_6.htm','(Closest Observation)',''),sep=' ')
> res[31,] <- c('', mylink2, qarr[6,2])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_7.htm','(True Basic - Statistics Graphics Toolkit)',''),sep=' ')
> res[32,] <- c('', mylink2, qarr[7,2])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_8.htm','(MS Excel (old versions))',''),sep=' ')
> res[33,] <- c('', mylink2, qarr[8,2])
> mylink1 <- hyperlink('http://www.xycoon.com/variation1.htm','Coefficient of Quartile Variation','')
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_1.htm','(Weighted Average at Xnp)',''),sep=' ')
> res[34,] <- c('', mylink2, qarr[1,3])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_2.htm','(Weighted Average at X(n+1)p)',''),sep=' ')
> res[35,] <- c('', mylink2, qarr[2,3])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_3.htm','(Empirical Distribution Function)',''),sep=' ')
> res[36,] <- c('', mylink2, qarr[3,3])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_4.htm','(Empirical Distribution Function - Averaging)',''),sep=' ')
> res[37,] <- c('', mylink2, qarr[4,3])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_5.htm','(Empirical Distribution Function - Interpolation)',''),sep=' ')
> res[38,] <- c('', mylink2, qarr[5,3])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_6.htm','(Closest Observation)',''),sep=' ')
> res[39,] <- c('', mylink2, qarr[6,3])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_7.htm','(True Basic - Statistics Graphics Toolkit)',''),sep=' ')
> res[40,] <- c('', mylink2, qarr[7,3])
> mylink2 <- paste(mylink1,hyperlink('http://www.xycoon.com/method_8.htm','(MS Excel (old versions))',''),sep=' ')
> res[41,] <- c('', mylink2, qarr[8,3])
> res[42,] <- c('Number of all Pairs of Observations', 'http://www.xycoon.com/pair_numbers.htm', lx*(lx-1)/2)
> res[43,] <- c('Squared Differences between all Pairs of Observations', 'http://www.xycoon.com/squared_differences.htm', sdpo)
> res[44,] <- c('Mean Absolute Differences between all Pairs of Observations', 'http://www.xycoon.com/mean_abs_differences.htm', adpo)
> res[45,] <- c('Gini Mean Difference', 'http://www.xycoon.com/gini_mean_difference.htm', gmd)
> res[46,] <- c('Leik Measure of Dispersion', 'http://www.xycoon.com/leiks_d.htm', bigd)
> res[47,] <- c('Index of Diversity', 'http://www.xycoon.com/diversity.htm', iod)
> res[48,] <- c('Index of Qualitative Variation', 'http://www.xycoon.com/qualitative_variation.htm', iod*lx/(lx-1))
> res[49,] <- c('Coefficient of Dispersion', 'http://www.xycoon.com/dispersion.htm', sum(axmm)/lx/medx)
> res[50,] <- c('Observations', '', lx)
> res
[,1]
[1,] "Absolute range"
[2,] "Relative range (unbiased)"
[3,] "Relative range (biased)"
[4,] "Variance (unbiased)"
[5,] "Variance (biased)"
[6,] "Standard Deviation (unbiased)"
[7,] "Standard Deviation (biased)"
[8,] "Coefficient of Variation (unbiased)"
[9,] "Coefficient of Variation (biased)"
[10,] "Mean Squared Error (MSE versus 0)"
[11,] "Mean Squared Error (MSE versus Mean)"
[12,] "Mean Absolute Deviation from Mean (MAD Mean)"
[13,] "Mean Absolute Deviation from Median (MAD Median)"
[14,] "Median Absolute Deviation from Mean"
[15,] "Median Absolute Deviation from Median"
[16,] "Mean Squared Deviation from Mean"
[17,] "Mean Squared Deviation from Median"
[18,] ""
[19,] ""
[20,] ""
[21,] ""
[22,] ""
[23,] ""
[24,] ""
[25,] ""
[26,] ""
[27,] ""
[28,] ""
[29,] ""
[30,] ""
[31,] ""
[32,] ""
[33,] ""
[34,] ""
[35,] ""
[36,] ""
[37,] ""
[38,] ""
[39,] ""
[40,] ""
[41,] ""
[42,] "Number of all Pairs of Observations"
[43,] "Squared Differences between all Pairs of Observations"
[44,] "Mean Absolute Differences between all Pairs of Observations"
[45,] "Gini Mean Difference"
[46,] "Leik Measure of Dispersion"
[47,] "Index of Diversity"
[48,] "Index of Qualitative Variation"
[49,] "Coefficient of Dispersion"
[50,] "Observations"
[,2]
[1,] "http://www.xycoon.com/absolute.htm"
[2,] "http://www.xycoon.com/relative.htm"
[3,] "http://www.xycoon.com/relative.htm"
[4,] "http://www.xycoon.com/unbiased.htm"
[5,] "http://www.xycoon.com/biased.htm"
[6,] "http://www.xycoon.com/unbiased1.htm"
[7,] "http://www.xycoon.com/biased1.htm"
[8,] "http://www.xycoon.com/variation.htm"
[9,] "http://www.xycoon.com/variation.htm"
[10,] "http://www.xycoon.com/mse.htm"
[11,] "http://www.xycoon.com/mse.htm"
[12,] "http://www.xycoon.com/mean2.htm"
[13,] "http://www.xycoon.com/median1.htm"
[14,] "http://www.xycoon.com/mean3.htm"
[15,] "http://www.xycoon.com/median2.htm"
[16,] "http://www.xycoon.com/mean1.htm"
[17,] "http://www.xycoon.com/median.htm"
[18,] "Interquartile Difference (Weighted Average at Xnp)"
[19,] "Interquartile Difference (Weighted Average at X(n+1)p)"
[20,] "Interquartile Difference (Empirical Distribution Function)"
[21,] "Interquartile Difference (Empirical Distribution Function - Averaging)"
[22,] "Interquartile Difference (Empirical Distribution Function - Interpolation)"
[23,] "Interquartile Difference (Closest Observation)"
[24,] "Interquartile Difference (True Basic - Statistics Graphics Toolkit)"
[25,] "Interquartile Difference (MS Excel (old versions))"
[26,] "Semi Interquartile Difference (Weighted Average at Xnp)"
[27,] "Semi Interquartile Difference (Weighted Average at X(n+1)p)"
[28,] "Semi Interquartile Difference (Empirical Distribution Function)"
[29,] "Semi Interquartile Difference (Empirical Distribution Function - Averaging)"
[30,] "Semi Interquartile Difference (Empirical Distribution Function - Interpolation)"
[31,] "Semi Interquartile Difference (Closest Observation)"
[32,] "Semi Interquartile Difference (True Basic - Statistics Graphics Toolkit)"
[33,] "Semi Interquartile Difference (MS Excel (old versions))"
[34,] "Coefficient of Quartile Variation (Weighted Average at Xnp)"
[35,] "Coefficient of Quartile Variation (Weighted Average at X(n+1)p)"
[36,] "Coefficient of Quartile Variation (Empirical Distribution Function)"
[37,] "Coefficient of Quartile Variation (Empirical Distribution Function - Averaging)"
[38,] "Coefficient of Quartile Variation (Empirical Distribution Function - Interpolation)"
[39,] "Coefficient of Quartile Variation (Closest Observation)"
[40,] "Coefficient of Quartile Variation (True Basic - Statistics Graphics Toolkit)"
[41,] "Coefficient of Quartile Variation (MS Excel (old versions))"
[42,] "http://www.xycoon.com/pair_numbers.htm"
[43,] "http://www.xycoon.com/squared_differences.htm"
[44,] "http://www.xycoon.com/mean_abs_differences.htm"
[45,] "http://www.xycoon.com/gini_mean_difference.htm"
[46,] "http://www.xycoon.com/leiks_d.htm"
[47,] "http://www.xycoon.com/diversity.htm"
[48,] "http://www.xycoon.com/qualitative_variation.htm"
[49,] "http://www.xycoon.com/dispersion.htm"
[50,] ""
[,3]
[1,] "24459300"
[2,] "6.51475035519945"
[3,] "6.54629896758497"
[4,] "14095889649136.2"
[5,] "13960352248663.7"
[6,] "3754449.31369917"
[7,] "3736355.47675321"
[8,] "0.21869575816968"
[9,] "0.217641796574126"
[10,] "308681820507053"
[11,] "13960352248663.7"
[12,] "2881323.625"
[13,] "2875777.36538462"
[14,] "2510250"
[15,] "2558390"
[16,] "13960352248663.7"
[17,] "14003796459936.3"
[18,] "4681431"
[19,] "4737643.5"
[20,] "4681431"
[21,] "4716249"
[22,] "4694854.5"
[23,] "4681431"
[24,] "4694854.5"
[25,] "4759038"
[26,] "2340715.5"
[27,] "2368821.75"
[28,] "2340715.5"
[29,] "2358124.5"
[30,] "2347427.25"
[31,] "2340715.5"
[32,] "2347427.25"
[33,] "2379519"
[34,] "0.138818933111773"
[35,] "0.140235479540641"
[36,] "0.138818933111773"
[37,] "0.139674172404625"
[38,] "0.139112286176382"
[39,] "0.138818933111773"
[40,] "0.139112286176382"
[41,] "0.140796208479207"
[42,] "5356"
[43,] "28191779298272.1"
[44,] "4118118.88125467"
[45,] "4118118.88125467"
[46,] "0.492026927252605"
[47,] "0.989929154311385"
[48,] "0.999540116974602"
[49,] "0.165823114981788"
[50,] "104"
> (arm <- mean(x))
[1] 17167454
> sqrtn <- sqrt(length(x))
> (armse <- sd(x) / sqrtn)
[1] 368154.0
> (armose <- arm / armse)
[1] 46.63117
> (geo <- geomean(x))
[1] 16771880
> (har <- harmean(x))
[1] 16378027
> (qua <- quamean(x))
[1] 17569343
> (win <- winmean(x))
[,1] [,2]
[1,] 17060247 332599.0
[2,] 17069166 329596.8
[3,] 17064073 327178.6
[4,] 17068534 325451.3
[5,] 17070293 323646.3
[6,] 17082177 321571.2
[7,] 17082871 320594.0
[8,] 17111810 315433.8
[9,] 17090236 304924.0
[10,] 17084293 302459.7
[11,] 17086398 300443.3
[12,] 17085413 289768.8
[13,] 17101759 282114.3
[14,] 17128435 274794.5
[15,] 17053510 258676.5
[16,] 17059092 256371.3
[17,] 17049856 247199.9
[18,] 17014827 241708.7
[19,] 17063298 227912.0
[20,] 17049202 224695.3
[21,] 17042409 217267.5
[22,] 17034419 215215.8
[23,] 17046869 212531.9
[24,] 17058314 208695.4
[25,] 17015380 193052.5
[26,] 16997971 190608.1
[27,] 16979330 185776.4
[28,] 17002738 182804.8
[29,] 17014707 179834.1
[30,] 17019506 179204.6
[31,] 16963784 168889.2
[32,] 16972547 161938.1
[33,] 17008294 146377.4
[34,] 17078219 136389.6
> (tri <- trimean(x))
[,1] [,2]
[1,] 17066981 326647.0
[2,] 17073985 319945.9
[3,] 17076542 314172.0
[4,] 17081045 308648.7
[5,] 17084505 302954.8
[6,] 17087718 296985.0
[7,] 17088786 290692.3
[8,] 17089784 283716.8
[9,] 17086455 276797.6
[10,] 17085935 270895.1
[11,] 17086143 264536.0
[12,] 17086113 257530.4
[13,] 17086190 251247.4
[14,] 17084551 245203.5
[15,] 17084551 239321.0
[16,] 17082711 234967.9
[17,] 17084904 230161.1
[18,] 17088057 225854.4
[19,] 17094468 221518.3
[20,] 17097134 218388.5
[21,] 17101154 215023.4
[22,] 17106003 211992.2
[23,] 17111837 208516.9
[24,] 17117083 204601.5
[25,] 17121799 200323.7
[26,] 17130313 197481.2
[27,] 17140900 194158.1
[28,] 17153866 190624.7
[29,] 17166069 186539.1
[30,] 17166069 181720.9
[31,] 17191521 175436.2
[32,] 17210621 169206.8
[33,] 17230983 162400.2
[34,] 17250478 157056.7
> (midr <- midrange(x))
[1] 22291550
> midm <- array(NA,dim=8)
> for (j in 1:8) midm[j] <- midmean(x,j)
> midm
[1] 17081079 17130313 17081079 17130313 17130313 17081079 17130313 17121799
> postscript(file="/var/www/html/rcomp/tmp/1qkns1292922423.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='Robustness of Central Tendency', xlab='j', pch=19, ylab='Winsorized Mean(j/n)', ylim=c(min(lb),max(ub))) else plot(win[,1],type='l',main='Robustness of Central Tendency', 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/html/rcomp/tmp/2qkns1292922423.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='Robustness of Central Tendency', xlab='j', pch=19, ylab='Trimmed Mean(j/n)', ylim=c(min(lb),max(ub))) else plot(tri[,1],type='l',main='Robustness of Central Tendency', 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
> 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/html/rcomp/tmp/33ghn1292922424.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,'Variability - Ungrouped Data',2,TRUE)
> a<-table.row.end(a)
> for (i in 1:num) {
+ a<-table.row.start(a)
+ if (res[i,1] != '') {
+ a<-table.element(a,hyperlink(res[i,2],res[i,1],''),header=TRUE)
+ } else {
+ a<-table.element(a,res[i,2],header=TRUE)
+ }
+ a<-table.element(a,res[i,3])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/4dpg71292922424.tab")
> 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/www/html/rcomp/tmp/5rhvy1292922424.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
> 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/www/html/rcomp/tmp/6vhu41292922424.tab")
> postscript(file="/var/www/html/rcomp/tmp/7vhu41292922424.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> myhist<-hist(x)
> dev.off()
null device
1
> myhist
$breaks
[1] 1.0e+07 1.5e+07 2.0e+07 2.5e+07 3.0e+07 3.5e+07
$counts
[1] 33 51 19 0 1
$intensities
[1] 6.346153e-08 9.807692e-08 3.653846e-08 0.000000e+00 1.923077e-09
$density
[1] 6.346153e-08 9.807692e-08 3.653846e-08 0.000000e+00 1.923077e-09
$mids
[1] 12500000 17500000 22500000 27500000 32500000
$xname
[1] "x"
$equidist
[1] TRUE
attr(,"class")
[1] "histogram"
> n <- length(x)
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/histogram.htm','Frequency Table (Histogram)',''),6,TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Bins',header=TRUE)
> a<-table.element(a,'Midpoint',header=TRUE)
> a<-table.element(a,'Abs. Frequency',header=TRUE)
> a<-table.element(a,'Rel. Frequency',header=TRUE)
> a<-table.element(a,'Cumul. Rel. Freq.',header=TRUE)
> a<-table.element(a,'Density',header=TRUE)
> a<-table.row.end(a)
> crf <- 0
> mybracket <- '['
> mynumrows <- (length(myhist$breaks)-1)
> for (i in 1:mynumrows) {
+ a<-table.row.start(a)
+ if (i == 1)
+ dum <- paste('[',myhist$breaks[i],sep='')
+ else
+ dum <- paste(mybracket,myhist$breaks[i],sep='')
+ dum <- paste(dum,myhist$breaks[i+1],sep=',')
+ if (i==mynumrows)
+ dum <- paste(dum,']',sep='')
+ else
+ dum <- paste(dum,mybracket,sep='')
+ a<-table.element(a,dum,header=TRUE)
+ a<-table.element(a,myhist$mids[i])
+ a<-table.element(a,myhist$counts[i])
+ rf <- myhist$counts[i]/n
+ crf <- crf + rf
+ a<-table.element(a,round(rf,6))
+ a<-table.element(a,round(crf,6))
+ a<-table.element(a,round(myhist$density[i],6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/8r9sv1292922424.tab")
> postscript(file="/var/www/html/rcomp/tmp/9r9sv1292922424.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> mydensity1<-density(x,kernel='gaussian',na.rm=TRUE)
> plot(mydensity1,main='Gaussian Kernel')
> grid()
> dev.off()
null device
1
> mydensity1
Call:
density.default(x = x, kernel = "gaussian", na.rm = TRUE)
Data: x (104 obs.); Bandwidth 'bw' = 1.246e+06
x y
Min. : 6325319 Min. :3.311e-13
1st Qu.:14308434 1st Qu.:4.878e-10
Median :22291550 Median :7.251e-09
Mean :22291550 Mean :3.128e-08
3rd Qu.:30274666 3rd Qu.:6.087e-08
Max. :38257781 Max. :1.122e-07
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,'Properties of Density Trace',2,TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Bandwidth',header=TRUE)
> a<-table.element(a,mydensity1$bw)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'#Observations',header=TRUE)
> a<-table.element(a,mydensity1$n)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/10c9q11292922424.tab")
>
> try(system("convert tmp/1qkns1292922423.ps tmp/1qkns1292922423.png",intern=TRUE))
character(0)
> try(system("convert tmp/2qkns1292922423.ps tmp/2qkns1292922423.png",intern=TRUE))
character(0)
> try(system("convert tmp/5rhvy1292922424.ps tmp/5rhvy1292922424.png",intern=TRUE))
character(0)
> try(system("convert tmp/7vhu41292922424.ps tmp/7vhu41292922424.png",intern=TRUE))
character(0)
> try(system("convert tmp/9r9sv1292922424.ps tmp/9r9sv1292922424.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
1.850 0.934 87.376