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(2333.3,2282.2,2458.2,2345.5,2065.2,2332.5,2077.5,1691.4,2381.9,2526,2212.1,2459.9,2178.8,2318.2,2661.8,2407.9,2040.6,2601.6,2106.3,1829.9,2546.1,2363,2435.8,2668,2316.9,2324.2,2610.8,2413.2,2345.2,2590.8,2132.1,1990.7,2641.7,2437.1,2649.2,2819.4,2405.6,2451.3,2878.5,2534.1,2670.6,2909.7,2261.8,2135.3,2870.4,2803.2,2775.1,2633.7,2930.6,2779.7,3039.2,2752.7,2743.1,2914,2711.9,2295.8,2840.6,3230.5,2761.1,2769.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.5345848 0.5349198 0.5352543 0.5355884 0.5359221 0.5362554 0.5365883 [8] 0.5369207 0.5372527 0.5375843 0.5379154 0.5382461 0.5385764 0.5389063 [15] 0.5392357 0.5395647 0.5398933 0.5402214 0.5405491 0.5408764 0.5412032 [22] 0.5415296 0.5418555 0.5421810 0.5425061 0.5428307 0.5431549 0.5434786 [29] 0.5438019 0.5441247 0.5444471 0.5447690 0.5450905 0.5454115 0.5457320 [36] 0.5460521 0.5463718 0.5466910 0.5470097 0.5473280 0.5476458 0.5479632 [43] 0.5482801 0.5485965 0.5489125 0.5492279 0.5495430 0.5498575 0.5501716 [50] 0.5504853 0.5507984 0.5511111 0.5514233 0.5517350 0.5520463 0.5523571 [57] 0.5526674 0.5529772 0.5532865 0.5535954 0.5539038 0.5542117 0.5545191 [64] 0.5548261 0.5551325 0.5554385 0.5557440 0.5560490 0.5563535 0.5566575 [71] 0.5569610 0.5572641 0.5575666 0.5578687 0.5581702 0.5584713 0.5587719 [78] 0.5590720 0.5593715 0.5596706 0.5599692 0.5602673 0.5605649 0.5608619 [85] 0.5611585 0.5614546 0.5617502 0.5620452 0.5623398 0.5626339 0.5629274 [92] 0.5632205 0.5635130 0.5638050 0.5640965 0.5643875 0.5646780 0.5649680 [99] 0.5652575 0.5655464 0.5658349 0.5661228 0.5664102 0.5666971 0.5669835 [106] 0.5672693 0.5675547 0.5678395 0.5681238 0.5684075 0.5686908 0.5689735 [113] 0.5692557 0.5695374 0.5698186 0.5700992 0.5703793 0.5706589 0.5709380 [120] 0.5712165 0.5714945 0.5717720 0.5720489 0.5723253 0.5726012 0.5728765 [127] 0.5731514 0.5734256 0.5736994 0.5739726 0.5742453 0.5745174 0.5747890 [134] 0.5750601 0.5753307 0.5756007 0.5758701 0.5761390 0.5764074 0.5766753 [141] 0.5769426 0.5772093 0.5774756 0.5777412 0.5780064 0.5782710 0.5785350 [148] 0.5787985 0.5790615 0.5793239 0.5795858 0.5798471 0.5801079 0.5803681 [155] 0.5806278 0.5808869 0.5811455 0.5814036 0.5816611 0.5819180 0.5821744 [162] 0.5824302 0.5826855 0.5829403 0.5831944 0.5834481 0.5837012 0.5839537 [169] 0.5842057 0.5844571 0.5847079 0.5849583 0.5852080 0.5854572 0.5857058 [176] 0.5859539 0.5862015 0.5864484 0.5866948 0.5869407 0.5871860 0.5874307 [183] 0.5876749 0.5879185 0.5881616 0.5884041 0.5886460 0.5888874 0.5891282 [190] 0.5893685 0.5896082 0.5898473 0.5900859 0.5903239 0.5905613 0.5907982 [197] 0.5910345 0.5912702 0.5915054 0.5917400 0.5919741 0.5922076 0.5924405 [204] 0.5926729 0.5929047 0.5931359 0.5933665 0.5935966 0.5938262 0.5940551 [211] 0.5942835 0.5945113 0.5947386 0.5949653 0.5951914 0.5954169 0.5956419 [218] 0.5958663 0.5960902 0.5963134 0.5965361 0.5967583 0.5969798 0.5972008 [225] 0.5974212 0.5976411 0.5978603 0.5980790 0.5982972 0.5985147 0.5987317 [232] 0.5989481 0.5991640 0.5993793 0.5995940 0.5998081 0.6000216 0.6002346 [239] 0.6004470 0.6006589 0.6008701 0.6010808 0.6012909 0.6015005 0.6017094 [246] 0.6019178 0.6021256 0.6023329 0.6025395 0.6027456 0.6029511 0.6031561 [253] 0.6033604 0.6035642 0.6037675 0.6039701 0.6041722 0.6043737 0.6045746 [260] 0.6047749 0.6049747 0.6051739 0.6053725 0.6055705 0.6057680 0.6059649 [267] 0.6061612 0.6063569 0.6065520 0.6067466 0.6069406 0.6071341 0.6073269 [274] 0.6075192 0.6077109 0.6079020 0.6080925 0.6082825 0.6084719 0.6086607 [281] 0.6088489 0.6090366 0.6092237 0.6094102 0.6095961 0.6097815 0.6099663 [288] 0.6101505 0.6103341 0.6105171 0.6106996 0.6108815 0.6110628 0.6112435 [295] 0.6114237 0.6116033 0.6117823 0.6119607 0.6121386 0.6123159 0.6124926 [302] 0.6126687 0.6128442 0.6130192 0.6131936 0.6133674 0.6135407 0.6137133 [309] 0.6138854 0.6140569 0.6142279 0.6143982 0.6145680 0.6147372 0.6149059 [316] 0.6150739 0.6152414 0.6154083 0.6155746 0.6157404 0.6159056 0.6160702 [323] 0.6162342 0.6163977 0.6165605 0.6167229 0.6168846 0.6170457 0.6172063 [330] 0.6173663 0.6175258 0.6176846 0.6178429 0.6180006 0.6181577 0.6183143 [337] 0.6184703 0.6186257 0.6187805 0.6189348 0.6190885 0.6192416 0.6193941 [344] 0.6195461 0.6196975 0.6198483 0.6199986 0.6201483 0.6202974 0.6204459 [351] 0.6205939 0.6207413 0.6208881 0.6210343 0.6211800 0.6213251 0.6214696 [358] 0.6216136 0.6217570 0.6218998 0.6220421 0.6221837 0.6223248 0.6224654 [365] 0.6226053 0.6227447 0.6228836 0.6230218 0.6231595 0.6232966 0.6234332 [372] 0.6235692 0.6237046 0.6238394 0.6239737 0.6241074 0.6242406 0.6243731 [379] 0.6245051 0.6246366 0.6247675 0.6248978 0.6250275 0.6251567 0.6252853 [386] 0.6254133 0.6255408 0.6256677 0.6257940 0.6259198 0.6260450 0.6261697 [393] 0.6262938 0.6264173 0.6265402 0.6266626 0.6267844 0.6269057 0.6270264 [400] 0.6271465 0.6272661 > mx [1] 0.6272661 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1dk6q1226423135.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/2tvkv1226423135.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/3rpxa1226423135.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/4n3jg1226423135.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/5mdmd1226423135.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/6gkwv1226423135.tab") > > system("convert tmp/1dk6q1226423135.ps tmp/1dk6q1226423135.png") > system("convert tmp/2tvkv1226423135.ps tmp/2tvkv1226423135.png") > system("convert tmp/3rpxa1226423135.ps tmp/3rpxa1226423135.png") > system("convert tmp/4n3jg1226423135.ps tmp/4n3jg1226423135.png") > system("convert tmp/5mdmd1226423135.ps tmp/5mdmd1226423135.png") > > > proc.time() user system elapsed 1.309 0.763 1.558