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(111.4,114.1,121.8,127.6,129.9,128.0,123.5,124.0,127.4,127.6,128.4,131.4,135.1,134.0,144.5,147.3,150.9,148.7,141.4,138.9,139.8,145.6,147.9,148.5,151.1,157.5,167.5,172.3,173.5,187.5,205.5,195.1,204.5,204.5,201.7,207.0,206.6,210.6,211.1,215.0,223.9,238.2,238.9,229.6,232.2,222.1,221.6,227.3,221.0,213.6,243.4,253.8,265.3,268.2,268.5,266.9,268.4,250.8,231.2,192.0) > #'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.9137438 0.9137819 0.9138194 0.9138562 0.9138924 0.9139279 0.9139628 [8] 0.9139970 0.9140306 0.9140635 0.9140958 0.9141274 0.9141584 0.9141887 [15] 0.9142183 0.9142473 0.9142757 0.9143034 0.9143304 0.9143568 0.9143825 [22] 0.9144076 0.9144320 0.9144557 0.9144788 0.9145012 0.9145230 0.9145441 [29] 0.9145646 0.9145844 0.9146035 0.9146220 0.9146398 0.9146569 0.9146734 [36] 0.9146892 0.9147044 0.9147189 0.9147327 0.9147459 0.9147584 0.9147702 [43] 0.9147814 0.9147919 0.9148017 0.9148109 0.9148194 0.9148272 0.9148344 [50] 0.9148409 0.9148467 0.9148519 0.9148564 0.9148602 0.9148634 0.9148658 [57] 0.9148677 0.9148688 0.9148693 0.9148691 0.9148682 0.9148666 0.9148644 [64] 0.9148615 0.9148579 0.9148537 0.9148487 0.9148431 0.9148369 0.9148299 [71] 0.9148223 0.9148140 0.9148050 0.9147954 0.9147850 0.9147740 0.9147623 [78] 0.9147499 0.9147369 0.9147232 0.9147088 0.9146937 0.9146779 0.9146614 [85] 0.9146443 0.9146265 0.9146080 0.9145888 0.9145690 0.9145484 0.9145272 [92] 0.9145053 0.9144827 0.9144594 0.9144355 0.9144108 0.9143855 0.9143595 [99] 0.9143328 0.9143054 0.9142773 0.9142485 0.9142191 0.9141889 0.9141581 [106] 0.9141266 0.9140944 0.9140615 0.9140279 0.9139937 0.9139587 0.9139231 [113] 0.9138867 0.9138497 0.9138120 0.9137736 0.9137345 0.9136947 0.9136542 [120] 0.9136131 0.9135712 0.9135286 0.9134854 0.9134414 0.9133968 0.9133515 [127] 0.9133055 0.9132587 0.9132113 0.9131632 0.9131144 0.9130649 0.9130147 [134] 0.9129639 0.9129123 0.9128600 0.9128070 0.9127534 0.9126990 0.9126439 [141] 0.9125882 0.9125317 0.9124746 0.9124167 0.9123582 0.9122989 0.9122390 [148] 0.9121783 0.9121170 0.9120549 0.9119922 0.9119288 0.9118646 0.9117998 [155] 0.9117342 0.9116680 0.9116011 0.9115334 0.9114651 0.9113960 0.9113263 [162] 0.9112559 0.9111847 0.9111129 0.9110403 0.9109671 0.9108931 0.9108185 [169] 0.9107431 0.9106670 0.9105903 0.9105128 0.9104347 0.9103558 0.9102762 [176] 0.9101959 0.9101150 0.9100333 0.9099509 0.9098678 0.9097840 0.9096995 [183] 0.9096143 0.9095284 0.9094418 0.9093545 0.9092665 0.9091778 0.9090883 [190] 0.9089982 0.9089074 0.9088158 0.9087236 0.9086306 0.9085370 0.9084426 [197] 0.9083475 0.9082518 0.9081553 0.9080581 0.9079602 0.9078617 0.9077624 [204] 0.9076624 0.9075617 0.9074602 0.9073581 0.9072553 0.9071518 0.9070475 [211] 0.9069426 0.9068370 0.9067306 0.9066236 0.9065158 0.9064073 0.9062982 [218] 0.9061883 0.9060777 0.9059664 0.9058545 0.9057418 0.9056284 0.9055143 [225] 0.9053995 0.9052839 0.9051677 0.9050508 0.9049332 0.9048149 0.9046958 [232] 0.9045761 0.9044556 0.9043345 0.9042126 0.9040901 0.9039668 0.9038429 [239] 0.9037182 0.9035928 0.9034668 0.9033400 0.9032125 0.9030843 0.9029555 [246] 0.9028259 0.9026956 0.9025646 0.9024329 0.9023005 0.9021674 0.9020337 [253] 0.9018992 0.9017640 0.9016281 0.9014915 0.9013542 0.9012162 0.9010775 [260] 0.9009381 0.9007980 0.9006572 0.9005158 0.9003736 0.9002307 0.9000871 [267] 0.8999428 0.8997979 0.8996522 0.8995058 0.8993587 0.8992110 0.8990625 [274] 0.8989134 0.8987635 0.8986130 0.8984618 0.8983098 0.8981572 0.8980039 [281] 0.8978499 0.8976952 0.8975398 0.8973837 0.8972270 0.8970695 0.8969113 [288] 0.8967525 0.8965930 0.8964327 0.8962718 0.8961102 0.8959479 0.8957850 [295] 0.8956213 0.8954570 0.8952919 0.8951262 0.8949598 0.8947927 0.8946249 [302] 0.8944565 0.8942874 0.8941175 0.8939470 0.8937759 0.8936040 0.8934315 [309] 0.8932582 0.8930843 0.8929097 0.8927345 0.8925586 0.8923819 0.8922047 [316] 0.8920267 0.8918481 0.8916687 0.8914888 0.8913081 0.8911268 0.8909448 [323] 0.8907621 0.8905787 0.8903947 0.8902100 0.8900247 0.8898387 0.8896520 [330] 0.8894646 0.8892766 0.8890879 0.8888986 0.8887086 0.8885179 0.8883266 [337] 0.8881346 0.8879419 0.8877486 0.8875546 0.8873600 0.8871647 0.8869688 [344] 0.8867722 0.8865749 0.8863770 0.8861784 0.8859792 0.8857793 0.8855788 [351] 0.8853776 0.8851758 0.8849734 0.8847702 0.8845665 0.8843621 0.8841570 [358] 0.8839513 0.8837450 0.8835380 0.8833304 0.8831221 0.8829132 0.8827037 [365] 0.8824935 0.8822827 0.8820713 0.8818592 0.8816465 0.8814332 0.8812192 [372] 0.8810046 0.8807893 0.8805735 0.8803570 0.8801399 0.8799221 0.8797038 [379] 0.8794848 0.8792652 0.8790449 0.8788241 0.8786026 0.8783805 0.8781578 [386] 0.8779345 0.8777106 0.8774860 0.8772609 0.8770351 0.8768087 0.8765818 [393] 0.8763542 0.8761260 0.8758972 0.8756678 0.8754377 0.8752071 0.8749759 [400] 0.8747441 0.8745117 > mx [1] 0.9148693 > mxli [1] -1.42 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1577o1226595432.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/2jc2j1226595432.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/304dm1226595432.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/419zw1226595432.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/5uazx1226595432.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/60ojo1226595432.tab") > > system("convert tmp/1577o1226595432.ps tmp/1577o1226595432.png") > system("convert tmp/2jc2j1226595432.ps tmp/2jc2j1226595432.png") > system("convert tmp/304dm1226595432.ps tmp/304dm1226595432.png") > system("convert tmp/419zw1226595432.ps tmp/419zw1226595432.png") > system("convert tmp/5uazx1226595432.ps tmp/5uazx1226595432.png") > > > proc.time() user system elapsed 1.331 0.829 1.581