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(93,87,89,91,108,124,104,107,116,70,126,119,102,88,71,76,84,125,122,93,117,71,118,115,101,106,79,77,85,124,115,115,114,75,114,121,113,104,84,113,120,127,92,113,112,75,120,122,116,88,87,107,112,92,112,87,112,75,100,118) > #'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.09844468 0.09845374 0.09846274 0.09847168 0.09848055 0.09848937 [7] 0.09849812 0.09850680 0.09851543 0.09852399 0.09853249 0.09854092 [13] 0.09854929 0.09855760 0.09856584 0.09857401 0.09858212 0.09859017 [19] 0.09859814 0.09860606 0.09861390 0.09862168 0.09862939 0.09863703 [25] 0.09864461 0.09865211 0.09865955 0.09866692 0.09867422 0.09868145 [31] 0.09868861 0.09869570 0.09870272 0.09870967 0.09871655 0.09872336 [37] 0.09873010 0.09873676 0.09874336 0.09874988 0.09875632 0.09876270 [43] 0.09876900 0.09877523 0.09878138 0.09878746 0.09879346 0.09879940 [49] 0.09880525 0.09881103 0.09881674 0.09882236 0.09882792 0.09883339 [55] 0.09883879 0.09884411 0.09884936 0.09885453 0.09885962 0.09886463 [61] 0.09886956 0.09887441 0.09887919 0.09888388 0.09888850 0.09889304 [67] 0.09889749 0.09890187 0.09890616 0.09891038 0.09891451 0.09891856 [73] 0.09892253 0.09892642 0.09893022 0.09893395 0.09893758 0.09894114 [79] 0.09894461 0.09894800 0.09895131 0.09895453 0.09895766 0.09896072 [85] 0.09896368 0.09896656 0.09896936 0.09897207 0.09897469 0.09897723 [91] 0.09897968 0.09898204 0.09898432 0.09898651 0.09898861 0.09899062 [97] 0.09899255 0.09899438 0.09899613 0.09899779 0.09899936 0.09900084 [103] 0.09900223 0.09900353 0.09900474 0.09900586 0.09900689 0.09900783 [109] 0.09900867 0.09900943 0.09901009 0.09901066 0.09901114 0.09901153 [115] 0.09901182 0.09901202 0.09901213 0.09901214 0.09901206 0.09901189 [121] 0.09901162 0.09901126 0.09901080 0.09901025 0.09900961 0.09900886 [127] 0.09900802 0.09900709 0.09900606 0.09900493 0.09900371 0.09900239 [133] 0.09900097 0.09899946 0.09899785 0.09899614 0.09899433 0.09899243 [139] 0.09899042 0.09898832 0.09898612 0.09898382 0.09898142 0.09897892 [145] 0.09897632 0.09897363 0.09897083 0.09896793 0.09896493 0.09896183 [151] 0.09895863 0.09895533 0.09895192 0.09894842 0.09894481 0.09894110 [157] 0.09893729 0.09893337 0.09892936 0.09892524 0.09892101 0.09891669 [163] 0.09891226 0.09890772 0.09890309 0.09889835 0.09889350 0.09888855 [169] 0.09888349 0.09887833 0.09887307 0.09886770 0.09886222 0.09885664 [175] 0.09885095 0.09884516 0.09883926 0.09883326 0.09882714 0.09882092 [181] 0.09881460 0.09880816 0.09880162 0.09879497 0.09878822 0.09878135 [187] 0.09877438 0.09876730 0.09876011 0.09875281 0.09874541 0.09873789 [193] 0.09873027 0.09872253 0.09871469 0.09870674 0.09869867 0.09869050 [199] 0.09868222 0.09867382 0.09866532 0.09865671 0.09864798 0.09863914 [205] 0.09863019 0.09862114 0.09861197 0.09860268 0.09859329 0.09858378 [211] 0.09857416 0.09856443 0.09855459 0.09854464 0.09853457 0.09852439 [217] 0.09851409 0.09850368 0.09849316 0.09848253 0.09847178 0.09846092 [223] 0.09844994 0.09843885 0.09842765 0.09841633 0.09840490 0.09839335 [229] 0.09838169 0.09836991 0.09835802 0.09834601 0.09833389 0.09832165 [235] 0.09830930 0.09829683 0.09828424 0.09827154 0.09825873 0.09824579 [241] 0.09823274 0.09821958 0.09820629 0.09819289 0.09817938 0.09816574 [247] 0.09815199 0.09813812 0.09812414 0.09811004 0.09809582 0.09808148 [253] 0.09806702 0.09805245 0.09803776 0.09802295 0.09800802 0.09799297 [259] 0.09797781 0.09796252 0.09794712 0.09793160 0.09791596 0.09790020 [265] 0.09788433 0.09786833 0.09785221 0.09783598 0.09781962 0.09780315 [271] 0.09778655 0.09776984 0.09775301 0.09773605 0.09771898 0.09770178 [277] 0.09768447 0.09766704 0.09764948 0.09763181 0.09761401 0.09759609 [283] 0.09757806 0.09755990 0.09754162 0.09752322 0.09750470 0.09748606 [289] 0.09746729 0.09744841 0.09742940 0.09741028 0.09739103 0.09737166 [295] 0.09735216 0.09733255 0.09731281 0.09729296 0.09727298 0.09725288 [301] 0.09723265 0.09721231 0.09719184 0.09717125 0.09715054 0.09712970 [307] 0.09710875 0.09708767 0.09706647 0.09704514 0.09702370 0.09700213 [313] 0.09698043 0.09695862 0.09693668 0.09691462 0.09689244 0.09687013 [319] 0.09684770 0.09682515 0.09680247 0.09677967 0.09675675 0.09673370 [325] 0.09671053 0.09668724 0.09666383 0.09664029 0.09661663 0.09659284 [331] 0.09656893 0.09654490 0.09652074 0.09649646 0.09647206 0.09644753 [337] 0.09642288 0.09639810 0.09637321 0.09634818 0.09632304 0.09629777 [343] 0.09627237 0.09624686 0.09622122 0.09619545 0.09616956 0.09614355 [349] 0.09611741 0.09609115 0.09606477 0.09603826 0.09601162 0.09598487 [355] 0.09595799 0.09593098 0.09590385 0.09587660 0.09584922 0.09582172 [361] 0.09579410 0.09576635 0.09573847 0.09571048 0.09568235 0.09565411 [367] 0.09562574 0.09559724 0.09556863 0.09553989 0.09551102 0.09548203 [373] 0.09545292 0.09542368 0.09539431 0.09536483 0.09533522 0.09530548 [379] 0.09527563 0.09524564 0.09521554 0.09518531 0.09515495 0.09512448 [385] 0.09509387 0.09506315 0.09503230 0.09500133 0.09497023 0.09493901 [391] 0.09490766 0.09487619 0.09484460 0.09481289 0.09478105 0.09474908 [397] 0.09471700 0.09468479 0.09465245 0.09461999 0.09458741 > mx [1] 0.09901214 > mxli [1] -0.83 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1a3im1226614031.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/2j18a1226614031.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/36wjm1226614031.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/458i01226614031.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/5cvsl1226614031.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/6f3bz1226614031.tab") > > system("convert tmp/1a3im1226614031.ps tmp/1a3im1226614031.png") > system("convert tmp/2j18a1226614031.ps tmp/2j18a1226614031.png") > system("convert tmp/36wjm1226614031.ps tmp/36wjm1226614031.png") > system("convert tmp/458i01226614031.ps tmp/458i01226614031.png") > system("convert tmp/5cvsl1226614031.ps tmp/5cvsl1226614031.png") > > > proc.time() user system elapsed 1.290 0.793 2.233