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(10.574,10.653,10.805,10.872,10.625,10.407,10.463,10.556,10.646,10.702,11.353,11.346,11.451,11.964,12.574,13.031,13.812,14.544,14.931,14.886,16.005,17.064,15.168,16.050,15.839,15.137,14.954,15.648,15.305,15.579,16.348,15.928,16.171,15.937,15.713,15.594,15.683,16.438,17.032,17.696,17.745,19.394,20.148,20.108,18.584,18.441,18.391,19.178,18.079,18.483,19.644,19.195,19.650,20.830,23.595,22.937,21.814,21.928,21.777,21.383,21.467) > #'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.9021233 0.9023757 0.9026278 0.9028795 0.9031309 0.9033819 0.9036326 [8] 0.9038829 0.9041329 0.9043825 0.9046317 0.9048806 0.9051291 0.9053772 [15] 0.9056249 0.9058722 0.9061191 0.9063657 0.9066118 0.9068575 0.9071028 [22] 0.9073477 0.9075922 0.9078362 0.9080798 0.9083230 0.9085658 0.9088081 [29] 0.9090499 0.9092913 0.9095323 0.9097727 0.9100128 0.9102523 0.9104914 [36] 0.9107300 0.9109681 0.9112057 0.9114428 0.9116795 0.9119156 0.9121512 [43] 0.9123863 0.9126209 0.9128550 0.9130886 0.9133216 0.9135541 0.9137861 [50] 0.9140175 0.9142483 0.9144786 0.9147084 0.9149376 0.9151662 0.9153943 [57] 0.9156218 0.9158487 0.9160750 0.9163008 0.9165259 0.9167505 0.9169744 [64] 0.9171977 0.9174205 0.9176426 0.9178641 0.9180849 0.9183051 0.9185247 [71] 0.9187437 0.9189620 0.9191797 0.9193967 0.9196130 0.9198287 0.9200438 [78] 0.9202581 0.9204718 0.9206848 0.9208971 0.9211087 0.9213196 0.9215299 [85] 0.9217394 0.9219482 0.9221563 0.9223637 0.9225703 0.9227762 0.9229814 [92] 0.9231859 0.9233896 0.9235926 0.9237948 0.9239962 0.9241969 0.9243969 [99] 0.9245961 0.9247944 0.9249921 0.9251889 0.9253849 0.9255802 0.9257746 [106] 0.9259683 0.9261611 0.9263532 0.9265444 0.9267348 0.9269244 0.9271131 [113] 0.9273011 0.9274881 0.9276744 0.9278598 0.9280443 0.9282280 0.9284108 [120] 0.9285928 0.9287738 0.9289541 0.9291334 0.9293118 0.9294894 0.9296661 [127] 0.9298419 0.9300167 0.9301907 0.9303638 0.9305359 0.9307072 0.9308775 [134] 0.9310468 0.9312153 0.9313828 0.9315494 0.9317150 0.9318797 0.9320434 [141] 0.9322062 0.9323680 0.9325289 0.9326888 0.9328477 0.9330056 0.9331626 [148] 0.9333185 0.9334735 0.9336275 0.9337804 0.9339324 0.9340834 0.9342333 [155] 0.9343823 0.9345302 0.9346771 0.9348230 0.9349678 0.9351116 0.9352544 [162] 0.9353961 0.9355368 0.9356764 0.9358150 0.9359525 0.9360890 0.9362244 [169] 0.9363587 0.9364919 0.9366241 0.9367552 0.9368852 0.9370141 0.9371419 [176] 0.9372686 0.9373942 0.9375188 0.9376422 0.9377645 0.9378857 0.9380057 [183] 0.9381247 0.9382425 0.9383592 0.9384747 0.9385892 0.9387024 0.9388146 [190] 0.9389256 0.9390354 0.9391441 0.9392517 0.9393580 0.9394633 0.9395673 [197] 0.9396702 0.9397719 0.9398724 0.9399718 0.9400700 0.9401670 0.9402628 [204] 0.9403574 0.9404508 0.9405430 0.9406340 0.9407239 0.9408125 0.9408999 [211] 0.9409861 0.9410711 0.9411548 0.9412374 0.9413187 0.9413988 0.9414776 [218] 0.9415553 0.9416317 0.9417068 0.9417807 0.9418534 0.9419249 0.9419951 [225] 0.9420640 0.9421317 0.9421981 0.9422633 0.9423272 0.9423899 0.9424513 [232] 0.9425114 0.9425703 0.9426279 0.9426842 0.9427392 0.9427930 0.9428455 [239] 0.9428967 0.9429466 0.9429952 0.9430426 0.9430886 0.9431334 0.9431769 [246] 0.9432191 0.9432599 0.9432995 0.9433378 0.9433748 0.9434105 0.9434448 [253] 0.9434779 0.9435096 0.9435401 0.9435692 0.9435970 0.9436235 0.9436487 [260] 0.9436726 0.9436951 0.9437163 0.9437362 0.9437548 0.9437721 0.9437880 [267] 0.9438026 0.9438158 0.9438278 0.9438384 0.9438476 0.9438556 0.9438622 [274] 0.9438674 0.9438714 0.9438740 0.9438752 0.9438751 0.9438737 0.9438709 [281] 0.9438668 0.9438614 0.9438546 0.9438464 0.9438369 0.9438261 0.9438139 [288] 0.9438004 0.9437855 0.9437693 0.9437517 0.9437328 0.9437126 0.9436909 [295] 0.9436680 0.9436437 0.9436180 0.9435910 0.9435626 0.9435329 0.9435018 [302] 0.9434694 0.9434356 0.9434005 0.9433640 0.9433262 0.9432870 0.9432465 [309] 0.9432046 0.9431614 0.9431168 0.9430708 0.9430236 0.9429749 0.9429249 [316] 0.9428736 0.9428209 0.9427669 0.9427115 0.9426548 0.9425967 0.9425373 [323] 0.9424765 0.9424144 0.9423509 0.9422861 0.9422200 0.9421525 0.9420836 [330] 0.9420134 0.9419419 0.9418691 0.9417949 0.9417193 0.9416425 0.9415642 [337] 0.9414847 0.9414038 0.9413216 0.9412380 0.9411532 0.9410670 0.9409794 [344] 0.9408906 0.9408004 0.9407088 0.9406160 0.9405218 0.9404264 0.9403295 [351] 0.9402314 0.9401320 0.9400312 0.9399292 0.9398258 0.9397211 0.9396151 [358] 0.9395078 0.9393991 0.9392892 0.9391780 0.9390654 0.9389516 0.9388365 [365] 0.9387201 0.9386023 0.9384833 0.9383630 0.9382414 0.9381186 0.9379944 [372] 0.9378689 0.9377422 0.9376142 0.9374849 0.9373544 0.9372225 0.9370894 [379] 0.9369551 0.9368194 0.9366825 0.9365444 0.9364049 0.9362643 0.9361223 [386] 0.9359791 0.9358347 0.9356890 0.9355421 0.9353939 0.9352445 0.9350938 [393] 0.9349419 0.9347888 0.9346345 0.9344789 0.9343221 0.9341640 0.9340048 [400] 0.9338443 0.9336826 > mx [1] 0.9438752 > mxli [1] 0.76 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/rcomp/tmp/10gip1257954079.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/2j2d51257954079.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/36nf11257954079.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/4uirv1257954079.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/5wimr1257954079.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/6hx6o1257954079.tab") > > system("convert tmp/10gip1257954079.ps tmp/10gip1257954079.png") > system("convert tmp/2j2d51257954079.ps tmp/2j2d51257954079.png") > system("convert tmp/36nf11257954079.ps tmp/36nf11257954079.png") > system("convert tmp/4uirv1257954079.ps tmp/4uirv1257954079.png") > system("convert tmp/5wimr1257954079.ps tmp/5wimr1257954079.png") > > > proc.time() user system elapsed 1.390 1.150 2.384