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(95.9,95.3,100.4,97.3,82.3,97.0,93.5,90.9,107.8,110.9,98.1,106.5,93.4,95.7,109.0,97.6,92.7,107.5,91.7,95.7,111.4,106.0,104.8,108.7,97.3,97.1,106.1,98.6,98.5,105.5,86.2,98.3,111.3,105.0,105.7,103.5,96.9,98.1,111.7,94.7,104.2,109.7,91.3,102.6,114.2,115.8,113.5,107.1,104.5,101.9,116.0,102.0,108.1,112.9,104.5,109.1,113.4,123.9,117.7,108.3) > #'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.5426123 0.5427182 0.5428240 0.5429295 0.5430350 0.5431402 0.5432453 [8] 0.5433502 0.5434550 0.5435596 0.5436640 0.5437682 0.5438723 0.5439762 [15] 0.5440799 0.5441835 0.5442869 0.5443901 0.5444932 0.5445961 0.5446988 [22] 0.5448014 0.5449038 0.5450060 0.5451080 0.5452099 0.5453116 0.5454132 [29] 0.5455146 0.5456158 0.5457168 0.5458177 0.5459184 0.5460189 0.5461193 [36] 0.5462195 0.5463195 0.5464193 0.5465190 0.5466185 0.5467179 0.5468171 [43] 0.5469161 0.5470149 0.5471136 0.5472121 0.5473104 0.5474086 0.5475066 [50] 0.5476044 0.5477021 0.5477995 0.5478969 0.5479940 0.5480910 0.5481878 [57] 0.5482844 0.5483809 0.5484772 0.5485733 0.5486693 0.5487651 0.5488607 [64] 0.5489561 0.5490514 0.5491465 0.5492415 0.5493362 0.5494309 0.5495253 [71] 0.5496196 0.5497136 0.5498076 0.5499013 0.5499949 0.5500883 0.5501816 [78] 0.5502746 0.5503676 0.5504603 0.5505529 0.5506453 0.5507375 0.5508295 [85] 0.5509214 0.5510131 0.5511047 0.5511961 0.5512873 0.5513783 0.5514692 [92] 0.5515599 0.5516504 0.5517408 0.5518310 0.5519210 0.5520108 0.5521005 [99] 0.5521900 0.5522794 0.5523685 0.5524575 0.5525464 0.5526350 0.5527235 [106] 0.5528119 0.5529000 0.5529880 0.5530758 0.5531634 0.5532509 0.5533382 [113] 0.5534253 0.5535123 0.5535991 0.5536857 0.5537722 0.5538585 0.5539446 [120] 0.5540305 0.5541163 0.5542019 0.5542873 0.5543726 0.5544577 0.5545426 [127] 0.5546274 0.5547120 0.5547964 0.5548806 0.5549647 0.5550486 0.5551323 [134] 0.5552159 0.5552993 0.5553825 0.5554656 0.5555485 0.5556312 0.5557137 [141] 0.5557961 0.5558783 0.5559604 0.5560422 0.5561239 0.5562055 0.5562868 [148] 0.5563680 0.5564490 0.5565299 0.5566106 0.5566911 0.5567714 0.5568516 [155] 0.5569316 0.5570114 0.5570911 0.5571706 0.5572499 0.5573291 0.5574081 [162] 0.5574869 0.5575655 0.5576440 0.5577223 0.5578004 0.5578784 0.5579562 [169] 0.5580338 0.5581113 0.5581886 0.5582657 0.5583427 0.5584194 0.5584960 [176] 0.5585725 0.5586488 0.5587249 0.5588008 0.5588766 0.5589522 0.5590276 [183] 0.5591029 0.5591779 0.5592529 0.5593276 0.5594022 0.5594766 0.5595508 [190] 0.5596249 0.5596988 0.5597726 0.5598461 0.5599195 0.5599927 0.5600658 [197] 0.5601387 0.5602114 0.5602840 0.5603564 0.5604286 0.5605006 0.5605725 [204] 0.5606442 0.5607157 0.5607871 0.5608583 0.5609293 0.5610002 0.5610709 [211] 0.5611414 0.5612118 0.5612820 0.5613520 0.5614218 0.5614915 0.5615610 [218] 0.5616304 0.5616995 0.5617685 0.5618374 0.5619061 0.5619746 0.5620429 [225] 0.5621111 0.5621790 0.5622469 0.5623145 0.5623820 0.5624493 0.5625165 [232] 0.5625835 0.5626503 0.5627169 0.5627834 0.5628497 0.5629159 0.5629819 [239] 0.5630477 0.5631133 0.5631788 0.5632441 0.5633092 0.5633742 0.5634390 [246] 0.5635036 0.5635681 0.5636324 0.5636965 0.5637605 0.5638242 0.5638879 [253] 0.5639513 0.5640146 0.5640777 0.5641407 0.5642035 0.5642661 0.5643285 [260] 0.5643908 0.5644529 0.5645149 0.5645766 0.5646383 0.5646997 0.5647610 [267] 0.5648221 0.5648830 0.5649438 0.5650044 0.5650648 0.5651251 0.5651852 [274] 0.5652451 0.5653049 0.5653645 0.5654240 0.5654832 0.5655423 0.5656013 [281] 0.5656600 0.5657186 0.5657770 0.5658353 0.5658934 0.5659513 0.5660091 [288] 0.5660667 0.5661241 0.5661814 0.5662385 0.5662954 0.5663522 0.5664088 [295] 0.5664652 0.5665215 0.5665776 0.5666335 0.5666893 0.5667449 0.5668003 [302] 0.5668555 0.5669106 0.5669656 0.5670203 0.5670749 0.5671294 0.5671836 [309] 0.5672377 0.5672917 0.5673454 0.5673990 0.5674525 0.5675057 0.5675588 [316] 0.5676118 0.5676645 0.5677171 0.5677696 0.5678218 0.5678739 0.5679259 [323] 0.5679777 0.5680293 0.5680807 0.5681320 0.5681831 0.5682340 0.5682848 [330] 0.5683354 0.5683859 0.5684361 0.5684863 0.5685362 0.5685860 0.5686356 [337] 0.5686851 0.5687344 0.5687835 0.5688324 0.5688812 0.5689299 0.5689783 [344] 0.5690266 0.5690747 0.5691227 0.5691705 0.5692182 0.5692656 0.5693129 [351] 0.5693601 0.5694070 0.5694539 0.5695005 0.5695470 0.5695933 0.5696395 [358] 0.5696854 0.5697313 0.5697769 0.5698224 0.5698677 0.5699129 0.5699579 [365] 0.5700027 0.5700474 0.5700919 0.5701363 0.5701804 0.5702244 0.5702683 [372] 0.5703120 0.5703555 0.5703989 0.5704420 0.5704851 0.5705279 0.5705706 [379] 0.5706132 0.5706555 0.5706977 0.5707398 0.5707817 0.5708234 0.5708649 [386] 0.5709063 0.5709476 0.5709886 0.5710295 0.5710702 0.5711108 0.5711512 [393] 0.5711915 0.5712315 0.5712714 0.5713112 0.5713508 0.5713902 0.5714295 [400] 0.5714686 0.5715075 > mx [1] 0.5715075 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1u8ad1229086201.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/freestat/rcomp/tmp/25bq51229086201.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/freestat/rcomp/tmp/3ev5c1229086201.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/freestat/rcomp/tmp/4mih11229086201.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/freestat/rcomp/tmp/580tr1229086201.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/6h6301229086201.tab") > > system("convert tmp/1u8ad1229086201.ps tmp/1u8ad1229086201.png") > system("convert tmp/25bq51229086201.ps tmp/25bq51229086201.png") > system("convert tmp/3ev5c1229086201.ps tmp/3ev5c1229086201.png") > system("convert tmp/4mih11229086201.ps tmp/4mih11229086201.png") > system("convert tmp/580tr1229086201.ps tmp/580tr1229086201.png") > > > proc.time() user system elapsed 1.669 1.240 1.996