R version 2.7.2 (2008-08-25) Copyright (C) 2008 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(519164,517009,509933,509127,500857,506971,569323,579714,577992,565464,547344,554788,562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141,593408,590072,579799,574205,572775,572942,619567,625809,619916,587625,565742,557274,560576,548854,531673,525919,511038,498662,555362,564591,541657,527070,509846,514258) > #'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!) > 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.04289118 0.04287926 0.04289032 0.04287088 0.04287444 0.04286302 [7] 0.04287223 0.04285827 0.04285746 0.04284454 0.04283433 0.04283988 [13] 0.04283781 0.04283523 0.04283106 0.04282230 0.04282463 0.04281938 [19] 0.04281957 0.04281223 0.04280797 0.04280453 0.04279845 0.04279571 [25] 0.04279111 0.04278937 0.04278452 0.04278084 0.04277725 0.04277385 [31] 0.04277071 0.04276570 0.04276262 0.04275884 0.04275559 0.04275158 [37] 0.04274819 0.04274396 0.04274112 0.04273726 0.04273386 0.04273030 [43] 0.04272683 0.04272329 0.04271959 0.04271610 0.04271265 0.04270918 [49] 0.04270561 0.04270208 0.04269866 0.04269515 0.04269171 0.04268825 [55] 0.04268483 0.04268138 0.04267796 0.04267454 0.04267113 0.04266773 [61] 0.04266434 0.04266097 0.04265759 0.04265422 0.04265087 0.04264752 [67] 0.04264419 0.04264086 0.04263755 0.04263424 0.04263095 0.04262766 [73] 0.04262438 0.04262111 0.04261785 0.04261460 0.04261136 0.04260812 [79] 0.04260490 0.04260169 0.04259848 0.04259528 0.04259210 0.04258892 [85] 0.04258575 0.04258260 0.04257945 0.04257631 0.04257318 0.04257006 [91] 0.04256694 0.04256384 0.04256075 0.04255767 0.04255459 0.04255153 [97] 0.04254847 0.04254542 0.04254239 0.04253936 0.04253634 0.04253333 [103] 0.04253033 0.04252734 0.04252436 0.04252139 0.04251843 0.04251548 [109] 0.04251254 0.04250960 0.04250668 0.04250376 0.04250086 0.04249796 [115] 0.04249508 0.04249220 0.04248933 0.04248648 0.04248363 0.04248079 [121] 0.04247796 0.04247514 0.04247233 0.04246953 0.04246674 0.04246395 [127] 0.04246118 0.04245842 0.04245567 0.04245292 0.04245019 0.04244746 [133] 0.04244475 0.04244204 0.04243934 0.04243666 0.04243398 0.04243131 [139] 0.04242865 0.04242601 0.04242337 0.04242074 0.04241812 0.04241551 [145] 0.04241291 0.04241032 0.04240773 0.04240516 0.04240260 0.04240005 [151] 0.04239750 0.04239497 0.04239244 0.04238993 0.04238743 0.04238493 [157] 0.04238244 0.04237997 0.04237750 0.04237505 0.04237260 0.04237016 [163] 0.04236773 0.04236531 0.04236291 0.04236051 0.04235812 0.04235574 [169] 0.04235337 0.04235101 0.04234866 0.04234632 0.04234399 0.04234166 [175] 0.04233935 0.04233705 0.04233476 0.04233247 0.04233020 0.04232794 [181] 0.04232568 0.04232344 0.04232121 0.04231898 0.04231677 0.04231456 [187] 0.04231237 0.04231018 0.04230801 0.04230584 0.04230368 0.04230154 [193] 0.04229940 0.04229727 0.04229515 0.04229305 0.04229095 0.04228886 [199] 0.04228678 0.04228471 0.04228265 0.04228061 0.04227857 0.04227654 [205] 0.04227452 0.04227251 0.04227051 0.04226852 0.04226654 0.04226456 [211] 0.04226260 0.04226065 0.04225871 0.04225678 0.04225486 0.04225295 [217] 0.04225104 0.04224915 0.04224727 0.04224540 0.04224353 0.04224168 [223] 0.04223984 0.04223800 0.04223618 0.04223437 0.04223256 0.04223077 [229] 0.04222898 0.04222721 0.04222545 0.04222369 0.04222195 0.04222021 [235] 0.04221849 0.04221677 0.04221507 0.04221337 0.04221168 0.04221001 [241] 0.04220834 0.04220669 0.04220504 0.04220341 0.04220178 0.04220016 [247] 0.04219856 0.04219696 0.04219537 0.04219380 0.04219223 0.04219067 [253] 0.04218913 0.04218759 0.04218606 0.04218455 0.04218304 0.04218154 [259] 0.04218005 0.04217858 0.04217711 0.04217565 0.04217420 0.04217277 [265] 0.04217134 0.04216992 0.04216851 0.04216711 0.04216573 0.04216435 [271] 0.04216298 0.04216162 0.04216027 0.04215893 0.04215761 0.04215629 [277] 0.04215498 0.04215368 0.04215239 0.04215111 0.04214985 0.04214859 [283] 0.04214734 0.04214610 0.04214487 0.04214365 0.04214244 0.04214124 [289] 0.04214006 0.04213888 0.04213771 0.04213655 0.04213540 0.04213426 [295] 0.04213313 0.04213201 0.04213091 0.04212981 0.04212872 0.04212764 [301] 0.04212657 0.04212551 0.04212446 0.04212342 0.04212240 0.04212138 [307] 0.04212037 0.04211937 0.04211838 0.04211740 0.04211643 0.04211547 [313] 0.04211453 0.04211359 0.04211266 0.04211174 0.04211083 0.04210993 [319] 0.04210904 0.04210817 0.04210730 0.04210644 0.04210559 0.04210475 [325] 0.04210392 0.04210311 0.04210230 0.04210150 0.04210071 0.04209993 [331] 0.04209916 0.04209841 0.04209766 0.04209692 0.04209619 0.04209548 [337] 0.04209477 0.04209407 0.04209338 0.04209270 0.04209204 0.04209138 [343] 0.04209073 0.04209009 0.04208947 0.04208885 0.04208824 0.04208765 [349] 0.04208706 0.04208648 0.04208591 0.04208536 0.04208481 0.04208427 [355] 0.04208375 0.04208323 0.04208272 0.04208223 0.04208174 0.04208126 [361] 0.04208080 0.04208034 0.04207990 0.04207946 0.04207903 0.04207862 [367] 0.04207821 0.04207782 0.04207743 0.04207705 0.04207669 0.04207633 [373] 0.04207599 0.04207565 0.04207533 0.04207501 0.04207471 0.04207441 [379] 0.04207413 0.04207385 0.04207359 0.04207333 0.04207309 0.04207285 [385] 0.04207263 0.04207241 0.04207221 0.04207201 0.04207183 0.04207166 [391] 0.04207149 0.04207134 0.04207119 0.04207106 0.04207094 0.04207082 [397] 0.04207072 0.04207062 0.04207054 0.04207047 0.04207040 > mx [1] 0.04289118 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1dszj1226565695.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/2uw7u1226565695.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/374w21226565695.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/43t8c1226565695.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > qqline(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5cuxs1226565695.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > qqline(x1) > grid() > mtext('Transformed Data') > dev.off() null device 1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > 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/601if1226565695.tab") > > system("convert tmp/1dszj1226565695.ps tmp/1dszj1226565695.png") > system("convert tmp/2uw7u1226565695.ps tmp/2uw7u1226565695.png") > system("convert tmp/374w21226565695.ps tmp/374w21226565695.png") > system("convert tmp/43t8c1226565695.ps tmp/43t8c1226565695.png") > system("convert tmp/5cuxs1226565695.ps tmp/5cuxs1226565695.png") > > > proc.time() user system elapsed 1.327 0.781 1.637