R version 2.7.0 (2008-04-22) 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(109.86,108.68,113.38,117.12,116.23,114.75,115.81,115.86,117.8,117.11,116.31,118.38,121.57,121.65,124.2,126.12,128.6,128.16,130.12,135.83,138.05,134.99,132.38,128.94,128.12,127.84,132.43,134.13,134.78,133.13,129.08,134.48,132.86,134.08,134.54,134.51,135.97,136.09,139.14,135.63,136.55,138.83,138.84,135.37,132.22,134.75,135.98,136.06,138.05,139.59,140.58,139.81,140.77,140.96,143.59,142.7,145.11,146.7,148.53,148.99,149.65,151.11,154.82,156.56,157.6,155.24,160.68,163.22,164.55,166.76,159.05,159.82,164.95,162.89) > #'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.9598630 0.9599288 0.9599942 0.9600593 0.9601240 0.9601884 0.9602524 [8] 0.9603160 0.9603793 0.9604422 0.9605048 0.9605670 0.9606288 0.9606903 [15] 0.9607513 0.9608121 0.9608724 0.9609324 0.9609921 0.9610513 0.9611102 [22] 0.9611688 0.9612269 0.9612847 0.9613421 0.9613992 0.9614559 0.9615122 [29] 0.9615682 0.9616237 0.9616789 0.9617338 0.9617883 0.9618424 0.9618961 [36] 0.9619494 0.9620024 0.9620550 0.9621073 0.9621591 0.9622106 0.9622617 [43] 0.9623125 0.9623629 0.9624128 0.9624625 0.9625117 0.9625606 0.9626091 [50] 0.9626572 0.9627049 0.9627523 0.9627993 0.9628459 0.9628921 0.9629380 [57] 0.9629835 0.9630286 0.9630733 0.9631176 0.9631616 0.9632052 0.9632484 [64] 0.9632912 0.9633337 0.9633757 0.9634174 0.9634587 0.9634997 0.9635402 [71] 0.9635804 0.9636201 0.9636595 0.9636986 0.9637372 0.9637754 0.9638133 [78] 0.9638508 0.9638879 0.9639246 0.9639610 0.9639969 0.9640325 0.9640677 [85] 0.9641025 0.9641369 0.9641709 0.9642045 0.9642378 0.9642707 0.9643032 [92] 0.9643353 0.9643670 0.9643983 0.9644292 0.9644598 0.9644900 0.9645198 [99] 0.9645491 0.9645782 0.9646068 0.9646350 0.9646629 0.9646903 0.9647174 [106] 0.9647441 0.9647704 0.9647963 0.9648218 0.9648469 0.9648716 0.9648960 [113] 0.9649199 0.9649435 0.9649667 0.9649895 0.9650119 0.9650339 0.9650555 [120] 0.9650767 0.9650976 0.9651180 0.9651381 0.9651577 0.9651770 0.9651959 [127] 0.9652144 0.9652325 0.9652502 0.9652675 0.9652844 0.9653010 0.9653171 [134] 0.9653329 0.9653482 0.9653632 0.9653778 0.9653919 0.9654057 0.9654191 [141] 0.9654321 0.9654447 0.9654570 0.9654688 0.9654802 0.9654913 0.9655019 [148] 0.9655122 0.9655220 0.9655315 0.9655406 0.9655493 0.9655575 0.9655654 [155] 0.9655729 0.9655801 0.9655868 0.9655931 0.9655990 0.9656046 0.9656097 [162] 0.9656145 0.9656188 0.9656228 0.9656263 0.9656295 0.9656323 0.9656347 [169] 0.9656367 0.9656383 0.9656395 0.9656403 0.9656407 0.9656408 0.9656404 [176] 0.9656396 0.9656385 0.9656369 0.9656350 0.9656326 0.9656299 0.9656268 [183] 0.9656233 0.9656194 0.9656151 0.9656104 0.9656053 0.9655998 0.9655939 [190] 0.9655876 0.9655810 0.9655739 0.9655665 0.9655586 0.9655504 0.9655418 [197] 0.9655327 0.9655233 0.9655135 0.9655033 0.9654927 0.9654817 0.9654704 [204] 0.9654586 0.9654464 0.9654339 0.9654209 0.9654076 0.9653938 0.9653797 [211] 0.9653652 0.9653503 0.9653350 0.9653193 0.9653032 0.9652867 0.9652699 [218] 0.9652526 0.9652350 0.9652169 0.9651985 0.9651797 0.9651605 0.9651409 [225] 0.9651209 0.9651005 0.9650797 0.9650586 0.9650370 0.9650151 0.9649927 [232] 0.9649700 0.9649469 0.9649234 0.9648995 0.9648753 0.9648506 0.9648255 [239] 0.9648001 0.9647743 0.9647481 0.9647214 0.9646945 0.9646671 0.9646393 [246] 0.9646111 0.9645826 0.9645537 0.9645244 0.9644947 0.9644646 0.9644341 [253] 0.9644032 0.9643720 0.9643404 0.9643083 0.9642759 0.9642432 0.9642100 [260] 0.9641764 0.9641425 0.9641082 0.9640735 0.9640384 0.9640029 0.9639670 [267] 0.9639308 0.9638942 0.9638572 0.9638198 0.9637820 0.9637439 0.9637053 [274] 0.9636664 0.9636271 0.9635874 0.9635474 0.9635069 0.9634661 0.9634249 [281] 0.9633833 0.9633414 0.9632991 0.9632563 0.9632132 0.9631698 0.9631259 [288] 0.9630817 0.9630371 0.9629921 0.9629468 0.9629010 0.9628549 0.9628084 [295] 0.9627616 0.9627143 0.9626667 0.9626187 0.9625704 0.9625216 0.9624725 [302] 0.9624230 0.9623732 0.9623229 0.9622723 0.9622214 0.9621700 0.9621183 [309] 0.9620662 0.9620137 0.9619609 0.9619077 0.9618541 0.9618002 0.9617459 [316] 0.9616912 0.9616361 0.9615807 0.9615249 0.9614687 0.9614122 0.9613553 [323] 0.9612981 0.9612404 0.9611825 0.9611241 0.9610654 0.9610063 0.9609468 [330] 0.9608870 0.9608268 0.9607663 0.9607054 0.9606441 0.9605825 0.9605205 [337] 0.9604581 0.9603954 0.9603323 0.9602689 0.9602051 0.9601409 0.9600764 [344] 0.9600115 0.9599463 0.9598807 0.9598147 0.9597484 0.9596817 0.9596147 [351] 0.9595473 0.9594796 0.9594115 0.9593430 0.9592742 0.9592051 0.9591356 [358] 0.9590657 0.9589955 0.9589249 0.9588540 0.9587827 0.9587111 0.9586391 [365] 0.9585668 0.9584941 0.9584210 0.9583477 0.9582739 0.9581999 0.9581254 [372] 0.9580507 0.9579755 0.9579001 0.9578243 0.9577481 0.9576716 0.9575947 [379] 0.9575175 0.9574400 0.9573621 0.9572839 0.9572053 0.9571264 0.9570472 [386] 0.9569676 0.9568876 0.9568074 0.9567268 0.9566458 0.9565645 0.9564829 [393] 0.9564009 0.9563186 0.9562360 0.9561530 0.9560697 0.9559860 0.9559020 [400] 0.9558177 0.9557331 > mx [1] 0.9656408 > mxli [1] -0.27 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1z8l01226607623.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/2vwbu1226607623.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/3oped1226607623.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/4e7sw1226607623.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/5ywk21226607623.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/60wrs1226607623.tab") > > system("convert tmp/1z8l01226607623.ps tmp/1z8l01226607623.png") > system("convert tmp/2vwbu1226607623.ps tmp/2vwbu1226607623.png") > system("convert tmp/3oped1226607623.ps tmp/3oped1226607623.png") > system("convert tmp/4e7sw1226607623.ps tmp/4e7sw1226607623.png") > system("convert tmp/5ywk21226607623.ps tmp/5ywk21226607623.png") > > > proc.time() user system elapsed 2.414 1.324 2.599