R version 2.8.0 (2008-10-20) 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(19.2,19.32,19.82,20.36,24.31,25.97,25.61,24.67,25.59,26.09,28.37,27.34,24.46,27.46,30.23,32.33,29.87,24.87,25.48,27.28,28.24,29.58,26.95,29.08,28.76,29.59,30.7,30.52,32.67,33.19,37.13,35.54,37.75,41.84,42.94,49.14,44.61,40.22,44.23,45.85,53.38,53.26,51.8,55.3,57.81,63.96,63.77,59.15,56.12,57.42,63.52,61.71,63.01,68.18,72.03,69.75,74.41,74.33,64.24,60.03,59.44,62.5,55.04,58.34,61.92,67.65,67.68,70.3,75.26,71.44,76.36,81.71,92.6,90.6,92.23,94.09,102.79,109.65,124.05,132.69,135.81,116.07) > #'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.9013642 0.9018792 0.9023929 0.9029052 0.9034162 0.9039259 0.9044342 [8] 0.9049412 0.9054469 0.9059512 0.9064541 0.9069556 0.9074557 0.9079545 [15] 0.9084518 0.9089478 0.9094423 0.9099354 0.9104270 0.9109172 0.9114060 [22] 0.9118933 0.9123791 0.9128634 0.9133463 0.9138277 0.9143075 0.9147859 [29] 0.9152627 0.9157380 0.9162118 0.9166840 0.9171547 0.9176238 0.9180913 [36] 0.9185573 0.9190216 0.9194844 0.9199455 0.9204050 0.9208629 0.9213191 [43] 0.9217737 0.9222266 0.9226779 0.9231275 0.9235753 0.9240215 0.9244660 [50] 0.9249087 0.9253497 0.9257890 0.9262265 0.9266622 0.9270961 0.9275283 [57] 0.9279586 0.9283872 0.9288139 0.9292387 0.9296618 0.9300829 0.9305022 [64] 0.9309196 0.9313351 0.9317487 0.9321603 0.9325700 0.9329778 0.9333836 [71] 0.9337874 0.9341892 0.9345891 0.9349869 0.9353826 0.9357763 0.9361680 [78] 0.9365575 0.9369450 0.9373304 0.9377136 0.9380947 0.9384737 0.9388505 [85] 0.9392251 0.9395975 0.9399677 0.9403356 0.9407013 0.9410647 0.9414259 [92] 0.9417847 0.9421412 0.9424954 0.9428473 0.9431967 0.9435438 0.9438885 [99] 0.9442307 0.9445705 0.9449079 0.9452428 0.9455751 0.9459050 0.9462323 [106] 0.9465570 0.9468792 0.9471987 0.9475157 0.9478300 0.9481416 0.9484506 [113] 0.9487569 0.9490604 0.9493612 0.9496593 0.9499545 0.9502469 0.9505366 [120] 0.9508233 0.9511072 0.9513882 0.9516662 0.9519413 0.9522135 0.9524826 [127] 0.9527488 0.9530119 0.9532719 0.9535288 0.9537827 0.9540334 0.9542809 [134] 0.9545253 0.9547664 0.9550043 0.9552390 0.9554703 0.9556984 0.9559231 [141] 0.9561444 0.9563624 0.9565769 0.9567880 0.9569956 0.9571997 0.9574003 [148] 0.9575974 0.9577908 0.9579807 0.9581669 0.9583495 0.9585283 0.9587035 [155] 0.9588749 0.9590426 0.9592064 0.9593664 0.9595226 0.9596748 0.9598232 [162] 0.9599676 0.9601080 0.9602445 0.9603769 0.9605052 0.9606295 0.9607496 [169] 0.9608656 0.9609774 0.9610850 0.9611884 0.9612875 0.9613823 0.9614728 [176] 0.9615590 0.9616407 0.9617181 0.9617910 0.9618595 0.9619234 0.9619828 [183] 0.9620377 0.9620880 0.9621336 0.9621746 0.9622110 0.9622426 0.9622695 [190] 0.9622916 0.9623090 0.9623215 0.9623292 0.9623320 0.9623299 0.9623229 [197] 0.9623109 0.9622940 0.9622720 0.9622449 0.9622128 0.9621756 0.9621333 [204] 0.9620858 0.9620332 0.9619753 0.9619122 0.9618438 0.9617702 0.9616912 [211] 0.9616069 0.9615173 0.9614222 0.9613218 0.9612159 0.9611045 0.9609877 [218] 0.9608654 0.9607375 0.9606041 0.9604651 0.9603205 0.9601702 0.9600144 [225] 0.9598529 0.9596857 0.9595127 0.9593341 0.9591497 0.9589596 0.9587636 [232] 0.9585619 0.9583544 0.9581410 0.9579217 0.9576966 0.9574656 0.9572287 [239] 0.9569859 0.9567372 0.9564825 0.9562218 0.9559552 0.9556825 0.9554039 [246] 0.9551193 0.9548286 0.9545319 0.9542292 0.9539204 0.9536055 0.9532846 [253] 0.9529575 0.9526244 0.9522852 0.9519399 0.9515885 0.9512310 0.9508673 [260] 0.9504976 0.9501217 0.9497396 0.9493515 0.9489572 0.9485567 0.9481502 [267] 0.9477375 0.9473187 0.9468937 0.9464626 0.9460254 0.9455820 0.9451326 [274] 0.9446770 0.9442153 0.9437475 0.9432736 0.9427936 0.9423075 0.9418153 [281] 0.9413171 0.9408128 0.9403025 0.9397862 0.9392638 0.9387354 0.9382010 [288] 0.9376606 0.9371143 0.9365620 0.9360037 0.9354395 0.9348695 0.9342935 [295] 0.9337117 0.9331240 0.9325304 0.9319311 0.9313260 0.9307151 0.9300984 [302] 0.9294761 0.9288480 0.9282142 0.9275748 0.9269298 0.9262791 0.9256229 [309] 0.9249611 0.9242938 0.9236210 0.9229427 0.9222590 0.9215699 0.9208754 [316] 0.9201755 0.9194704 0.9187599 0.9180442 0.9173233 0.9165972 0.9158659 [323] 0.9151295 0.9143881 0.9136416 0.9128900 0.9121335 0.9113721 0.9106057 [330] 0.9098345 0.9090585 0.9082777 0.9074921 0.9067018 0.9059069 0.9051073 [337] 0.9043031 0.9034944 0.9026812 0.9018635 0.9010414 0.9002149 0.8993841 [344] 0.8985490 0.8977096 0.8968660 0.8960183 0.8951665 0.8943105 0.8934506 [351] 0.8925867 0.8917188 0.8908470 0.8899714 0.8890920 0.8882088 0.8873220 [358] 0.8864314 0.8855373 0.8846396 0.8837384 0.8828337 0.8819256 0.8810141 [365] 0.8800992 0.8791811 0.8782598 0.8773353 0.8764077 0.8754769 0.8745431 [372] 0.8736064 0.8726667 0.8717241 0.8707787 0.8698304 0.8688795 0.8679258 [379] 0.8669695 0.8660105 0.8650491 0.8640851 0.8631187 0.8621499 0.8611787 [386] 0.8602052 0.8592295 0.8582515 0.8572714 0.8562892 0.8553049 0.8543186 [393] 0.8533303 0.8523401 0.8513480 0.8503541 0.8493585 0.8483611 0.8473620 [400] 0.8463613 0.8453589 > mx [1] 0.962332 > mxli [1] -0.07 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1aktn1228242122.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/2owts1228242122.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/3wacu1228242122.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/4wduv1228242122.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/52cby1228242122.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/65cx81228242122.tab") > > system("convert tmp/1aktn1228242122.ps tmp/1aktn1228242122.png") > system("convert tmp/2owts1228242122.ps tmp/2owts1228242122.png") > system("convert tmp/3wacu1228242122.ps tmp/3wacu1228242122.png") > system("convert tmp/4wduv1228242122.ps tmp/4wduv1228242122.png") > system("convert tmp/52cby1228242122.ps tmp/52cby1228242122.png") > > > proc.time() user system elapsed 1.088 0.792 1.333