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(22780,17351,21382,24561,17409,11514,31514,27071,29462,26105,22397,23843,21705,18089,20764,25316,17704,15548,28029,29383,36438,32034,22679,24319,18004,17537,20366,22782,19169,13807,29743,25591,29096,26482,22405,27044,17970,18730,19684,19785,18479,10698,31956,29506,34506,27165,26736,23691,18157,17328,18205,20995,17382,9367,31124,26551,30651,25859,25100,25778,20418,18688,20424,24776,19814,12738,31566,30111,30019,31934,25826,26835) > #'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.04626220 0.04662021 0.04697856 0.04733723 0.04769624 0.04805557 [7] 0.04841520 0.04877515 0.04913538 0.04949591 0.04985672 0.05021780 [13] 0.05057915 0.05094076 0.05130262 0.05166473 0.05202707 0.05238964 [19] 0.05275243 0.05311543 0.05347864 0.05384204 0.05420563 0.05456941 [25] 0.05493335 0.05529747 0.05566174 0.05602615 0.05639071 0.05675540 [31] 0.05712022 0.05748515 0.05785019 0.05821533 0.05858056 0.05894587 [37] 0.05931126 0.05967671 0.06004222 0.06040778 0.06077338 0.06113902 [43] 0.06150467 0.06187035 0.06223603 0.06260170 0.06296737 0.06333302 [49] 0.06369864 0.06406423 0.06442977 0.06479526 0.06516068 0.06552603 [55] 0.06589131 0.06625650 0.06662159 0.06698657 0.06735144 0.06771619 [61] 0.06808081 0.06844528 0.06880961 0.06917378 0.06953778 0.06990161 [67] 0.07026525 0.07062870 0.07099195 0.07135499 0.07171781 0.07208040 [73] 0.07244275 0.07280486 0.07316672 0.07352831 0.07388964 0.07425068 [79] 0.07461143 0.07497189 0.07533204 0.07569188 0.07605139 0.07641057 [85] 0.07676941 0.07712790 0.07748604 0.07784380 0.07820120 0.07855821 [91] 0.07891482 0.07927104 0.07962685 0.07998224 0.08033721 0.08069174 [97] 0.08104584 0.08139948 0.08175266 0.08210537 0.08245761 0.08280937 [103] 0.08316063 0.08351140 0.08386166 0.08421140 0.08456061 0.08490930 [109] 0.08525744 0.08560504 0.08595208 0.08629856 0.08664446 0.08698979 [115] 0.08733453 0.08767867 0.08802221 0.08836514 0.08870746 0.08904914 [121] 0.08939020 0.08973061 0.09007038 0.09040949 0.09074794 0.09108572 [127] 0.09142282 0.09175923 0.09209496 0.09242999 0.09276431 0.09309792 [133] 0.09343081 0.09376297 0.09409440 0.09442509 0.09475503 0.09508421 [139] 0.09541264 0.09574030 0.09606719 0.09639330 0.09671862 0.09704314 [145] 0.09736687 0.09768980 0.09801191 0.09833320 0.09865367 0.09897331 [151] 0.09929211 0.09961008 0.09992719 0.10024345 0.10055885 0.10087339 [157] 0.10118705 0.10149984 0.10181175 0.10212277 0.10243289 0.10274212 [163] 0.10305045 0.10335786 0.10366437 0.10396995 0.10427461 0.10457834 [169] 0.10488114 0.10518300 0.10548391 0.10578388 0.10608289 0.10638095 [175] 0.10667804 0.10697417 0.10726932 0.10756350 0.10785670 0.10814892 [181] 0.10844015 0.10873038 0.10901962 0.10930786 0.10959510 0.10988132 [187] 0.11016654 0.11045074 0.11073392 0.11101607 0.11129720 0.11157730 [193] 0.11185637 0.11213439 0.11241138 0.11268733 0.11296222 0.11323607 [199] 0.11350886 0.11378060 0.11405128 0.11432090 0.11458945 0.11485694 [205] 0.11512335 0.11538869 0.11565296 0.11591614 0.11617825 0.11643927 [211] 0.11669921 0.11695806 0.11721582 0.11747249 0.11772806 0.11798254 [217] 0.11823592 0.11848819 0.11873937 0.11898944 0.11923840 0.11948626 [223] 0.11973301 0.11997864 0.12022317 0.12046658 0.12070887 0.12095004 [229] 0.12119010 0.12142904 0.12166685 0.12190355 0.12213912 0.12237356 [235] 0.12260688 0.12283907 0.12307014 0.12330007 0.12352888 0.12375656 [241] 0.12398310 0.12420851 0.12443279 0.12465594 0.12487795 0.12509883 [247] 0.12531857 0.12553718 0.12575466 0.12597099 0.12618619 0.12640026 [253] 0.12661318 0.12682497 0.12703563 0.12724514 0.12745352 0.12766076 [259] 0.12786687 0.12807184 0.12827567 0.12847836 0.12867992 0.12888034 [265] 0.12907962 0.12927777 0.12947478 0.12967066 0.12986540 0.13005901 [271] 0.13025149 0.13044283 0.13063304 0.13082211 0.13101006 0.13119688 [277] 0.13138256 0.13156712 0.13175055 0.13193285 0.13211402 0.13229407 [283] 0.13247299 0.13265079 0.13282747 0.13300302 0.13317746 0.13335077 [289] 0.13352296 0.13369404 0.13386400 0.13403285 0.13420058 0.13436719 [295] 0.13453270 0.13469710 0.13486038 0.13502256 0.13518363 0.13534360 [301] 0.13550247 0.13566023 0.13581689 0.13597245 0.13612692 0.13628028 [307] 0.13643256 0.13658374 0.13673383 0.13688283 0.13703074 0.13717756 [313] 0.13732330 0.13746796 0.13761154 0.13775403 0.13789545 0.13803579 [319] 0.13817506 0.13831326 0.13845038 0.13858644 0.13872143 0.13885535 [325] 0.13898821 0.13912001 0.13925076 0.13938044 0.13950907 0.13963664 [331] 0.13976317 0.13988864 0.14001307 0.14013645 0.14025879 0.14038008 [337] 0.14050034 0.14061956 0.14073775 0.14085490 0.14097102 0.14108612 [343] 0.14120019 0.14131323 0.14142525 0.14153625 0.14164624 0.14175521 [349] 0.14186316 0.14197011 0.14207604 0.14218097 0.14228490 0.14238782 [355] 0.14248974 0.14259067 0.14269060 0.14278953 0.14288748 0.14298444 [361] 0.14308041 0.14317540 0.14326940 0.14336243 0.14345448 0.14354556 [367] 0.14363566 0.14372480 0.14381297 0.14390017 0.14398641 0.14407169 [373] 0.14415601 0.14423938 0.14432179 0.14440325 0.14448377 0.14456334 [379] 0.14464196 0.14471965 0.14479639 0.14487220 0.14494707 0.14502102 [385] 0.14509403 0.14516612 0.14523728 0.14530753 0.14537685 0.14544525 [391] 0.14551274 0.14557932 0.14564499 0.14570976 0.14577361 0.14583657 [397] 0.14589862 0.14595978 0.14602004 0.14607941 0.14613789 > mx [1] 0.1461379 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/15w8d1227462859.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/26fdc1227462859.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/3wnbf1227462859.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/4mr9a1227462859.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/5vlja1227462859.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/64nz31227462860.tab") > > system("convert tmp/15w8d1227462859.ps tmp/15w8d1227462859.png") > system("convert tmp/26fdc1227462859.ps tmp/26fdc1227462859.png") > system("convert tmp/3wnbf1227462859.ps tmp/3wnbf1227462859.png") > system("convert tmp/4mr9a1227462859.ps tmp/4mr9a1227462859.png") > system("convert tmp/5vlja1227462859.ps tmp/5vlja1227462859.png") > > > proc.time() user system elapsed 1.072 0.779 1.355