R version 2.8.0 (2008-10-20) 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(102.1,102.86,102.99,103.73,105.02,104.43,104.63,104.93,105.87,105.66,106.76,106,107.22,107.33,107.11,108.86,107.72,107.88,108.38,107.72,108.41,109.9,111.45,112.18,113.34,113.46,114.06,115.54,116.39,115.94,116.97,115.94,115.91,116.43,116.26,116.35,117.9,117.7,117.53,117.86,117.65,116.51,115.93,115.31,115) > #'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.9124318 0.9124140 0.9123963 0.9123785 0.9123607 0.9123428 0.9123249 [8] 0.9123071 0.9122892 0.9122712 0.9122533 0.9122353 0.9122174 0.9121993 [15] 0.9121813 0.9121633 0.9121452 0.9121271 0.9121090 0.9120909 0.9120728 [22] 0.9120546 0.9120364 0.9120182 0.9120000 0.9119817 0.9119634 0.9119452 [29] 0.9119268 0.9119085 0.9118902 0.9118718 0.9118534 0.9118350 0.9118166 [36] 0.9117981 0.9117796 0.9117612 0.9117426 0.9117241 0.9117056 0.9116870 [43] 0.9116684 0.9116498 0.9116312 0.9116125 0.9115938 0.9115751 0.9115564 [50] 0.9115377 0.9115190 0.9115002 0.9114814 0.9114626 0.9114437 0.9114249 [57] 0.9114060 0.9113871 0.9113682 0.9113493 0.9113303 0.9113114 0.9112924 [64] 0.9112734 0.9112543 0.9112353 0.9112162 0.9111971 0.9111780 0.9111589 [71] 0.9111397 0.9111206 0.9111014 0.9110822 0.9110629 0.9110437 0.9110244 [78] 0.9110051 0.9109858 0.9109665 0.9109471 0.9109278 0.9109084 0.9108890 [85] 0.9108696 0.9108501 0.9108306 0.9108112 0.9107917 0.9107721 0.9107526 [92] 0.9107330 0.9107134 0.9106938 0.9106742 0.9106546 0.9106349 0.9106152 [99] 0.9105955 0.9105758 0.9105561 0.9105363 0.9105165 0.9104967 0.9104769 [106] 0.9104571 0.9104372 0.9104173 0.9103975 0.9103775 0.9103576 0.9103377 [113] 0.9103177 0.9102977 0.9102777 0.9102576 0.9102376 0.9102175 0.9101974 [120] 0.9101773 0.9101572 0.9101371 0.9101169 0.9100967 0.9100765 0.9100563 [127] 0.9100360 0.9100158 0.9099955 0.9099752 0.9099549 0.9099345 0.9099142 [134] 0.9098938 0.9098734 0.9098530 0.9098326 0.9098121 0.9097916 0.9097711 [141] 0.9097506 0.9097301 0.9097096 0.9096890 0.9096684 0.9096478 0.9096272 [148] 0.9096065 0.9095859 0.9095652 0.9095445 0.9095238 0.9095030 0.9094823 [155] 0.9094615 0.9094407 0.9094199 0.9093991 0.9093782 0.9093573 0.9093365 [162] 0.9093155 0.9092946 0.9092737 0.9092527 0.9092317 0.9092107 0.9091897 [169] 0.9091687 0.9091476 0.9091265 0.9091054 0.9090843 0.9090632 0.9090420 [176] 0.9090209 0.9089997 0.9089785 0.9089572 0.9089360 0.9089147 0.9088935 [183] 0.9088722 0.9088508 0.9088295 0.9088081 0.9087868 0.9087654 0.9087440 [190] 0.9087225 0.9087011 0.9086796 0.9086581 0.9086366 0.9086151 0.9085936 [197] 0.9085720 0.9085504 0.9085288 0.9085072 0.9084856 0.9084639 0.9084423 [204] 0.9084206 0.9083989 0.9083771 0.9083554 0.9083336 0.9083119 0.9082901 [211] 0.9082682 0.9082464 0.9082246 0.9082027 0.9081808 0.9081589 0.9081370 [218] 0.9081150 0.9080931 0.9080711 0.9080491 0.9080271 0.9080050 0.9079830 [225] 0.9079609 0.9079388 0.9079167 0.9078946 0.9078724 0.9078503 0.9078281 [232] 0.9078059 0.9077837 0.9077614 0.9077392 0.9077169 0.9076946 0.9076723 [239] 0.9076500 0.9076277 0.9076053 0.9075829 0.9075605 0.9075381 0.9075157 [246] 0.9074932 0.9074708 0.9074483 0.9074258 0.9074032 0.9073807 0.9073581 [253] 0.9073356 0.9073130 0.9072904 0.9072677 0.9072451 0.9072224 0.9071998 [260] 0.9071771 0.9071543 0.9071316 0.9071088 0.9070861 0.9070633 0.9070405 [267] 0.9070177 0.9069948 0.9069720 0.9069491 0.9069262 0.9069033 0.9068804 [274] 0.9068574 0.9068344 0.9068115 0.9067885 0.9067654 0.9067424 0.9067194 [281] 0.9066963 0.9066732 0.9066501 0.9066270 0.9066038 0.9065807 0.9065575 [288] 0.9065343 0.9065111 0.9064879 0.9064646 0.9064414 0.9064181 0.9063948 [295] 0.9063715 0.9063482 0.9063248 0.9063014 0.9062781 0.9062547 0.9062312 [302] 0.9062078 0.9061844 0.9061609 0.9061374 0.9061139 0.9060904 0.9060668 [309] 0.9060433 0.9060197 0.9059961 0.9059725 0.9059489 0.9059253 0.9059016 [316] 0.9058779 0.9058542 0.9058305 0.9058068 0.9057830 0.9057593 0.9057355 [323] 0.9057117 0.9056879 0.9056641 0.9056402 0.9056164 0.9055925 0.9055686 [330] 0.9055447 0.9055207 0.9054968 0.9054728 0.9054488 0.9054249 0.9054008 [337] 0.9053768 0.9053528 0.9053287 0.9053046 0.9052805 0.9052564 0.9052323 [344] 0.9052081 0.9051839 0.9051598 0.9051356 0.9051113 0.9050871 0.9050629 [351] 0.9050386 0.9050143 0.9049900 0.9049657 0.9049414 0.9049170 0.9048926 [358] 0.9048682 0.9048438 0.9048194 0.9047950 0.9047705 0.9047461 0.9047216 [365] 0.9046971 0.9046726 0.9046480 0.9046235 0.9045989 0.9045743 0.9045497 [372] 0.9045251 0.9045005 0.9044758 0.9044512 0.9044265 0.9044018 0.9043771 [379] 0.9043524 0.9043276 0.9043028 0.9042781 0.9042533 0.9042285 0.9042036 [386] 0.9041788 0.9041539 0.9041290 0.9041041 0.9040792 0.9040543 0.9040294 [393] 0.9040044 0.9039794 0.9039544 0.9039294 0.9039044 0.9038794 0.9038543 [400] 0.9038292 0.9038041 > mx [1] 0.9124318 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1c6uo1257436321.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/freestat/rcomp/tmp/2m6a81257436321.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/freestat/rcomp/tmp/31nl91257436321.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/freestat/rcomp/tmp/4kx7x1257436321.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/freestat/rcomp/tmp/52gi41257436321.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/6u23d1257436321.tab") > > system("convert tmp/1c6uo1257436321.ps tmp/1c6uo1257436321.png") > system("convert tmp/2m6a81257436321.ps tmp/2m6a81257436321.png") > system("convert tmp/31nl91257436321.ps tmp/31nl91257436321.png") > system("convert tmp/4kx7x1257436321.ps tmp/4kx7x1257436321.png") > system("convert tmp/52gi41257436321.ps tmp/52gi41257436321.png") > > > proc.time() user system elapsed 1.707 1.266 1.879