R version 2.8.1 (2008-12-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(6.9,6.8,6.7,6.6,6.5,6.5,7.0,7.5,7.6,7.6,7.6,7.8,8.0,8.0,8.0,7.9,7.9,8.0,8.5,9.2,9.4,9.5,9.5,9.6,9.7,9.7,9.6,9.5,9.4,9.3,9.6,10.2,10.2,10.1,9.9,9.8,9.8,9.7,9.5,9.3,9.1,9.0,9.5,10.0,10.2,10.1,10.0,9.9,10.0,9.9,9.7,9.5,9.2,9.0,9.3,9.8,9.8,9.6,9.4,9.3,9.2,9.2,9.0,8.8,8.7,8.7,9.1,9.7,9.8,9.6,9.4,9.4,9.5,9.4,9.3,9.2,9.0,8.9,9.2,9.8,9.9,9.6,9.2,9.1,9.1,9.0,8.9,8.7,8.5,8.3,8.5,8.7,8.4,8.1,7.8,7.7,7.5,7.2,6.8,6.7,6.4,6.3,6.8,7.3,7.1,7.0,6.8,6.6,6.3,6.1,6.1,6.3,6.3,6.0,6.2,6.4,6.8,7.5,7.5,7.6,7.6,7.4,7.3,7.1,6.9,6.8,7.5,7.6,7.8,8.0,8.1,8.2,8.3,8.2,8.0,7.9,7.6,7.6,8.3,8.4,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8.0,8.2,8.1,8.1,8.0,7.9,7.9) > #'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.08561491 -0.08585987 -0.08610503 -0.08635037 -0.08659591 -0.08684163 [7] -0.08708755 -0.08733365 -0.08757993 -0.08782641 -0.08807306 -0.08831991 [13] -0.08856694 -0.08881415 -0.08906154 -0.08930911 -0.08955687 -0.08980480 [19] -0.09005292 -0.09030121 -0.09054968 -0.09079832 -0.09104715 -0.09129615 [25] -0.09154532 -0.09179467 -0.09204419 -0.09229388 -0.09254374 -0.09279378 [31] -0.09304398 -0.09329435 -0.09354489 -0.09379560 -0.09404648 -0.09429752 [37] -0.09454873 -0.09480010 -0.09505163 -0.09530333 -0.09555519 -0.09580721 [43] -0.09605939 -0.09631173 -0.09656423 -0.09681688 -0.09706970 -0.09732267 [49] -0.09757579 -0.09782907 -0.09808251 -0.09833609 -0.09858983 -0.09884372 [55] -0.09909776 -0.09935195 -0.09960629 -0.09986078 -0.10011542 -0.10037020 [61] -0.10062512 -0.10088020 -0.10113541 -0.10139077 -0.10164627 -0.10190192 [67] -0.10215770 -0.10241362 -0.10266968 -0.10292589 -0.10318222 -0.10343870 [73] -0.10369531 -0.10395205 -0.10420893 -0.10446594 -0.10472309 -0.10498036 [79] -0.10523777 -0.10549531 -0.10575297 -0.10601077 -0.10626869 -0.10652673 [85] -0.10678491 -0.10704320 -0.10730162 -0.10756017 -0.10781884 -0.10807762 [91] -0.10833653 -0.10859556 -0.10885471 -0.10911397 -0.10937335 -0.10963285 [97] -0.10989246 -0.11015219 -0.11041203 -0.11067199 -0.11093205 -0.11119223 [103] -0.11145251 -0.11171291 -0.11197342 -0.11223403 -0.11249475 -0.11275557 [109] -0.11301650 -0.11327754 -0.11353867 -0.11379991 -0.11406126 -0.11432270 [115] -0.11458424 -0.11484588 -0.11510762 -0.11536946 -0.11563139 -0.11589342 [121] -0.11615554 -0.11641776 -0.11668006 -0.11694247 -0.11720496 -0.11746754 [127] -0.11773021 -0.11799297 -0.11825582 -0.11851875 -0.11878178 -0.11904488 [133] -0.11930807 -0.11957134 -0.11983470 -0.12009814 -0.12036165 -0.12062525 [139] -0.12088893 -0.12115268 -0.12141651 -0.12168042 -0.12194440 -0.12220846 [145] -0.12247259 -0.12273679 -0.12300107 -0.12326541 -0.12352983 -0.12379432 [151] -0.12405887 -0.12432349 -0.12458818 -0.12485293 -0.12511775 -0.12538263 [157] -0.12564758 -0.12591258 -0.12617765 -0.12644278 -0.12670797 -0.12697322 [163] -0.12723852 -0.12750388 -0.12776930 -0.12803477 -0.12830030 -0.12856588 [169] -0.12883151 -0.12909720 -0.12936293 -0.12962872 -0.12989455 -0.13016043 [175] -0.13042636 -0.13069234 -0.13095836 -0.13122442 -0.13149053 -0.13175668 [181] -0.13202288 -0.13228911 -0.13255539 -0.13282170 -0.13308805 -0.13335444 [187] -0.13362087 -0.13388733 -0.13415383 -0.13442036 -0.13468692 -0.13495352 [193] -0.13522015 -0.13548680 -0.13575349 -0.13602021 -0.13628695 -0.13655372 [199] -0.13682052 -0.13708734 -0.13735419 -0.13762106 -0.13788795 -0.13815487 [205] -0.13842180 -0.13868876 -0.13895573 -0.13922272 -0.13948973 -0.13975676 [211] -0.14002380 -0.14029086 -0.14055793 -0.14082501 -0.14109210 -0.14135921 [217] -0.14162633 -0.14189345 -0.14216059 -0.14242773 -0.14269488 -0.14296204 [223] -0.14322920 -0.14349636 -0.14376353 -0.14403070 -0.14429788 -0.14456505 [229] -0.14483222 -0.14509940 -0.14536657 -0.14563374 -0.14590090 -0.14616806 [235] -0.14643522 -0.14670237 -0.14696951 -0.14723665 -0.14750377 -0.14777089 [241] -0.14803799 -0.14830509 -0.14857217 -0.14883924 -0.14910630 -0.14937334 [247] -0.14964037 -0.14990738 -0.15017437 -0.15044135 -0.15070830 -0.15097524 [253] -0.15124216 -0.15150905 -0.15177592 -0.15204277 -0.15230960 -0.15257640 [259] -0.15284318 -0.15310992 -0.15337665 -0.15364334 -0.15391000 -0.15417664 [265] -0.15444324 -0.15470982 -0.15497636 -0.15524287 -0.15550934 -0.15577578 [271] -0.15604218 -0.15630855 -0.15657488 -0.15684117 -0.15710742 -0.15737363 [277] -0.15763981 -0.15790594 -0.15817203 -0.15843807 -0.15870407 -0.15897003 [283] -0.15923594 -0.15950181 -0.15976763 -0.16003340 -0.16029912 -0.16056479 [289] -0.16083041 -0.16109598 -0.16136150 -0.16162697 -0.16189238 -0.16215774 [295] -0.16242304 -0.16268829 -0.16295348 -0.16321861 -0.16348368 -0.16374870 [301] -0.16401365 -0.16427855 -0.16454338 -0.16480815 -0.16507286 -0.16533750 [307] -0.16560208 -0.16586659 -0.16613104 -0.16639542 -0.16665973 -0.16692397 [313] -0.16718814 -0.16745225 -0.16771628 -0.16798024 -0.16824412 -0.16850794 [319] -0.16877168 -0.16903534 -0.16929893 -0.16956244 -0.16982588 -0.17008924 [325] -0.17035252 -0.17061571 -0.17087883 -0.17114187 -0.17140483 -0.17166770 [331] -0.17193049 -0.17219320 -0.17245582 -0.17271835 -0.17298080 -0.17324316 [337] -0.17350544 -0.17376762 -0.17402972 -0.17429172 -0.17455364 -0.17481546 [343] -0.17507719 -0.17533883 -0.17560038 -0.17586182 -0.17612318 -0.17638444 [349] -0.17664560 -0.17690666 -0.17716763 -0.17742849 -0.17768926 -0.17794993 [355] -0.17821049 -0.17847096 -0.17873132 -0.17899158 -0.17925173 -0.17951178 [361] -0.17977172 -0.18003156 -0.18029129 -0.18055091 -0.18081043 -0.18106983 [367] -0.18132913 -0.18158831 -0.18184739 -0.18210635 -0.18236520 -0.18262393 [373] -0.18288256 -0.18314106 -0.18339946 -0.18365773 -0.18391589 -0.18417394 [379] -0.18443186 -0.18468967 -0.18494735 -0.18520492 -0.18546236 -0.18571969 [385] -0.18597689 -0.18623397 -0.18649092 -0.18674775 -0.18700446 -0.18726104 [391] -0.18751749 -0.18777382 -0.18803002 -0.18828609 -0.18854204 -0.18879785 [397] -0.18905353 -0.18930909 -0.18956451 -0.18981980 -0.19007495 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/rcomp/tmp/1uw5x1257788683.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/rcomp/tmp/2ozkc1257788683.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/rcomp/tmp/306q01257788683.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/rcomp/tmp/49o3q1257788683.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/rcomp/tmp/5waef1257788683.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/65xxw1257788683.tab") > system("convert tmp/1uw5x1257788683.ps tmp/1uw5x1257788683.png") > system("convert tmp/2ozkc1257788683.ps tmp/2ozkc1257788683.png") > system("convert tmp/306q01257788683.ps tmp/306q01257788683.png") > system("convert tmp/49o3q1257788683.ps tmp/49o3q1257788683.png") > system("convert tmp/5waef1257788683.ps tmp/5waef1257788683.png") > > > proc.time() user system elapsed 1.340 1.190 2.336