R version 2.6.1 (2007-11-26) Copyright (C) 2007 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(1.9,3,6,7.9,8,8.3,9,9.4,9.9,10,10.2,10.6,10.8,10.9,11,11.1,11.1,11.3,11.3,11.5,11.6,11.6,11.7,11.8,11.8,12.2,12.4,12.6,12.7,12.9,13.1,13.1,13.1,13.2,13.3,13.4,13.4,13.6,13.7,13.7,13.8,13.9,14,14.1,14.2,14.4,14.4,14.5,14.5,14.6,14.6,14.7,14.7,14.8,14.9,14.9,15,15.1,15.2,15.3,15.5,15.5,15.5,15.6,15.6,15.7,15.7,15.8,15.9,15.9,16,16,16.1,16.2,16.2,16.3,16.4,16.4,16.4,16.4,16.7,16.8,16.9,17,17,17,17.2,17.3,17.3,17.4,17.4,17.6,17.6,17.6,17.6,17.7,17.9,18,18.1,18.2,18.2,18.3,18.3,18.6,18.6,18.7,18.7,18.8,18.8,18.9,18.9,19.1,19.2,19.3,19.5,19.5,19.6,19.8,19.8,19.8,20.2,20.2,20.2,20.5,20.6,20.7,20.8,20.8,20.9,21,21,21,21.1,21.1,21.4,21.8,21.9,21.9,21.9,22,22.2,22.4,22.5,22.8,22.9,23.2,23.3,23.4,23.5,23.5,23.6,23.7,23.8,24.1,24.2,24.2,24.2,24.3,24.5,24.8,24.9,24.9,24.9,25.8,26.1,26.2,26.4,26.8,29.9,31.8,32.6,35.2) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Normality Plot (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxnorm.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.3723948 0.3740354 0.3756944 0.3773718 0.3790678 0.3807825 0.3825161 [8] 0.3842687 0.3860404 0.3878315 0.3896421 0.3914722 0.3933221 0.3951918 [15] 0.3970815 0.3989914 0.4009215 0.4028721 0.4048431 0.4068348 0.4088472 [22] 0.4108805 0.4129348 0.4150102 0.4171068 0.4192247 0.4213641 0.4235249 [29] 0.4257074 0.4279115 0.4301375 0.4323853 0.4346550 0.4369468 0.4392606 [36] 0.4415966 0.4439547 0.4463351 0.4487379 0.4511629 0.4536103 0.4560802 [43] 0.4585724 0.4610871 0.4636243 0.4661839 0.4687660 0.4713705 0.4739974 [50] 0.4766467 0.4793185 0.4820125 0.4847288 0.4874674 0.4902281 0.4930108 [57] 0.4958156 0.4986423 0.5014909 0.5043611 0.5072529 0.5101662 0.5131008 [64] 0.5160565 0.5190333 0.5220310 0.5250493 0.5280881 0.5311471 0.5342263 [71] 0.5373253 0.5404439 0.5435819 0.5467391 0.5499151 0.5531097 0.5563226 [78] 0.5595535 0.5628021 0.5660680 0.5693510 0.5726507 0.5759668 0.5792988 [85] 0.5826464 0.5860092 0.5893869 0.5927789 0.5961849 0.5996044 0.6030369 [92] 0.6064821 0.6099395 0.6134085 0.6168888 0.6203797 0.6238807 0.6273915 [99] 0.6309113 0.6344397 0.6379762 0.6415201 0.6450709 0.6486281 0.6521910 [106] 0.6557590 0.6593316 0.6629081 0.6664880 0.6700705 0.6736551 0.6772412 [113] 0.6808281 0.6844151 0.6880016 0.6915870 0.6951706 0.6987517 0.7023297 [120] 0.7059040 0.7094738 0.7130384 0.7165973 0.7201498 0.7236951 0.7272326 [127] 0.7307617 0.7342817 0.7377919 0.7412917 0.7447804 0.7482574 0.7517220 [134] 0.7551736 0.7586115 0.7620351 0.7654439 0.7688371 0.7722142 0.7755746 [141] 0.7789176 0.7822428 0.7855494 0.7888371 0.7921051 0.7953531 0.7985803 [148] 0.8017864 0.8049708 0.8081330 0.8112725 0.8143889 0.8174816 0.8205504 [155] 0.8235946 0.8266140 0.8296080 0.8325764 0.8355187 0.8384345 0.8413236 [162] 0.8441856 0.8470201 0.8498269 0.8526057 0.8553562 0.8580782 0.8607713 [169] 0.8634355 0.8660704 0.8686759 0.8712517 0.8737978 0.8763140 0.8788000 [176] 0.8812559 0.8836814 0.8860766 0.8884412 0.8907753 0.8930787 0.8953515 [183] 0.8975936 0.8998050 0.9019856 0.9041356 0.9062549 0.9083435 0.9104014 [190] 0.9124289 0.9144258 0.9163923 0.9183285 0.9202344 0.9221102 0.9239559 [197] 0.9257718 0.9275579 0.9293144 0.9310414 0.9327391 0.9344076 0.9360472 [204] 0.9376580 0.9392401 0.9407938 0.9423193 0.9438168 0.9452865 0.9467285 [211] 0.9481432 0.9495307 0.9508913 0.9522252 0.9535326 0.9548138 0.9560691 [218] 0.9572985 0.9585025 0.9596813 0.9608351 0.9619641 0.9630686 0.9641490 [225] 0.9652053 0.9662380 0.9672472 0.9682332 0.9691964 0.9701368 0.9710549 [232] 0.9719508 0.9728249 0.9736774 0.9745085 0.9753185 0.9761077 0.9768763 [239] 0.9776247 0.9783530 0.9790614 0.9797504 0.9804200 0.9810707 0.9817025 [246] 0.9823158 0.9829108 0.9834878 0.9840469 0.9845885 0.9851128 0.9856200 [253] 0.9861103 0.9865840 0.9870414 0.9874825 0.9879077 0.9883172 0.9887112 [260] 0.9890899 0.9894536 0.9898024 0.9901365 0.9904563 0.9907617 0.9910532 [267] 0.9913308 0.9915948 0.9918454 0.9920827 0.9923069 0.9925183 0.9927170 [274] 0.9929032 0.9930771 0.9932388 0.9933885 0.9935264 0.9936527 0.9937675 [281] 0.9938710 0.9939633 0.9940447 0.9941152 0.9941750 0.9942243 0.9942632 [288] 0.9942918 0.9943104 0.9943190 0.9943178 0.9943069 0.9942865 0.9942566 [295] 0.9942175 0.9941692 0.9941118 0.9940456 0.9939706 0.9938869 0.9937946 [302] 0.9936939 0.9935849 0.9934677 0.9933423 0.9932090 0.9930677 0.9929187 [309] 0.9927620 0.9925977 0.9924259 0.9922467 0.9920602 0.9918665 0.9916656 [316] 0.9914578 0.9912430 0.9910213 0.9907929 0.9905577 0.9903160 0.9900677 [323] 0.9898130 0.9895519 0.9892845 0.9890109 0.9887312 0.9884453 0.9881535 [330] 0.9878557 0.9875520 0.9872425 0.9869273 0.9866064 0.9862799 0.9859478 [337] 0.9856103 0.9852673 0.9849189 0.9845652 0.9842063 0.9838421 0.9834728 [344] 0.9830984 0.9827190 0.9823345 0.9819452 0.9815509 0.9811517 0.9807478 [351] 0.9803391 0.9799258 0.9795077 0.9790851 0.9786578 0.9782261 0.9777898 [358] 0.9773491 0.9769040 0.9764546 0.9760008 0.9755427 0.9750804 0.9746139 [365] 0.9741432 0.9736684 0.9731894 0.9727064 0.9722194 0.9717284 0.9712334 [372] 0.9707345 0.9702317 0.9697250 0.9692145 0.9687001 0.9681820 0.9676602 [379] 0.9671347 0.9666054 0.9660725 0.9655360 0.9649959 0.9644522 0.9639050 [386] 0.9633542 0.9627999 0.9622422 0.9616811 0.9611165 0.9605485 0.9599772 [393] 0.9594025 0.9588245 0.9582433 0.9576587 0.9570709 0.9564799 0.9558857 [400] 0.9552882 0.9546877 > mx [1] 0.994319 > mxli [1] 0.89 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1fo1k1203800249.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/freestat/rcomp/tmp/26quv1203800249.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/freestat/rcomp/tmp/31ai81203800249.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/freestat/rcomp/tmp/4315r1203800249.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/5lpub1203800249.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > grid() > mtext('Transformed Data') > dev.off() null device 1 > load(file='/var/www/html/freestat/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/freestat/rcomp/tmp/647yu1203800249.tab") > > system("convert tmp/1fo1k1203800249.ps tmp/1fo1k1203800249.png") > system("convert tmp/26quv1203800249.ps tmp/26quv1203800249.png") > system("convert tmp/31ai81203800249.ps tmp/31ai81203800249.png") > system("convert tmp/4315r1203800249.ps tmp/4315r1203800249.png") > system("convert tmp/5lpub1203800249.ps tmp/5lpub1203800249.png") > > > proc.time() user system elapsed 1.978 1.251 2.093