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(98.5,97.0,103.3,99.6,100.1,102.9,95.9,94.5,107.4,116.0,102.8,99.8,109.6,103.0,111.6,106.3,97.9,108.8,103.9,101.2,122.9,123.9,111.7,120.9,99.6,103.3,119.4,106.5,101.9,124.6,106.5,107.8,127.4,120.1,118.5,127.7,107.7,104.5,118.8,110.3,109.6,119.1,96.5,106.7,126.3,116.2,118.8,115.2,110.0,111.4,129.6,108.1,117.8,122.9,100.6,111.8,127.0,128.6,124.8,118.5,114.7,112.6,128.7,111.0,115.8,126.0,111.1,113.2,120.1,130.6,124.0,119.4,116.7,116.5,119.6,126.5,111.3,123.5,114.2,103.7,129.5) > #'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.5871764 0.5871280 0.5870795 0.5870309 0.5869822 0.5869334 0.5868845 [8] 0.5868354 0.5867863 0.5867370 0.5866876 0.5866381 0.5865885 0.5865388 [15] 0.5864889 0.5864390 0.5863889 0.5863387 0.5862885 0.5862381 0.5861876 [22] 0.5861370 0.5860862 0.5860354 0.5859844 0.5859334 0.5858822 0.5858309 [29] 0.5857795 0.5857280 0.5856764 0.5856247 0.5855729 0.5855209 0.5854689 [36] 0.5854167 0.5853644 0.5853120 0.5852595 0.5852069 0.5851542 0.5851014 [43] 0.5850485 0.5849954 0.5849423 0.5848890 0.5848356 0.5847821 0.5847285 [50] 0.5846748 0.5846210 0.5845671 0.5845131 0.5844589 0.5844047 0.5843503 [57] 0.5842959 0.5842413 0.5841866 0.5841318 0.5840769 0.5840219 0.5839668 [64] 0.5839115 0.5838562 0.5838008 0.5837452 0.5836895 0.5836338 0.5835779 [71] 0.5835219 0.5834658 0.5834096 0.5833533 0.5832969 0.5832404 0.5831838 [78] 0.5831270 0.5830702 0.5830132 0.5829562 0.5828990 0.5828417 0.5827844 [85] 0.5827269 0.5826693 0.5826116 0.5825538 0.5824959 0.5824378 0.5823797 [92] 0.5823215 0.5822632 0.5822047 0.5821462 0.5820875 0.5820287 0.5819699 [99] 0.5819109 0.5818518 0.5817927 0.5817334 0.5816740 0.5816145 0.5815549 [106] 0.5814952 0.5814354 0.5813754 0.5813154 0.5812553 0.5811951 0.5811347 [113] 0.5810743 0.5810137 0.5809531 0.5808923 0.5808315 0.5807705 0.5807095 [120] 0.5806483 0.5805870 0.5805256 0.5804642 0.5804026 0.5803409 0.5802791 [127] 0.5802172 0.5801552 0.5800931 0.5800309 0.5799686 0.5799062 0.5798437 [134] 0.5797811 0.5797184 0.5796556 0.5795926 0.5795296 0.5794665 0.5794033 [141] 0.5793399 0.5792765 0.5792130 0.5791493 0.5790856 0.5790218 0.5789578 [148] 0.5788938 0.5788297 0.5787654 0.5787011 0.5786366 0.5785721 0.5785075 [155] 0.5784427 0.5783779 0.5783129 0.5782479 0.5781827 0.5781175 0.5780522 [162] 0.5779867 0.5779212 0.5778555 0.5777898 0.5777239 0.5776580 0.5775920 [169] 0.5775258 0.5774596 0.5773932 0.5773268 0.5772603 0.5771936 0.5771269 [176] 0.5770601 0.5769931 0.5769261 0.5768590 0.5767918 0.5767244 0.5766570 [183] 0.5765895 0.5765219 0.5764542 0.5763864 0.5763184 0.5762504 0.5761823 [190] 0.5761141 0.5760458 0.5759774 0.5759090 0.5758404 0.5757717 0.5757029 [197] 0.5756340 0.5755651 0.5754960 0.5754268 0.5753576 0.5752882 0.5752188 [204] 0.5751492 0.5750796 0.5750098 0.5749400 0.5748701 0.5748001 0.5747299 [211] 0.5746597 0.5745894 0.5745190 0.5744485 0.5743779 0.5743072 0.5742365 [218] 0.5741656 0.5740946 0.5740236 0.5739524 0.5738812 0.5738098 0.5737384 [225] 0.5736668 0.5735952 0.5735235 0.5734517 0.5733798 0.5733078 0.5732357 [232] 0.5731635 0.5730913 0.5730189 0.5729465 0.5728739 0.5728013 0.5727285 [239] 0.5726557 0.5725828 0.5725098 0.5724367 0.5723635 0.5722902 0.5722169 [246] 0.5721434 0.5720698 0.5719962 0.5719225 0.5718486 0.5717747 0.5717007 [253] 0.5716266 0.5715524 0.5714782 0.5714038 0.5713293 0.5712548 0.5711802 [260] 0.5711054 0.5710306 0.5709557 0.5708807 0.5708057 0.5707305 0.5706552 [267] 0.5705799 0.5705045 0.5704289 0.5703533 0.5702776 0.5702018 0.5701260 [274] 0.5700500 0.5699740 0.5698978 0.5698216 0.5697453 0.5696689 0.5695924 [281] 0.5695158 0.5694392 0.5693624 0.5692856 0.5692087 0.5691317 0.5690546 [288] 0.5689774 0.5689002 0.5688228 0.5687454 0.5686679 0.5685903 0.5685126 [295] 0.5684348 0.5683570 0.5682790 0.5682010 0.5681229 0.5680447 0.5679664 [302] 0.5678880 0.5678096 0.5677310 0.5676524 0.5675737 0.5674949 0.5674161 [309] 0.5673371 0.5672581 0.5671790 0.5670998 0.5670205 0.5669411 0.5668617 [316] 0.5667821 0.5667025 0.5666228 0.5665430 0.5664632 0.5663832 0.5663032 [323] 0.5662231 0.5661429 0.5660626 0.5659823 0.5659019 0.5658214 0.5657408 [330] 0.5656601 0.5655793 0.5654985 0.5654176 0.5653366 0.5652555 0.5651744 [337] 0.5650931 0.5650118 0.5649304 0.5648489 0.5647674 0.5646858 0.5646040 [344] 0.5645223 0.5644404 0.5643584 0.5642764 0.5641943 0.5641121 0.5640299 [351] 0.5639475 0.5638651 0.5637826 0.5637000 0.5636174 0.5635347 0.5634518 [358] 0.5633690 0.5632860 0.5632030 0.5631199 0.5630367 0.5629534 0.5628701 [365] 0.5627866 0.5627031 0.5626196 0.5625359 0.5624522 0.5623684 0.5622845 [372] 0.5622006 0.5621166 0.5620325 0.5619483 0.5618641 0.5617797 0.5616953 [379] 0.5616109 0.5615263 0.5614417 0.5613570 0.5612722 0.5611874 0.5611025 [386] 0.5610175 0.5609324 0.5608473 0.5607621 0.5606768 0.5605915 0.5605060 [393] 0.5604205 0.5603350 0.5602493 0.5601636 0.5600778 0.5599920 0.5599060 [400] 0.5598200 0.5597340 > mx [1] 0.5871764 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1ao751229010801.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/2wamw1229010801.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/343rg1229010801.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/4ow6v1229010801.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/519j11229010801.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/6zk131229010801.tab") > > system("convert tmp/1ao751229010801.ps tmp/1ao751229010801.png") > system("convert tmp/2wamw1229010801.ps tmp/2wamw1229010801.png") > system("convert tmp/343rg1229010801.ps tmp/343rg1229010801.png") > system("convert tmp/4ow6v1229010801.ps tmp/4ow6v1229010801.png") > system("convert tmp/519j11229010801.ps tmp/519j11229010801.png") > > > proc.time() user system elapsed 1.078 0.771 1.252