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(2174.56,2196.72,2350.44,2440.25,2408.64,2472.81,2407.6,2454.62,2448.05,2497.84,2645.64,2756.76,2849.27,2921.44,2981.85,3080.58,3106.22,3119.31,3061.26,3097.31,3161.69,3257.16,3277.01,3295.32,3363.99,3494.17,3667.03,3813.06,3917.96,3895.51,3801.06,3570.12,3701.61,3862.27,3970.1,4138.52,4199.75,4290.89,4443.91,4502.64,4356.98,4591.27,4696.96,4621.4,4562.84,4202.52,4296.49,4435.23,4105.18,4116.68,3844.49,3720.98,3674.4,3857.62,3801.06,3504.37,3032.6,3047.03,2962.34,2197.82) > #'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.5935407 0.5935872 0.5936331 0.5936781 0.5937223 0.5937658 0.5938085 [8] 0.5938505 0.5938916 0.5939320 0.5939716 0.5940104 0.5940484 0.5940857 [15] 0.5941221 0.5941578 0.5941927 0.5942268 0.5942601 0.5942926 0.5943243 [22] 0.5943553 0.5943854 0.5944148 0.5944433 0.5944711 0.5944980 0.5945242 [29] 0.5945495 0.5945741 0.5945978 0.5946208 0.5946429 0.5946643 0.5946848 [36] 0.5947046 0.5947235 0.5947416 0.5947589 0.5947754 0.5947911 0.5948060 [43] 0.5948201 0.5948334 0.5948458 0.5948574 0.5948683 0.5948783 0.5948874 [50] 0.5948958 0.5949034 0.5949101 0.5949160 0.5949211 0.5949254 0.5949288 [57] 0.5949315 0.5949333 0.5949343 0.5949344 0.5949338 0.5949323 0.5949300 [64] 0.5949268 0.5949229 0.5949181 0.5949125 0.5949060 0.5948987 0.5948906 [71] 0.5948817 0.5948719 0.5948613 0.5948499 0.5948376 0.5948246 0.5948106 [78] 0.5947959 0.5947803 0.5947639 0.5947466 0.5947285 0.5947096 0.5946898 [85] 0.5946692 0.5946478 0.5946255 0.5946024 0.5945785 0.5945537 0.5945281 [92] 0.5945016 0.5944743 0.5944462 0.5944172 0.5943874 0.5943568 0.5943253 [99] 0.5942930 0.5942598 0.5942258 0.5941910 0.5941553 0.5941188 0.5940814 [106] 0.5940432 0.5940042 0.5939643 0.5939236 0.5938820 0.5938396 0.5937964 [113] 0.5937523 0.5937074 0.5936616 0.5936150 0.5935676 0.5935193 0.5934702 [120] 0.5934203 0.5933695 0.5933178 0.5932654 0.5932121 0.5931579 0.5931029 [127] 0.5930471 0.5929904 0.5929329 0.5928746 0.5928154 0.5927554 0.5926945 [134] 0.5926329 0.5925703 0.5925070 0.5924428 0.5923777 0.5923119 0.5922452 [141] 0.5921776 0.5921093 0.5920401 0.5919700 0.5918992 0.5918275 0.5917549 [148] 0.5916816 0.5916074 0.5915323 0.5914565 0.5913798 0.5913023 0.5912239 [155] 0.5911448 0.5910648 0.5909839 0.5909023 0.5908198 0.5907365 0.5906524 [162] 0.5905674 0.5904816 0.5903950 0.5903076 0.5902194 0.5901303 0.5900404 [169] 0.5899497 0.5898582 0.5897659 0.5896727 0.5895788 0.5894840 0.5893884 [176] 0.5892920 0.5891947 0.5890967 0.5889978 0.5888982 0.5887977 0.5886964 [183] 0.5885944 0.5884915 0.5883878 0.5882833 0.5881779 0.5880718 0.5879649 [190] 0.5878572 0.5877487 0.5876394 0.5875293 0.5874184 0.5873066 0.5871941 [197] 0.5870808 0.5869668 0.5868519 0.5867362 0.5866197 0.5865025 0.5863845 [204] 0.5862656 0.5861460 0.5860256 0.5859044 0.5857825 0.5856597 0.5855362 [211] 0.5854119 0.5852868 0.5851610 0.5850344 0.5849070 0.5847788 0.5846499 [218] 0.5845201 0.5843897 0.5842584 0.5841264 0.5839936 0.5838601 0.5837258 [225] 0.5835907 0.5834549 0.5833183 0.5831810 0.5830429 0.5829040 0.5827645 [232] 0.5826241 0.5824830 0.5823412 0.5821986 0.5820552 0.5819112 0.5817664 [239] 0.5816208 0.5814745 0.5813275 0.5811797 0.5810312 0.5808820 0.5807320 [246] 0.5805813 0.5804299 0.5802777 0.5801248 0.5799712 0.5798169 0.5796619 [253] 0.5795061 0.5793496 0.5791925 0.5790345 0.5788759 0.5787166 0.5785566 [260] 0.5783958 0.5782344 0.5780722 0.5779094 0.5777458 0.5775816 0.5774167 [267] 0.5772510 0.5770847 0.5769177 0.5767500 0.5765816 0.5764125 0.5762427 [274] 0.5760723 0.5759011 0.5757293 0.5755568 0.5753837 0.5752099 0.5750354 [281] 0.5748602 0.5746843 0.5745078 0.5743307 0.5741528 0.5739744 0.5737952 [288] 0.5736154 0.5734350 0.5732538 0.5730721 0.5728897 0.5727066 0.5725229 [295] 0.5723386 0.5721536 0.5719680 0.5717817 0.5715949 0.5714073 0.5712192 [302] 0.5710304 0.5708410 0.5706510 0.5704603 0.5702690 0.5700772 0.5698846 [309] 0.5696915 0.5694978 0.5693035 0.5691085 0.5689129 0.5687168 0.5685200 [316] 0.5683227 0.5681247 0.5679261 0.5677270 0.5675272 0.5673269 0.5671260 [323] 0.5669245 0.5667224 0.5665197 0.5663165 0.5661127 0.5659083 0.5657033 [330] 0.5654978 0.5652917 0.5650850 0.5648778 0.5646700 0.5644616 0.5642527 [337] 0.5640432 0.5638332 0.5636226 0.5634115 0.5631999 0.5629876 0.5627749 [344] 0.5625616 0.5623478 0.5621334 0.5619185 0.5617031 0.5614871 0.5612706 [351] 0.5610536 0.5608361 0.5606181 0.5603995 0.5601804 0.5599608 0.5597407 [358] 0.5595201 0.5592990 0.5590774 0.5588552 0.5586326 0.5584095 0.5581859 [365] 0.5579618 0.5577372 0.5575121 0.5572865 0.5570604 0.5568339 0.5566069 [372] 0.5563794 0.5561514 0.5559230 0.5556941 0.5554647 0.5552348 0.5550045 [379] 0.5547737 0.5545425 0.5543108 0.5540787 0.5538461 0.5536130 0.5533796 [386] 0.5531456 0.5529112 0.5526764 0.5524412 0.5522055 0.5519694 0.5517328 [393] 0.5514958 0.5512584 0.5510206 0.5507823 0.5505436 0.5503045 0.5500650 [400] 0.5498251 0.5495847 > mx [1] 0.5949344 > mxli [1] -1.41 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1xwl01226512430.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/2n5ud1226512430.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/3ocm91226512430.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/4tqlz1226512430.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/5dh2o1226512430.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/6jtze1226512430.tab") > > system("convert tmp/1xwl01226512430.ps tmp/1xwl01226512430.png") > system("convert tmp/2n5ud1226512430.ps tmp/2n5ud1226512430.png") > system("convert tmp/3ocm91226512430.ps tmp/3ocm91226512430.png") > system("convert tmp/4tqlz1226512430.ps tmp/4tqlz1226512430.png") > system("convert tmp/5dh2o1226512430.ps tmp/5dh2o1226512430.png") > > > proc.time() user system elapsed 3.987 2.208 4.231