Home » date » 2007 » Dec » 17 » attachments

paper

R Software Module: rwasp_centraltendency.wasp (opens new window with default values)
Title produced by software: Central Tendency
Date of computation: Mon, 17 Dec 2007 03:28:05 -0700
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2007/Dec/17/t1197886290dshb4du3vlxdmdc.htm/, Retrieved Mon, 17 Dec 2007 11:11:32 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
0.00460316584004819 -0.0302484839034218 -0.105784551146344 0.0974893032337864 0.0920578948372688 0.086452806156105 -0.0681101882094906 -0.160419161298456 0.0089366805166815 0.0440330838800644 0.0339241779387143 0.0468977177820973 -0.0952590044935988 0.0773642200733375 -0.00640915630671213 0.0365934292389021 0.0473045151785438 -0.000948740436213846 0.0722617631222162 0.0121006558224304 0.108856312987872 -0.0403020351380086 0.0689565064357387 0.0937303493502366 -0.000779169153877213 0.133315483977626 -0.0940946911713736 -0.0682092496682918 0.0844230110907924 0.0218325222753766 0.150900531180362 0.00663010848478862 -0.0386235419906411 0.117557320893247 0.0327980130759844 0.105238068681218 0.00217588658576506 -0.0472383684742601 -0.0555803977119611 0.0190584938745264 0.0882733132787266 -0.0345137173632182 0.0319908661654482 0.104821166946678 0.0108575901217991 0.00844645062347382 0.0603855700581146 -0.0102700723736504 -0.140070739881804 -0.0700230454534374 -0.0104529238420934 0.0383206398895410 -0.133088510034663 0.079949733647826 0.0353463401624792 0.0832255460112812 0.00580065647567363 0.0565085760928445 0.0741711916122405 -0.0402888483780881 0.0968265800768284
 
Text written by user:
 
Output produced by software:


Summary of compuational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time1 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Central Tendency - Ungrouped Data
MeasureValueS.E.Value/S.E.
Arithmetic Mean0.01851969913519800.009073979503017212.04096770651069
Geometric MeanNaN
Harmonic Mean-0.0625253145557745
Quadratic Mean0.0726856622541808
Winsorized Mean ( 1 / 20 )0.01856500035181960.008903533936936552.08512715100711
Winsorized Mean ( 2 / 20 )0.01827726483584460.008731958991744732.09314597710824
Winsorized Mean ( 3 / 20 )0.01919216406451400.008289447298478822.31525255827802
Winsorized Mean ( 4 / 20 )0.01964510192327400.008078519522323212.43177006244636
Winsorized Mean ( 5 / 20 )0.01970636516816630.008049936430496942.44801500462902
Winsorized Mean ( 6 / 20 )0.02135290110308870.007400451992464572.88535093867659
Winsorized Mean ( 7 / 20 )0.0214849914046840.007344831982359292.92518487234103
Winsorized Mean ( 8 / 20 )0.02109192002530160.007273674028445372.89976151568201
Winsorized Mean ( 9 / 20 )0.02269382205581070.006867476165488473.30453597638319
Winsorized Mean ( 10 / 20 )0.02344094462616460.006509959513120143.60078193711065
Winsorized Mean ( 11 / 20 )0.02436347066468800.006234068034221353.90811754554923
Winsorized Mean ( 12 / 20 )0.02396676083411910.006167858735398053.88575060848445
Winsorized Mean ( 13 / 20 )0.02406646471941690.006064885517187433.96816471658275
Winsorized Mean ( 14 / 20 )0.02425787737016360.005782235773128094.19524182720077
Winsorized Mean ( 15 / 20 )0.02467092324359990.005504397340809294.48203894378975
Winsorized Mean ( 16 / 20 )0.02902568563054590.004556718713212246.36986556716475
Winsorized Mean ( 17 / 20 )0.02854450842781010.004461958383625876.3973049440713
Winsorized Mean ( 18 / 20 )0.02870847349089690.004140091000820186.93426146555947
Winsorized Mean ( 19 / 20 )0.02773962284113640.003476829323331687.97842524365126
Winsorized Mean ( 20 / 20 )0.02652407442050250.003272550325908068.10501650975914
Trimmed Mean ( 1 / 20 )0.01930881826042670.008577580437073912.25107982397581
Trimmed Mean ( 2 / 20 )0.02010483391700620.008175276384049872.45922375862804
Trimmed Mean ( 3 / 20 )0.02111830404383210.007791822095656022.71031650679059
Trimmed Mean ( 4 / 20 )0.02185726340696680.007535230891984032.90067600054811
Trimmed Mean ( 5 / 20 )0.02251874306630630.007297433651708183.08584416674143
Trimmed Mean ( 6 / 20 )0.02321896776747580.007004540686235353.31484515652875
Trimmed Mean ( 7 / 20 )0.02362262048565890.006840990025796093.45309968244105
Trimmed Mean ( 8 / 20 )0.02403657405372070.006643145146059483.61825212685266
Trimmed Mean ( 9 / 20 )0.02455873654131820.00640200667151673.83609980454769
Trimmed Mean ( 10 / 20 )0.02486702863783840.006199815156675054.01093065025742
Trimmed Mean ( 11 / 20 )0.02509008280376690.006026054288360354.16360052584155
Trimmed Mean ( 12 / 20 )0.02519898536023820.00586218116344544.29856817072980
Trimmed Mean ( 13 / 20 )0.02537795130331740.005649209148708874.49230160103341
Trimmed Mean ( 14 / 20 )0.02556443307865060.005377198125206924.75422933717304
Trimmed Mean ( 15 / 20 )0.02574807339712460.005076327910852245.07218482519224
Trimmed Mean ( 16 / 20 )0.02589912203934290.004729735750920625.4758074030461
Trimmed Mean ( 17 / 20 )0.02545763968039990.004546035278571095.59996527092544
Trimmed Mean ( 18 / 20 )0.02501458322488930.004288713044331975.83265491682848
Trimmed Mean ( 19 / 20 )0.02447031436926980.004003624461380876.11204037873969
Trimmed Mean ( 20 / 20 )0.02397049527958600.003832628815242786.25432214678674
Median0.0218325222753766
Midrange-0.00475931505904699
Midmean - Weighted Average at Xnp0.0240275351745841
Midmean - Weighted Average at X(n+1)p0.0257480733971246
Midmean - Empirical Distribution Function0.0257480733971246
Midmean - Empirical Distribution Function - Averaging0.0257480733971246
Midmean - Empirical Distribution Function - Interpolation0.0257480733971246
Midmean - Closest Observation0.0238648924358638
Midmean - True Basic - Statistics Graphics Toolkit0.0257480733971246
Midmean - MS Excel (old versions)0.0257480733971246
Number of observations61
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197886290dshb4du3vlxdmdc/1gz451197887281.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197886290dshb4du3vlxdmdc/1gz451197887281.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197886290dshb4du3vlxdmdc/2as3k1197887281.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/17/t1197886290dshb4du3vlxdmdc/2as3k1197887281.ps (open in new window)


 
Parameters (Session):
 
