R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(395.3,395.1,403.5,403.3,405.7,406.7,407.2,412.4,415.9,414,411.8,409.9,412.4,415.9,416.3,417.2,421.8,421.4,415.1,412.4,411.8,408.8,404.5,402.5,409.4,410.7,413.4,415.2,417.7,417.8,417.9,418.4,418.2,416.6,418.9,421,423.5,432.3,432.3,428.6,426.7,427.3,428.5,437,442,444.9,441.4,440.3,447.1,455.3,478.6,486.5,487.8,485.9,483.8,488.4,494,493.6,487.3,482.1,484.2,496.8,501.1,499.8,495.5,498.1,503.8,516.2,526.1,527.1,525.1,528.9,540.1,549,556,568.9,589.1,590.3,603.3,638.8,643,656.7,656.1,654.1,659.9,662.1,669.2,673.1,678.3,677.4,678.5,672.4,665.3,667.9,672.1,662.5,682.3,692.1,702.7,721.4,733.2,747.7,737.6,729.3,706.1,674.3,659,645.7) > #'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.9240564 0.9240087 0.9239607 0.9239123 0.9238636 0.9238147 0.9237654 [8] 0.9237157 0.9236658 0.9236155 0.9235649 0.9235140 0.9234628 0.9234113 [15] 0.9233594 0.9233072 0.9232547 0.9232019 0.9231487 0.9230952 0.9230414 [22] 0.9229873 0.9229329 0.9228781 0.9228230 0.9227676 0.9227118 0.9226558 [29] 0.9225994 0.9225427 0.9224856 0.9224282 0.9223705 0.9223125 0.9222542 [36] 0.9221955 0.9221365 0.9220772 0.9220175 0.9219575 0.9218972 0.9218366 [43] 0.9217756 0.9217143 0.9216527 0.9215907 0.9215284 0.9214658 0.9214028 [50] 0.9213396 0.9212760 0.9212120 0.9211478 0.9210832 0.9210182 0.9209530 [57] 0.9208874 0.9208214 0.9207552 0.9206886 0.9206217 0.9205544 0.9204869 [64] 0.9204189 0.9203507 0.9202821 0.9202132 0.9201440 0.9200744 0.9200045 [71] 0.9199342 0.9198636 0.9197927 0.9197215 0.9196499 0.9195780 0.9195058 [78] 0.9194332 0.9193603 0.9192870 0.9192134 0.9191395 0.9190653 0.9189907 [85] 0.9189157 0.9188405 0.9187649 0.9186890 0.9186127 0.9185361 0.9184592 [92] 0.9183819 0.9183043 0.9182264 0.9181481 0.9180695 0.9179905 0.9179113 [99] 0.9178317 0.9177517 0.9176714 0.9175908 0.9175098 0.9174285 0.9173469 [106] 0.9172650 0.9171827 0.9171000 0.9170170 0.9169337 0.9168501 0.9167661 [113] 0.9166818 0.9165972 0.9165122 0.9164269 0.9163412 0.9162552 0.9161689 [120] 0.9160822 0.9159952 0.9159079 0.9158202 0.9157322 0.9156439 0.9155552 [127] 0.9154662 0.9153769 0.9152872 0.9151972 0.9151068 0.9150161 0.9149251 [134] 0.9148338 0.9147421 0.9146501 0.9145577 0.9144650 0.9143720 0.9142786 [141] 0.9141849 0.9140909 0.9139966 0.9139019 0.9138069 0.9137115 0.9136158 [148] 0.9135198 0.9134234 0.9133267 0.9132297 0.9131324 0.9130347 0.9129367 [155] 0.9128383 0.9127396 0.9126406 0.9125413 0.9124416 0.9123416 0.9122413 [162] 0.9121406 0.9120396 0.9119383 0.9118366 0.9117346 0.9116323 0.9115297 [169] 0.9114267 0.9113234 0.9112197 0.9111158 0.9110115 0.9109069 0.9108019 [176] 0.9106966 0.9105910 0.9104851 0.9103788 0.9102723 0.9101654 0.9100581 [183] 0.9099506 0.9098427 0.9097345 0.9096259 0.9095170 0.9094079 0.9092983 [190] 0.9091885 0.9090783 0.9089679 0.9088571 0.9087459 0.9086345 0.9085227 [197] 0.9084106 0.9082982 0.9081854 0.9080724 0.9079590 0.9078453 0.9077313 [204] 0.9076169 0.9075022 0.9073873 0.9072720 0.9071563 0.9070404 0.9069241 [211] 0.9068076 0.9066907 0.9065735 0.9064559 0.9063381 0.9062199 0.9061015 [218] 0.9059827 0.9058636 0.9057442 0.9056244 0.9055044 0.9053840 0.9052633 [225] 0.9051424 0.9050211 0.9048995 0.9047775 0.9046553 0.9045328 0.9044099 [232] 0.9042868 0.9041633 0.9040395 0.9039154 0.9037910 0.9036663 0.9035413 [239] 0.9034160 0.9032904 0.9031644 0.9030382 0.9029117 0.9027848 0.9026577 [246] 0.9025302 0.9024024 0.9022744 0.9021460 0.9020174 0.9018884 0.9017591 [253] 0.9016296 0.9014997 0.9013695 0.9012391 0.9011083 0.9009772 0.9008459 [260] 0.9007142 0.9005823 0.9004500 0.9003175 0.9001846 0.9000515 0.8999180 [267] 0.8997843 0.8996503 0.8995160 0.8993814 0.8992465 0.8991113 0.8989758 [274] 0.8988400 0.8987040 0.8985676 0.8984310 0.8982941 0.8981568 0.8980193 [281] 0.8978816 0.8977435 0.8976051 0.8974665 0.8973275 0.8971883 0.8970488 [288] 0.8969090 0.8967690 0.8966286 0.8964880 0.8963471 0.8962059 0.8960645 [295] 0.8959227 0.8957807 0.8956384 0.8954958 0.8953529 0.8952098 0.8950664 [302] 0.8949227 0.8947788 0.8946345 0.8944900 0.8943452 0.8942002 0.8940549 [309] 0.8939093 0.8937634 0.8936173 0.8934709 0.8933242 0.8931772 0.8930300 [316] 0.8928826 0.8927348 0.8925868 0.8924385 0.8922900 0.8921412 0.8919921 [323] 0.8918428 0.8916932 0.8915434 0.8913933 0.8912429 0.8910922 0.8909414 [330] 0.8907902 0.8906388 0.8904871 0.8903352 0.8901830 0.8900306 0.8898779 [337] 0.8897250 0.8895718 0.8894183 0.8892646 0.8891107 0.8889565 0.8888020 [344] 0.8886473 0.8884924 0.8883372 0.8881817 0.8880260 0.8878701 0.8877139 [351] 0.8875574 0.8874008 0.8872438 0.8870867 0.8869293 0.8867716 0.8866137 [358] 0.8864556 0.8862972 0.8861386 0.8859798 0.8858207 0.8856614 0.8855018 [365] 0.8853420 0.8851820 0.8850217 0.8848612 0.8847005 0.8845395 0.8843783 [372] 0.8842169 0.8840552 0.8838933 0.8837312 0.8835688 0.8834062 0.8832434 [379] 0.8830804 0.8829171 0.8827537 0.8825899 0.8824260 0.8822618 0.8820975 [386] 0.8819329 0.8817680 0.8816030 0.8814377 0.8812722 0.8811065 0.8809406 [393] 0.8807745 0.8806081 0.8804416 0.8802748 0.8801078 0.8799406 0.8797731 [400] 0.8796055 0.8794376 > mx [1] 0.9240564 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1spga1257851347.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/2urfg1257851347.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/31ygj1257851347.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/4ckbj1257851347.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/56v831257851347.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/62qoa1257851347.tab") > > system("convert tmp/1spga1257851347.ps tmp/1spga1257851347.png") > system("convert tmp/2urfg1257851347.ps tmp/2urfg1257851347.png") > system("convert tmp/31ygj1257851347.ps tmp/31ygj1257851347.png") > system("convert tmp/4ckbj1257851347.ps tmp/4ckbj1257851347.png") > system("convert tmp/56v831257851347.ps tmp/56v831257851347.png") > > > proc.time() user system elapsed 1.085 0.781 1.873