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(100.4,123.3,156.6,136.2,147.5,143.8,135.8,121.6,128,129.7,136.2,130.5,99.2) > #'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.09250100 -0.09262717 -0.09275357 -0.09288019 -0.09300704 -0.09313412 [7] -0.09326142 -0.09338896 -0.09351672 -0.09364470 -0.09377292 -0.09390136 [13] -0.09403002 -0.09415891 -0.09428803 -0.09441737 -0.09454694 -0.09467673 [19] -0.09480675 -0.09493699 -0.09506746 -0.09519815 -0.09532906 -0.09546020 [25] -0.09559156 -0.09572314 -0.09585495 -0.09598698 -0.09611923 -0.09625170 [31] -0.09638440 -0.09651732 -0.09665046 -0.09678382 -0.09691740 -0.09705120 [37] -0.09718522 -0.09731946 -0.09745393 -0.09758861 -0.09772351 -0.09785863 [43] -0.09799397 -0.09812953 -0.09826530 -0.09840130 -0.09853751 -0.09867394 [49] -0.09881058 -0.09894744 -0.09908452 -0.09922182 -0.09935933 -0.09949706 [55] -0.09963500 -0.09977316 -0.09991153 -0.10005012 -0.10018892 -0.10032793 [61] -0.10046716 -0.10060660 -0.10074626 -0.10088612 -0.10102620 -0.10116649 [67] -0.10130700 -0.10144771 -0.10158864 -0.10172977 -0.10187112 -0.10201267 [73] -0.10215444 -0.10229641 -0.10243860 -0.10258099 -0.10272359 -0.10286640 [79] -0.10300941 -0.10315264 -0.10329607 -0.10343970 -0.10358355 -0.10372759 [85] -0.10387185 -0.10401631 -0.10416097 -0.10430584 -0.10445091 -0.10459619 [91] -0.10474166 -0.10488735 -0.10503323 -0.10517932 -0.10532560 -0.10547209 [97] -0.10561878 -0.10576567 -0.10591276 -0.10606005 -0.10620754 -0.10635523 [103] -0.10650312 -0.10665121 -0.10679949 -0.10694797 -0.10709665 -0.10724552 [109] -0.10739459 -0.10754386 -0.10769332 -0.10784297 -0.10799282 -0.10814287 [115] -0.10829310 -0.10844354 -0.10859416 -0.10874498 -0.10889598 -0.10904718 [121] -0.10919857 -0.10935015 -0.10950192 -0.10965389 -0.10980604 -0.10995837 [127] -0.11011090 -0.11026362 -0.11041652 -0.11056961 -0.11072288 -0.11087635 [133] -0.11102999 -0.11118383 -0.11133784 -0.11149205 -0.11164643 -0.11180100 [139] -0.11195575 -0.11211069 -0.11226580 -0.11242110 -0.11257658 -0.11273224 [145] -0.11288807 -0.11304409 -0.11320029 -0.11335666 -0.11351322 -0.11366995 [151] -0.11382686 -0.11398394 -0.11414120 -0.11429864 -0.11445625 -0.11461403 [157] -0.11477199 -0.11493012 -0.11508843 -0.11524691 -0.11540556 -0.11556438 [163] -0.11572337 -0.11588254 -0.11604187 -0.11620137 -0.11636104 -0.11652088 [169] -0.11668089 -0.11684106 -0.11700140 -0.11716191 -0.11732258 -0.11748342 [175] -0.11764442 -0.11780559 -0.11796692 -0.11812841 -0.11829006 -0.11845188 [181] -0.11861386 -0.11877600 -0.11893830 -0.11910076 -0.11926337 -0.11942615 [187] -0.11958908 -0.11975218 -0.11991542 -0.12007883 -0.12024239 -0.12040610 [193] -0.12056997 -0.12073400 -0.12089818 -0.12106251 -0.12122699 -0.12139162 [199] -0.12155641 -0.12172134 -0.12188643 -0.12205166 -0.12221705 -0.12238258 [205] -0.12254826 -0.12271408 -0.12288006 -0.12304618 -0.12321244 -0.12337885 [211] -0.12354540 -0.12371210 -0.12387893 -0.12404592 -0.12421304 -0.12438030 [217] -0.12454771 -0.12471525 -0.12488293 -0.12505075 -0.12521871 -0.12538681 [223] -0.12555504 -0.12572341 -0.12589192 -0.12606056 -0.12622933 -0.12639824 [229] -0.12656728 -0.12673645 -0.12690575 -0.12707519 -0.12724476 -0.12741445 [235] -0.12758428 -0.12775423 -0.12792431 -0.12809452 -0.12826486 -0.12843532 [241] -0.12860591 -0.12877662 -0.12894745 -0.12911841 -0.12928950 -0.12946070 [247] -0.12963203 -0.12980347 -0.12997504 -0.13014672 -0.13031853 -0.13049045 [253] -0.13066249 -0.13083465 -0.13100693 -0.13117932 -0.13135182 -0.13152444 [259] -0.13169717 -0.13187002 -0.13204298 -0.13221605 -0.13238923 -0.13256252 [265] -0.13273592 -0.13290943 -0.13308305 -0.13325678 -0.13343061 -0.13360455 [271] -0.13377859 -0.13395274 -0.13412699 -0.13430135 -0.13447581 -0.13465038 [277] -0.13482504 -0.13499980 -0.13517467 -0.13534963 -0.13552470 -0.13569986 [283] -0.13587512 -0.13605047 -0.13622593 -0.13640147 -0.13657712 -0.13675285 [289] -0.13692868 -0.13710460 -0.13728062 -0.13745672 -0.13763292 -0.13780920 [295] -0.13798558 -0.13816204 -0.13833859 -0.13851523 -0.13869196 -0.13886877 [301] -0.13904566 -0.13922264 -0.13939970 -0.13957685 -0.13975408 -0.13993139 [307] -0.14010878 -0.14028625 -0.14046380 -0.14064143 -0.14081913 -0.14099692 [313] -0.14117478 -0.14135271 -0.14153073 -0.14170881 -0.14188697 -0.14206520 [319] -0.14224351 -0.14242188 -0.14260033 -0.14277885 -0.14295744 -0.14313609 [325] -0.14331481 -0.14349361 -0.14367246 -0.14385139 -0.14403038 -0.14420943 [331] -0.14438855 -0.14456773 -0.14474697 -0.14492627 -0.14510564 -0.14528506 [337] -0.14546455 -0.14564409 -0.14582369 -0.14600335 -0.14618306 -0.14636283 [343] -0.14654266 -0.14672254 -0.14690247 -0.14708246 -0.14726250 -0.14744259 [349] -0.14762273 -0.14780293 -0.14798317 -0.14816346 -0.14834380 -0.14852418 [355] -0.14870461 -0.14888509 -0.14906562 -0.14924618 -0.14942679 -0.14960745 [361] -0.14978814 -0.14996888 -0.15014966 -0.15033048 -0.15051134 -0.15069223 [367] -0.15087317 -0.15105414 -0.15123515 -0.15141619 -0.15159727 -0.15177838 [373] -0.15195953 -0.15214071 -0.15232192 -0.15250316 -0.15268444 -0.15286574 [379] -0.15304708 -0.15322844 -0.15340983 -0.15359124 -0.15377269 -0.15395416 [385] -0.15413565 -0.15431717 -0.15449871 -0.15468027 -0.15486186 -0.15504347 [391] -0.15522510 -0.15540675 -0.15558841 -0.15577010 -0.15595180 -0.15613353 [397] -0.15631526 -0.15649702 -0.15667878 -0.15686057 -0.15704236 > 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/1f5t61226521758.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/2i0ob1226521758.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/3kehu1226521758.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/4wxiw1226521758.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/5x9r91226521758.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/6jeac1226521758.tab") > > system("convert tmp/1f5t61226521758.ps tmp/1f5t61226521758.png") > system("convert tmp/2i0ob1226521758.ps tmp/2i0ob1226521758.png") > system("convert tmp/3kehu1226521758.ps tmp/3kehu1226521758.png") > system("convert tmp/4wxiw1226521758.ps tmp/4wxiw1226521758.png") > system("convert tmp/5x9r91226521758.ps tmp/5x9r91226521758.png") > > > proc.time() user system elapsed 1.323 0.811 1.556