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(2.1,2.2,2.2,2.7,3.1,3.2,3.1,3.1,2.8,3,2.8,2.7,3.2,3.1,3,2,1.7,1.2,1.4,1.3,1.3,1.1,0.9,1.2,0.9,1.3,1.4,1.5,1.1,1.6,1.5,1.6,1.7,1.6,1.7,1.6,1.6,1.3,1.1,1.6,1.9,1.6,1.7,1.6,1.4,2.1,1.9,1.7,1.8,2,2.5,2.1,2.1,2.3,2.4,2.4,2.3,1.7,2,2.3) > #'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.04896966 -0.04957341 -0.05017909 -0.05078671 -0.05139624 -0.05200769 [7] -0.05262106 -0.05323633 -0.05385351 -0.05447258 -0.05509355 -0.05571640 [13] -0.05634112 -0.05696773 -0.05759620 -0.05822654 -0.05885873 -0.05949277 [19] -0.06012865 -0.06076637 -0.06140593 -0.06204730 -0.06269050 -0.06333550 [25] -0.06398231 -0.06463092 -0.06528131 -0.06593349 -0.06658744 -0.06724316 [31] -0.06790065 -0.06855988 -0.06922086 -0.06988358 -0.07054802 -0.07121419 [37] -0.07188208 -0.07255166 -0.07322295 -0.07389593 -0.07457058 -0.07524691 [43] -0.07592490 -0.07660455 -0.07728584 -0.07796877 -0.07865333 -0.07933951 [49] -0.08002730 -0.08071669 -0.08140768 -0.08210024 -0.08279438 -0.08349008 [55] -0.08418734 -0.08488614 -0.08558647 -0.08628833 -0.08699171 -0.08769659 [61] -0.08840296 -0.08911082 -0.08982015 -0.09053095 -0.09124319 -0.09195688 [67] -0.09267201 -0.09338855 -0.09410651 -0.09482586 -0.09554661 -0.09626873 [73] -0.09699222 -0.09771706 -0.09844325 -0.09917077 -0.09989962 -0.10062977 [79] -0.10136122 -0.10209396 -0.10282798 -0.10356326 -0.10429979 -0.10503757 [85] -0.10577657 -0.10651679 -0.10725821 -0.10800083 -0.10874462 -0.10948959 [91] -0.11023571 -0.11098297 -0.11173137 -0.11248088 -0.11323150 -0.11398322 [97] -0.11473601 -0.11548988 -0.11624480 -0.11700076 -0.11775775 -0.11851576 [103] -0.11927478 -0.12003478 -0.12079577 -0.12155772 -0.12232062 -0.12308447 [109] -0.12384923 -0.12461492 -0.12538150 -0.12614896 -0.12691730 -0.12768650 [115] -0.12845655 -0.12922743 -0.12999913 -0.13077163 -0.13154492 -0.13231900 [121] -0.13309384 -0.13386943 -0.13464575 -0.13542281 -0.13620057 -0.13697902 [127] -0.13775817 -0.13853797 -0.13931844 -0.14009954 -0.14088128 -0.14166362 [133] -0.14244657 -0.14323010 -0.14401420 -0.14479886 -0.14558406 -0.14636979 [139] -0.14715604 -0.14794279 -0.14873003 -0.14951774 -0.15030591 -0.15109452 [145] -0.15188357 -0.15267303 -0.15346290 -0.15425315 -0.15504379 -0.15583478 [151] -0.15662612 -0.15741779 -0.15820978 -0.15900207 -0.15979466 -0.16058752 [157] -0.16138064 -0.16217401 -0.16296762 -0.16376144 -0.16455548 -0.16534970 [163] -0.16614411 -0.16693867 -0.16773339 -0.16852824 -0.16932322 -0.17011830 [169] -0.17091348 -0.17170874 -0.17250407 -0.17329945 -0.17409487 -0.17489031 [175] -0.17568576 -0.17648121 -0.17727665 -0.17807206 -0.17886742 -0.17966272 [181] -0.18045796 -0.18125311 -0.18204816 -0.18284310 -0.18363792 -0.18443259 [187] -0.18522712 -0.18602148 -0.18681566 -0.18760964 -0.18840343 -0.18919699 [193] -0.18999032 -0.19078341 -0.19157624 -0.19236879 -0.19316107 -0.19395304 [199] -0.19474471 -0.19553605 -0.19632705 -0.19711771 -0.19790800 -0.19869792 [205] -0.19948745 -0.20027658 -0.20106530 -0.20185359 -0.20264145 -0.20342885 [211] -0.20421579 -0.20500226 -0.20578824 -0.20657372 -0.20735869 -0.20814313 [217] -0.20892704 -0.20971040 -0.21049320 -0.21127542 -0.21205707 -0.21283811 [223] -0.21361855 -0.21439837 -0.21517756 -0.21595611 -0.21673400 -0.21751123 [229] -0.21828778 -0.21906364 -0.21983881 -0.22061326 -0.22138699 -0.22215999 [235] -0.22293224 -0.22370374 -0.22447448 -0.22524443 -0.22601360 -0.22678197 [241] -0.22754954 -0.22831628 -0.22908219 -0.22984727 -0.23061149 -0.23137485 [247] -0.23213735 -0.23289896 -0.23365967 -0.23441949 -0.23517840 -0.23593638 [253] -0.23669344 -0.23744955 -0.23820471 -0.23895892 -0.23971215 -0.24046441 [259] -0.24121567 -0.24196594 -0.24271520 -0.24346345 -0.24421067 -0.24495686 [265] -0.24570200 -0.24644609 -0.24718912 -0.24793109 -0.24867197 -0.24941177 [271] -0.25015047 -0.25088806 -0.25162455 -0.25235991 -0.25309415 -0.25382725 [277] -0.25455920 -0.25529001 -0.25601965 -0.25674812 -0.25747541 -0.25820153 [283] -0.25892645 -0.25965017 -0.26037268 -0.26109398 -0.26181406 -0.26253291 [289] -0.26325052 -0.26396689 -0.26468201 -0.26539587 -0.26610847 -0.26681980 [295] -0.26752985 -0.26823861 -0.26894609 -0.26965227 -0.27035714 -0.27106070 [301] -0.27176295 -0.27246388 -0.27316347 -0.27386173 -0.27455865 -0.27525422 [307] -0.27594844 -0.27664130 -0.27733280 -0.27802293 -0.27871168 -0.27939905 [313] -0.28008503 -0.28076962 -0.28145281 -0.28213461 -0.28281499 -0.28349396 [319] -0.28417151 -0.28484764 -0.28552235 -0.28619562 -0.28686745 -0.28753784 [325] -0.28820679 -0.28887429 -0.28954033 -0.29020490 -0.29086802 -0.29152967 [331] -0.29218984 -0.29284854 -0.29350576 -0.29416149 -0.29481574 -0.29546849 [337] -0.29611975 -0.29676950 -0.29741775 -0.29806450 -0.29870973 -0.29935346 [343] -0.29999566 -0.30063634 -0.30127550 -0.30191313 -0.30254923 -0.30318380 [349] -0.30381683 -0.30444832 -0.30507827 -0.30570667 -0.30633352 -0.30695883 [355] -0.30758258 -0.30820477 -0.30882541 -0.30944449 -0.31006200 -0.31067795 [361] -0.31129233 -0.31190513 -0.31251637 -0.31312603 -0.31373412 -0.31434063 [367] -0.31494555 -0.31554890 -0.31615066 -0.31675083 -0.31734942 -0.31794642 [373] -0.31854182 -0.31913564 -0.31972786 -0.32031848 -0.32090751 -0.32149494 [379] -0.32208077 -0.32266500 -0.32324763 -0.32382866 -0.32440808 -0.32498589 [385] -0.32556211 -0.32613671 -0.32670971 -0.32728109 -0.32785087 -0.32841904 [391] -0.32898560 -0.32955055 -0.33011388 -0.33067560 -0.33123571 -0.33179421 [397] -0.33235109 -0.33290636 -0.33346002 -0.33401206 -0.33456248 > 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/16mhx1226394459.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/2plha1226394459.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/33zd01226394459.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/439bm1226394459.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/576nl1226394459.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/6x5cc1226394459.tab") > > system("convert tmp/16mhx1226394459.ps tmp/16mhx1226394459.png") > system("convert tmp/2plha1226394459.ps tmp/2plha1226394459.png") > system("convert tmp/33zd01226394459.ps tmp/33zd01226394459.png") > system("convert tmp/439bm1226394459.ps tmp/439bm1226394459.png") > system("convert tmp/576nl1226394459.ps tmp/576nl1226394459.png") > > > proc.time() user system elapsed 1.335 0.822 1.693