Parameters (R input):
 
R code (references can be found in the software module):
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))
sqrtn <- sqrt(length(x))
(armse <- sd(x) / sqrtn)
(armose <- arm / armse)
(geo <- geomean(x))
(har <- harmean(x))
(qua <- quamean(x))
(win <- winmean(x))
(tri <- trimean(x))
(midr <- midrange(x))
midm <- array(NA,dim=8)
for (j in 1:8) midm[j] <- midmean(x,j)
midm
bitmap(file='test1.png')
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()
bitmap(file='test2.png')
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()
load(file='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='mytable.tab')
 





Copyright

Creative Commons License

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.

Software written by Ed van Stee & Patrick Wessa


Disclaimer

Information provided on this web site is provided "AS IS" without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information and periodically update the information, and software without notice. However, we make no warranties or representations as to the accuracy or completeness of such information (or software), and we assume no liability or responsibility for errors or omissions in the content of this web site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and under no legal theory shall we be liable to you or any other person for any direct, indirect, special, incidental, exemplary, or consequential damages arising from your access to, or use of, this web site.


Privacy Policy

We may request personal information to be submitted to our servers in order to be able to:

We NEVER allow other companies to directly offer registered users information about their products and services. Banner references and hyperlinks of third parties NEVER contain any personal data of the visitor.

We do NOT sell, nor transmit by any means, personal information, nor statistical data series uploaded by you to third parties.

We carefully protect your data from loss, misuse, alteration, and destruction. However, at any time, and under any circumstance you are solely responsible for managing your passwords, and keeping them secret.

We store a unique ANONYMOUS USER ID in the form of a small 'Cookie' on your computer. This allows us to track your progress when using this website which is necessary to create state-dependent features. The cookie is used for NO OTHER PURPOSE. At any time you may opt to disallow cookies from this website - this will not affect other features of this website.

We examine cookies that are used by third-parties (banner and online ads) very closely: abuse from third-parties automatically results in termination of the advertising contract without refund. We have very good reason to believe that the cookies that are produced by third parties (banner ads) do NOT cause any privacy or security risk.

FreeStatistics.org is safe. There is no need to download any software to use the applications and services contained in this website. Hence, your system's security is not compromised by their use, and your personal data - other than data you submit in the account application form, and the user-agent information that is transmitted by your browser - is never transmitted to our servers.

As a general rule, we do not log on-line behavior of individuals (other than normal logging of webserver 'hits'). However, in cases of abuse, hacking, unauthorized access, Denial of Service attacks, illegal copying, hotlinking, non-compliance with international webstandards (such as robots.txt), or any other harmful behavior, our system engineers are empowered to log, track, identify, publish, and ban misbehaving individuals - even if this leads to ban entire blocks of IP addresses, or disclosing user's identity.


FreeStatistics.org is powered by