R version 2.7.0 (2008-04-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(3219.2,3552.3,3787.7,3392.7,3550,3681.9,3519.1,4283.2,4046.2,3824.9,4793.1,3977.7,3983.4,4152.9,4286.1,4348.1,3949.3,4166.7,4217.9,4528.2,4232.2,4470.9,5121.2,4170.8,4398.6,4491.4,4251.8,4901.9,4745.2,4666.9,4210.4,5273.6,4095.3,4610.1,4718.1,4185.5,4314.7,4422.6,5059.2,5043.6,4436.6,4922.6,4454.8,5058.7,4768.9,5171.8,4989.3,5202.1,4838.4,4876.5,5845.3,5686.3,4753.8,6620.4,5597.2,5643.5,6357.3,5909.1,6165.8,6321.6) > #'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.8890876 0.8892011 0.8893137 0.8894254 0.8895362 0.8896462 0.8897553 [8] 0.8898635 0.8899709 0.8900773 0.8901829 0.8902876 0.8903915 0.8904944 [15] 0.8905965 0.8906976 0.8907979 0.8908973 0.8909958 0.8910934 0.8911902 [22] 0.8912860 0.8913809 0.8914750 0.8915681 0.8916604 0.8917517 0.8918422 [29] 0.8919317 0.8920203 0.8921081 0.8921949 0.8922808 0.8923659 0.8924500 [36] 0.8925332 0.8926155 0.8926968 0.8927773 0.8928569 0.8929355 0.8930132 [43] 0.8930900 0.8931659 0.8932409 0.8933149 0.8933880 0.8934602 0.8935315 [50] 0.8936019 0.8936713 0.8937398 0.8938074 0.8938740 0.8939398 0.8940045 [57] 0.8940684 0.8941313 0.8941933 0.8942544 0.8943145 0.8943737 0.8944320 [64] 0.8944893 0.8945457 0.8946011 0.8946556 0.8947092 0.8947618 0.8948135 [71] 0.8948642 0.8949140 0.8949629 0.8950108 0.8950577 0.8951037 0.8951488 [78] 0.8951929 0.8952361 0.8952783 0.8953196 0.8953599 0.8953993 0.8954377 [85] 0.8954752 0.8955117 0.8955473 0.8955819 0.8956156 0.8956483 0.8956800 [92] 0.8957108 0.8957406 0.8957695 0.8957974 0.8958244 0.8958504 0.8958755 [99] 0.8958995 0.8959227 0.8959448 0.8959660 0.8959863 0.8960056 0.8960239 [106] 0.8960412 0.8960576 0.8960731 0.8960875 0.8961011 0.8961136 0.8961252 [113] 0.8961358 0.8961454 0.8961541 0.8961618 0.8961686 0.8961744 0.8961792 [120] 0.8961830 0.8961859 0.8961879 0.8961888 0.8961888 0.8961878 0.8961859 [127] 0.8961829 0.8961791 0.8961742 0.8961684 0.8961616 0.8961538 0.8961451 [134] 0.8961354 0.8961247 0.8961131 0.8961005 0.8960869 0.8960724 0.8960569 [141] 0.8960404 0.8960230 0.8960046 0.8959852 0.8959648 0.8959435 0.8959212 [148] 0.8958980 0.8958738 0.8958486 0.8958224 0.8957953 0.8957672 0.8957381 [155] 0.8957081 0.8956771 0.8956451 0.8956122 0.8955783 0.8955435 0.8955076 [162] 0.8954708 0.8954331 0.8953943 0.8953547 0.8953140 0.8952724 0.8952298 [169] 0.8951863 0.8951418 0.8950963 0.8950499 0.8950025 0.8949541 0.8949048 [176] 0.8948545 0.8948033 0.8947511 0.8946979 0.8946438 0.8945887 0.8945327 [183] 0.8944757 0.8944177 0.8943588 0.8942990 0.8942381 0.8941764 0.8941136 [190] 0.8940500 0.8939853 0.8939197 0.8938532 0.8937857 0.8937172 0.8936479 [197] 0.8935775 0.8935062 0.8934340 0.8933608 0.8932867 0.8932116 0.8931355 [204] 0.8930586 0.8929807 0.8929018 0.8928220 0.8927412 0.8926596 0.8925769 [211] 0.8924934 0.8924089 0.8923234 0.8922370 0.8921497 0.8920615 0.8919723 [218] 0.8918822 0.8917911 0.8916991 0.8916062 0.8915124 0.8914176 0.8913219 [225] 0.8912253 0.8911277 0.8910292 0.8909298 0.8908295 0.8907283 0.8906261 [232] 0.8905230 0.8904190 0.8903141 0.8902082 0.8901015 0.8899938 0.8898852 [239] 0.8897757 0.8896653 0.8895539 0.8894417 0.8893286 0.8892145 0.8890995 [246] 0.8889837 0.8888669 0.8887492 0.8886307 0.8885112 0.8883908 0.8882696 [253] 0.8881474 0.8880243 0.8879004 0.8877755 0.8876498 0.8875232 0.8873957 [260] 0.8872672 0.8871380 0.8870078 0.8868767 0.8867448 0.8866120 0.8864782 [267] 0.8863437 0.8862082 0.8860719 0.8859347 0.8857966 0.8856576 0.8855178 [274] 0.8853771 0.8852355 0.8850931 0.8849498 0.8848057 0.8846606 0.8845148 [281] 0.8843680 0.8842204 0.8840720 0.8839227 0.8837725 0.8836215 0.8834697 [288] 0.8833170 0.8831634 0.8830090 0.8828538 0.8826977 0.8825408 0.8823830 [295] 0.8822244 0.8820650 0.8819047 0.8817436 0.8815817 0.8814189 0.8812554 [302] 0.8810909 0.8809257 0.8807597 0.8805928 0.8804251 0.8802566 0.8800872 [309] 0.8799171 0.8797461 0.8795744 0.8794018 0.8792284 0.8790542 0.8788792 [316] 0.8787034 0.8785268 0.8783494 0.8781712 0.8779923 0.8778125 0.8776319 [323] 0.8774505 0.8772684 0.8770855 0.8769017 0.8767172 0.8765320 0.8763459 [330] 0.8761591 0.8759714 0.8757831 0.8755939 0.8754040 0.8752133 0.8750218 [337] 0.8748296 0.8746366 0.8744429 0.8742484 0.8740531 0.8738571 0.8736603 [344] 0.8734628 0.8732645 0.8730655 0.8728657 0.8726652 0.8724640 0.8722620 [351] 0.8720593 0.8718558 0.8716516 0.8714467 0.8712411 0.8710347 0.8708276 [358] 0.8706198 0.8704112 0.8702020 0.8699920 0.8697813 0.8695699 0.8693577 [365] 0.8691449 0.8689314 0.8687171 0.8685022 0.8682865 0.8680702 0.8678531 [372] 0.8676354 0.8674170 0.8671978 0.8669780 0.8667575 0.8665363 0.8663145 [379] 0.8660919 0.8658687 0.8656448 0.8654202 0.8651949 0.8649690 0.8647424 [386] 0.8645152 0.8642873 0.8640587 0.8638294 0.8635995 0.8633690 0.8631378 [393] 0.8629059 0.8626734 0.8624403 0.8622065 0.8619720 0.8617369 0.8615012 [400] 0.8612649 0.8610279 > mx [1] 0.8961888 > mxli [1] -0.78 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1h8ya1226421465.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/2ovna1226421465.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/30ggx1226421465.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/4eb5v1226421465.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/5zhez1226421465.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/6zza81226421465.tab") > > system("convert tmp/1h8ya1226421465.ps tmp/1h8ya1226421465.png") > system("convert tmp/2ovna1226421465.ps tmp/2ovna1226421465.png") > system("convert tmp/30ggx1226421465.ps tmp/30ggx1226421465.png") > system("convert tmp/4eb5v1226421465.ps tmp/4eb5v1226421465.png") > system("convert tmp/5zhez1226421465.ps tmp/5zhez1226421465.png") > > > proc.time() user system elapsed 2.390 1.325 2.581