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(97.8,107.4,117.5,105.6,97.4,99.5,98,104.3,100.6,101.1,103.9,96.9,95.5,108.4,117,103.8,100.8,110.6,104,112.6,107.3,98.9,109.8,104.9,102.2,123.9,124.9,112.7,121.9,100.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5,115.7,113.6,129.7,112,116.8,127,112.1,114.2,121.1,131.6,125,120.4,117.7,117.5,120.6,127.5,112.3,124.5,115.2,105.4) > #'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.5558186 0.5557667 0.5557148 0.5556628 0.5556106 0.5555584 0.5555060 [8] 0.5554535 0.5554009 0.5553482 0.5552954 0.5552425 0.5551894 0.5551363 [15] 0.5550830 0.5550296 0.5549762 0.5549226 0.5548688 0.5548150 0.5547611 [22] 0.5547070 0.5546529 0.5545986 0.5545442 0.5544897 0.5544351 0.5543804 [29] 0.5543256 0.5542707 0.5542156 0.5541605 0.5541052 0.5540498 0.5539943 [36] 0.5539387 0.5538830 0.5538272 0.5537713 0.5537152 0.5536591 0.5536028 [43] 0.5535464 0.5534900 0.5534334 0.5533767 0.5533198 0.5532629 0.5532059 [50] 0.5531487 0.5530915 0.5530341 0.5529766 0.5529191 0.5528614 0.5528036 [57] 0.5527457 0.5526876 0.5526295 0.5525713 0.5525129 0.5524545 0.5523959 [64] 0.5523372 0.5522784 0.5522195 0.5521605 0.5521014 0.5520422 0.5519828 [71] 0.5519234 0.5518639 0.5518042 0.5517444 0.5516846 0.5516246 0.5515645 [78] 0.5515043 0.5514440 0.5513836 0.5513230 0.5512624 0.5512017 0.5511408 [85] 0.5510798 0.5510188 0.5509576 0.5508963 0.5508349 0.5507734 0.5507118 [92] 0.5506501 0.5505883 0.5505264 0.5504643 0.5504022 0.5503400 0.5502776 [99] 0.5502151 0.5501526 0.5500899 0.5500271 0.5499642 0.5499012 0.5498381 [106] 0.5497749 0.5497116 0.5496482 0.5495846 0.5495210 0.5494572 0.5493934 [113] 0.5493294 0.5492654 0.5492012 0.5491369 0.5490726 0.5490081 0.5489435 [120] 0.5488788 0.5488140 0.5487491 0.5486841 0.5486190 0.5485537 0.5484884 [127] 0.5484230 0.5483574 0.5482918 0.5482260 0.5481602 0.5480942 0.5480282 [134] 0.5479620 0.5478957 0.5478293 0.5477629 0.5476963 0.5476296 0.5475628 [141] 0.5474959 0.5474289 0.5473618 0.5472946 0.5472273 0.5471598 0.5470923 [148] 0.5470247 0.5469570 0.5468891 0.5468212 0.5467532 0.5466850 0.5466168 [155] 0.5465484 0.5464800 0.5464114 0.5463428 0.5462740 0.5462051 0.5461362 [162] 0.5460671 0.5459979 0.5459287 0.5458593 0.5457898 0.5457202 0.5456506 [169] 0.5455808 0.5455109 0.5454409 0.5453708 0.5453006 0.5452303 0.5451599 [176] 0.5450895 0.5450189 0.5449482 0.5448774 0.5448065 0.5447355 0.5446644 [183] 0.5445932 0.5445219 0.5444505 0.5443790 0.5443074 0.5442357 0.5441639 [190] 0.5440920 0.5440199 0.5439478 0.5438756 0.5438033 0.5437309 0.5436584 [197] 0.5435858 0.5435131 0.5434403 0.5433674 0.5432944 0.5432213 0.5431481 [204] 0.5430748 0.5430014 0.5429279 0.5428544 0.5427807 0.5427069 0.5426330 [211] 0.5425590 0.5424849 0.5424107 0.5423364 0.5422621 0.5421876 0.5421130 [218] 0.5420383 0.5419636 0.5418887 0.5418137 0.5417387 0.5416635 0.5415883 [225] 0.5415129 0.5414375 0.5413619 0.5412863 0.5412105 0.5411347 0.5410588 [232] 0.5409827 0.5409066 0.5408304 0.5407541 0.5406777 0.5406012 0.5405245 [239] 0.5404478 0.5403711 0.5402942 0.5402172 0.5401401 0.5400629 0.5399856 [246] 0.5399083 0.5398308 0.5397533 0.5396756 0.5395979 0.5395200 0.5394421 [253] 0.5393640 0.5392859 0.5392077 0.5391294 0.5390510 0.5389725 0.5388939 [260] 0.5388152 0.5387364 0.5386576 0.5385786 0.5384995 0.5384204 0.5383411 [267] 0.5382618 0.5381824 0.5381028 0.5380232 0.5379435 0.5378637 0.5377838 [274] 0.5377038 0.5376238 0.5375436 0.5374633 0.5373830 0.5373025 0.5372220 [281] 0.5371414 0.5370606 0.5369798 0.5368989 0.5368179 0.5367368 0.5366557 [288] 0.5365744 0.5364931 0.5364116 0.5363301 0.5362484 0.5361667 0.5360849 [295] 0.5360030 0.5359210 0.5358390 0.5357568 0.5356745 0.5355922 0.5355098 [302] 0.5354272 0.5353446 0.5352619 0.5351791 0.5350963 0.5350133 0.5349302 [309] 0.5348471 0.5347639 0.5346805 0.5345971 0.5345136 0.5344301 0.5343464 [316] 0.5342626 0.5341788 0.5340948 0.5340108 0.5339267 0.5338425 0.5337582 [323] 0.5336739 0.5335894 0.5335049 0.5334202 0.5333355 0.5332507 0.5331658 [330] 0.5330808 0.5329958 0.5329106 0.5328254 0.5327401 0.5326547 0.5325692 [337] 0.5324836 0.5323980 0.5323122 0.5322264 0.5321405 0.5320545 0.5319684 [344] 0.5318822 0.5317960 0.5317096 0.5316232 0.5315367 0.5314501 0.5313635 [351] 0.5312767 0.5311899 0.5311029 0.5310159 0.5309289 0.5308417 0.5307544 [358] 0.5306671 0.5305797 0.5304922 0.5304046 0.5303169 0.5302292 0.5301413 [365] 0.5300534 0.5299654 0.5298773 0.5297892 0.5297009 0.5296126 0.5295242 [372] 0.5294357 0.5293472 0.5292585 0.5291698 0.5290810 0.5289921 0.5289031 [379] 0.5288141 0.5287250 0.5286357 0.5285465 0.5284571 0.5283676 0.5282781 [386] 0.5281885 0.5280988 0.5280091 0.5279192 0.5278293 0.5277393 0.5276492 [393] 0.5275590 0.5274688 0.5273785 0.5272881 0.5271976 0.5271071 0.5270164 [400] 0.5269257 0.5268349 > mx [1] 0.5558186 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1ek451226573431.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/2r55b1226573431.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/3tvz41226573431.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/4aktn1226573431.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/5kf6f1226573431.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/6rmxj1226573431.tab") > > system("convert tmp/1ek451226573431.ps tmp/1ek451226573431.png") > system("convert tmp/2r55b1226573431.ps tmp/2r55b1226573431.png") > system("convert tmp/3tvz41226573431.ps tmp/3tvz41226573431.png") > system("convert tmp/4aktn1226573431.ps tmp/4aktn1226573431.png") > system("convert tmp/5kf6f1226573431.ps tmp/5kf6f1226573431.png") > > > proc.time() user system elapsed 1.347 0.797 1.589