R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(98.1,101.1,111.1,93.3,100,108,70.4,75.4,105.5,112.3,102.5,93.5,86.7,95.2,103.8,97,95.5,101,67.5,64,106.7,100.6,101.2,93.1,84.2,85.8,91.8,92.4,80.3,79.7,62.5,57.1,100.8,100.7,86.2,83.2,71.7,77.5,89.8,80.3,78.7,93.8,57.6,60.6,91,85.3,77.4,77.3,68.3,69.9,81.7,75.1,69.9,84,54.3,60,89.9,77,85.3,77.6,69.2,75.5,85.7,72.2,79.9,85.3,52.2,61.2,82.4,85.4,78.2,70.2,70.2,69.3,77.5,66.1,69,75.3,58.2,59.7) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Normality Plot (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxnorm.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > n <- length(x) > c <- array(NA,dim=c(401)) > l <- array(NA,dim=c(401)) > mx <- 0 > mxli <- -999 > for (i in 1:401) + { + l[i] <- (i-201)/100 + if (l[i] != 0) + { + x1 <- (x^l[i] - 1) / l[i] + } else { + x1 <- log(x) + } + c[i] <- cor(qnorm(ppoints(x), mean=0, sd=1),x1) + if (mx < c[i]) + { + mx <- c[i] + mxli <- l[i] + } + } > c [1] -0.5361473 -0.5365184 -0.5368892 -0.5372597 -0.5376298 -0.5379997 [7] -0.5383692 -0.5387383 -0.5391072 -0.5394757 -0.5398438 -0.5402117 [13] -0.5405791 -0.5409463 -0.5413131 -0.5416795 -0.5420456 -0.5424113 [19] -0.5427767 -0.5431417 -0.5435064 -0.5438706 -0.5442346 -0.5445981 [25] -0.5449613 -0.5453241 -0.5456866 -0.5460486 -0.5464103 -0.5467716 [31] -0.5471325 -0.5474930 -0.5478532 -0.5482129 -0.5485723 -0.5489312 [37] -0.5492898 -0.5496480 -0.5500057 -0.5503631 -0.5507200 -0.5510766 [43] -0.5514327 -0.5517884 -0.5521437 -0.5524986 -0.5528530 -0.5532071 [49] -0.5535607 -0.5539139 -0.5542666 -0.5546190 -0.5549709 -0.5553223 [55] -0.5556733 -0.5560239 -0.5563741 -0.5567238 -0.5570730 -0.5574218 [61] -0.5577702 -0.5581181 -0.5584655 -0.5588125 -0.5591590 -0.5595051 [67] -0.5598507 -0.5601958 -0.5605405 -0.5608847 -0.5612284 -0.5615717 [73] -0.5619144 -0.5622567 -0.5625986 -0.5629399 -0.5632807 -0.5636211 [79] -0.5639610 -0.5643004 -0.5646393 -0.5649777 -0.5653156 -0.5656530 [85] -0.5659899 -0.5663263 -0.5666622 -0.5669976 -0.5673324 -0.5676668 [91] -0.5680007 -0.5683340 -0.5686668 -0.5689991 -0.5693309 -0.5696622 [97] -0.5699929 -0.5703231 -0.5706528 -0.5709820 -0.5713106 -0.5716387 [103] -0.5719662 -0.5722933 -0.5726197 -0.5729457 -0.5732710 -0.5735959 [109] -0.5739202 -0.5742439 -0.5745671 -0.5748898 -0.5752118 -0.5755334 [115] -0.5758543 -0.5761748 -0.5764946 -0.5768139 -0.5771326 -0.5774508 [121] -0.5777683 -0.5780854 -0.5784018 -0.5787177 -0.5790329 -0.5793477 [127] -0.5796618 -0.5799753 -0.5802883 -0.5806007 -0.5809125 -0.5812237 [133] -0.5815343 -0.5818443 -0.5821537 -0.5824626 -0.5827708 -0.5830784 [139] -0.5833855 -0.5836919 -0.5839977 -0.5843030 -0.5846076 -0.5849116 [145] -0.5852150 -0.5855178 -0.5858200 -0.5861215 -0.5864225 -0.5867228 [151] -0.5870225 -0.5873216 -0.5876201 -0.5879179 -0.5882151 -0.5885117 [157] -0.5888077 -0.5891030 -0.5893977 -0.5896918 -0.5899852 -0.5902780 [163] -0.5905702 -0.5908617 -0.5911526 -0.5914428 -0.5917324 -0.5920214 [169] -0.5923097 -0.5925973 -0.5928843 -0.5931707 -0.5934564 -0.5937415 [175] -0.5940259 -0.5943096 -0.5945927 -0.5948751 -0.5951569 -0.5954380 [181] -0.5957185 -0.5959983 -0.5962774 -0.5965558 -0.5968336 -0.5971108 [187] -0.5973872 -0.5976630 -0.5979381 -0.5982125 -0.5984863 -0.5987594 [193] -0.5990318 -0.5993035 -0.5995746 -0.5998450 -0.6001147 -0.6003837 [199] -0.6006520 -0.6009196 -0.6011866 -0.6014529 -0.6017185 -0.6019833 [205] -0.6022475 -0.6025111 -0.6027739 -0.6030360 -0.6032974 -0.6035582 [211] -0.6038182 -0.6040776 -0.6043362 -0.6045942 -0.6048514 -0.6051079 [217] -0.6053638 -0.6056189 -0.6058734 -0.6061271 -0.6063801 -0.6066324 [223] -0.6068840 -0.6071349 -0.6073851 -0.6076346 -0.6078834 -0.6081314 [229] -0.6083788 -0.6086254 -0.6088713 -0.6091165 -0.6093610 -0.6096048 [235] -0.6098478 -0.6100902 -0.6103318 -0.6105727 -0.6108128 -0.6110523 [241] -0.6112910 -0.6115290 -0.6117663 -0.6120029 -0.6122387 -0.6124738 [247] -0.6127082 -0.6129418 -0.6131747 -0.6134069 -0.6136384 -0.6138691 [253] -0.6140991 -0.6143284 -0.6145570 -0.6147848 -0.6150118 -0.6152382 [259] -0.6154638 -0.6156887 -0.6159128 -0.6161362 -0.6163589 -0.6165808 [265] -0.6168020 -0.6170224 -0.6172422 -0.6174611 -0.6176794 -0.6178969 [271] -0.6181136 -0.6183297 -0.6185449 -0.6187595 -0.6189733 -0.6191863 [277] -0.6193986 -0.6196102 -0.6198210 -0.6200311 -0.6202404 -0.6204490 [283] -0.6206569 -0.6208640 -0.6210703 -0.6212759 -0.6214808 -0.6216849 [289] -0.6218883 -0.6220909 -0.6222928 -0.6224939 -0.6226943 -0.6228939 [295] -0.6230928 -0.6232909 -0.6234883 -0.6236849 -0.6238808 -0.6240760 [301] -0.6242703 -0.6244640 -0.6246569 -0.6248490 -0.6250404 -0.6252310 [307] -0.6254209 -0.6256100 -0.6257984 -0.6259861 -0.6261729 -0.6263591 [313] -0.6265445 -0.6267291 -0.6269130 -0.6270961 -0.6272785 -0.6274601 [319] -0.6276410 -0.6278211 -0.6280004 -0.6281791 -0.6283569 -0.6285340 [325] -0.6287104 -0.6288860 -0.6290609 -0.6292350 -0.6294083 -0.6295809 [331] -0.6297528 -0.6299239 -0.6300942 -0.6302638 -0.6304327 -0.6306008 [337] -0.6307681 -0.6309347 -0.6311005 -0.6312656 -0.6314300 -0.6315936 [343] -0.6317564 -0.6319185 -0.6320798 -0.6322404 -0.6324003 -0.6325594 [349] -0.6327177 -0.6328753 -0.6330322 -0.6331883 -0.6333436 -0.6334982 [355] -0.6336521 -0.6338052 -0.6339575 -0.6341091 -0.6342600 -0.6344101 [361] -0.6345595 -0.6347081 -0.6348560 -0.6350032 -0.6351496 -0.6352952 [367] -0.6354401 -0.6355843 -0.6357277 -0.6358704 -0.6360123 -0.6361535 [373] -0.6362939 -0.6364336 -0.6365726 -0.6367108 -0.6368483 -0.6369850 [379] -0.6371210 -0.6372563 -0.6373908 -0.6375246 -0.6376577 -0.6377900 [385] -0.6379215 -0.6380524 -0.6381825 -0.6383118 -0.6384405 -0.6385684 [391] -0.6386955 -0.6388219 -0.6389476 -0.6390726 -0.6391968 -0.6393203 [397] -0.6394431 -0.6395651 -0.6396864 -0.6398070 -0.6399268 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1ib6j1194696139.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(l,c,main='Box-Cox Normality Plot',xlab='Lambda',ylab='correlation') > mtext(paste('Optimal Lambda =',mxli)) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/239201194696139.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(x,main='Histogram of Original Data',xlab='X',ylab='frequency') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3bjx11194696139.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(x1,main='Histogram of Transformed Data',xlab='X',ylab='frequency') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4t5fh1194696139.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5f27u1194696139.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > grid() > mtext('Transformed Data') > dev.off() null device 1 > load(file='/var/www/html/rcomp/createtable') > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Box-Cox Normality Plot',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'# observations x',header=TRUE) > a<-table.element(a,n) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'maximum correlation',header=TRUE) > a<-table.element(a,mx) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'optimal lambda',header=TRUE) > a<-table.element(a,mxli) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/68ftc1194696139.tab") > > system("convert tmp/1ib6j1194696139.ps tmp/1ib6j1194696139.png") > system("convert tmp/239201194696139.ps tmp/239201194696139.png") > system("convert tmp/3bjx11194696139.ps tmp/3bjx11194696139.png") > system("convert tmp/4t5fh1194696139.ps tmp/4t5fh1194696139.png") > system("convert tmp/5f27u1194696139.ps tmp/5f27u1194696139.png") > > > proc.time() user system elapsed 1.345 0.809 1.551