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.5,98.7,115.9,110.4,109.5,92.3,102.1,112.8,110.2,98.9,119,104.3,98.8,109.4,170.3,118,116.9,111.7,116.8,116.1,114.8,110.8,122.8,104.7,86,127.2,126.1,114.6,127.8,105.2,113.1,161,126.9,117.7,144.9,119.4,107.1,142.8,126.2,126.9,179.2,105.3,114.8,125.4,113.2,134.4,150,100.9,101.8,137.7,138.7,135.4,153.8,119.5,123.3,166.4,137.5,142.2,167,112.3,120.6,154.9,153.4,156.2,175.8,131.7,130.1,161.1,128.2,140.3,174.9,111.8,136.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.5870028 0.5870257 0.5870478 0.5870690 0.5870893 0.5871087 0.5871273 [8] 0.5871449 0.5871617 0.5871776 0.5871926 0.5872068 0.5872200 0.5872324 [15] 0.5872439 0.5872545 0.5872642 0.5872731 0.5872810 0.5872881 0.5872943 [22] 0.5872997 0.5873041 0.5873077 0.5873104 0.5873122 0.5873131 0.5873131 [29] 0.5873123 0.5873106 0.5873080 0.5873045 0.5873002 0.5872949 0.5872888 [36] 0.5872819 0.5872740 0.5872652 0.5872556 0.5872451 0.5872338 0.5872215 [43] 0.5872084 0.5871944 0.5871795 0.5871638 0.5871471 0.5871296 0.5871113 [50] 0.5870920 0.5870719 0.5870509 0.5870290 0.5870063 0.5869827 0.5869582 [57] 0.5869328 0.5869066 0.5868795 0.5868515 0.5868227 0.5867930 0.5867624 [64] 0.5867310 0.5866987 0.5866655 0.5866315 0.5865966 0.5865608 0.5865242 [71] 0.5864867 0.5864483 0.5864091 0.5863690 0.5863280 0.5862862 0.5862436 [78] 0.5862000 0.5861556 0.5861104 0.5860643 0.5860173 0.5859695 0.5859208 [85] 0.5858712 0.5858208 0.5857696 0.5857175 0.5856645 0.5856107 0.5855561 [92] 0.5855006 0.5854442 0.5853870 0.5853289 0.5852700 0.5852103 0.5851497 [99] 0.5850882 0.5850259 0.5849628 0.5848988 0.5848340 0.5847683 0.5847018 [106] 0.5846344 0.5845663 0.5844972 0.5844274 0.5843567 0.5842851 0.5842128 [113] 0.5841395 0.5840655 0.5839906 0.5839149 0.5838384 0.5837610 0.5836828 [120] 0.5836038 0.5835239 0.5834433 0.5833618 0.5832794 0.5831963 0.5831123 [127] 0.5830275 0.5829419 0.5828555 0.5827682 0.5826801 0.5825912 0.5825015 [134] 0.5824110 0.5823197 0.5822276 0.5821346 0.5820408 0.5819463 0.5818509 [141] 0.5817547 0.5816577 0.5815599 0.5814613 0.5813619 0.5812617 0.5811607 [148] 0.5810589 0.5809562 0.5808528 0.5807486 0.5806436 0.5805379 0.5804313 [155] 0.5803239 0.5802157 0.5801068 0.5799971 0.5798865 0.5797752 0.5796631 [162] 0.5795503 0.5794366 0.5793222 0.5792069 0.5790909 0.5789742 0.5788566 [169] 0.5787383 0.5786192 0.5784993 0.5783787 0.5782573 0.5781351 0.5780122 [176] 0.5778885 0.5777640 0.5776388 0.5775128 0.5773860 0.5772585 0.5771303 [183] 0.5770012 0.5768715 0.5767409 0.5766096 0.5764776 0.5763448 0.5762113 [190] 0.5760770 0.5759420 0.5758062 0.5756697 0.5755325 0.5753945 0.5752558 [197] 0.5751163 0.5749761 0.5748352 0.5746936 0.5745512 0.5744081 0.5742642 [204] 0.5741196 0.5739744 0.5738283 0.5736816 0.5735341 0.5733860 0.5732371 [211] 0.5730875 0.5729371 0.5727861 0.5726344 0.5724819 0.5723287 0.5721749 [218] 0.5720203 0.5718650 0.5717090 0.5715524 0.5713950 0.5712369 0.5710781 [225] 0.5709187 0.5707585 0.5705977 0.5704361 0.5702739 0.5701110 0.5699474 [232] 0.5697831 0.5696182 0.5694526 0.5692862 0.5691192 0.5689516 0.5687833 [239] 0.5686142 0.5684446 0.5682742 0.5681032 0.5679315 0.5677592 0.5675862 [246] 0.5674125 0.5672382 0.5670633 0.5668876 0.5667114 0.5665344 0.5663568 [253] 0.5661786 0.5659997 0.5658202 0.5656401 0.5654593 0.5652778 0.5650958 [260] 0.5649130 0.5647297 0.5645457 0.5643611 0.5641759 0.5639900 0.5638035 [267] 0.5636164 0.5634287 0.5632403 0.5630514 0.5628618 0.5626716 0.5624808 [274] 0.5622893 0.5620973 0.5619047 0.5617114 0.5615176 0.5613231 0.5611281 [281] 0.5609324 0.5607362 0.5605393 0.5603419 0.5601439 0.5599452 0.5597460 [288] 0.5595462 0.5593459 0.5591449 0.5589434 0.5587413 0.5585386 0.5583353 [295] 0.5581315 0.5579271 0.5577221 0.5575165 0.5573104 0.5571038 0.5568965 [302] 0.5566887 0.5564804 0.5562715 0.5560620 0.5558520 0.5556414 0.5554303 [309] 0.5552186 0.5550064 0.5547937 0.5545804 0.5543666 0.5541522 0.5539373 [316] 0.5537219 0.5535059 0.5532894 0.5530724 0.5528548 0.5526367 0.5524181 [323] 0.5521990 0.5519794 0.5517592 0.5515385 0.5513174 0.5510957 0.5508735 [330] 0.5506507 0.5504275 0.5502038 0.5499796 0.5497549 0.5495297 0.5493039 [337] 0.5490777 0.5488510 0.5486239 0.5483962 0.5481680 0.5479394 0.5477102 [344] 0.5474806 0.5472506 0.5470200 0.5467890 0.5465574 0.5463255 0.5460930 [351] 0.5458601 0.5456267 0.5453929 0.5451586 0.5449238 0.5446886 0.5444529 [358] 0.5442168 0.5439802 0.5437432 0.5435057 0.5432678 0.5430294 0.5427906 [365] 0.5425514 0.5423117 0.5420715 0.5418310 0.5415900 0.5413486 0.5411067 [372] 0.5408645 0.5406218 0.5403787 0.5401351 0.5398912 0.5396468 0.5394020 [379] 0.5391568 0.5389112 0.5386652 0.5384188 0.5381719 0.5379247 0.5376771 [386] 0.5374290 0.5371806 0.5369318 0.5366826 0.5364330 0.5361830 0.5359326 [393] 0.5356818 0.5354307 0.5351791 0.5349272 0.5346749 0.5344222 0.5341692 [400] 0.5339158 0.5336620 > mx [1] 0.5873131 > mxli [1] -1.73 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1obql1226910900.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/2rbog1226910900.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/36jht1226910900.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/479qj1226910900.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/5x5341226910900.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/6ew4e1226910900.tab") > > system("convert tmp/1obql1226910900.ps tmp/1obql1226910900.png") > system("convert tmp/2rbog1226910900.ps tmp/2rbog1226910900.png") > system("convert tmp/36jht1226910900.ps tmp/36jht1226910900.png") > system("convert tmp/479qj1226910900.ps tmp/479qj1226910900.png") > system("convert tmp/5x5341226910900.ps tmp/5x5341226910900.png") > > > proc.time() user system elapsed 1.170 0.836 3.598