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(74.8,93.1,103.9,83.9,77.7,141.5,58.9,75.3,108.4,91,84.6,179.8,85.6,76.4,109.7,99.1,86.7,111.4,78.4,76.7,114.2,99.7,94.2,173.5,83.1,88.9,132,122.1,105.1,133.7,63.6,112.7,120.5,112,126.2,209.2,91,116.7,137.6,108.1,136.6,152.3,114.3,120.7,131.8,129.4,187.5,189.5,109.2,158.1,176.2,125.5,155,170.3,99.4,139.2,169.6,136.1,168.2,318.6,154.1,161.4,183.4,167.2,205.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.6311519 0.6316873 0.6322208 0.6327523 0.6332819 0.6338095 0.6343351 [8] 0.6348587 0.6353803 0.6358999 0.6364175 0.6369330 0.6374465 0.6379579 [15] 0.6384672 0.6389744 0.6394795 0.6399825 0.6404834 0.6409821 0.6414786 [22] 0.6419730 0.6424652 0.6429552 0.6434430 0.6439286 0.6444119 0.6448930 [29] 0.6453719 0.6458485 0.6463228 0.6467947 0.6472644 0.6477318 0.6481968 [36] 0.6486595 0.6491198 0.6495778 0.6500334 0.6504865 0.6509373 0.6513856 [43] 0.6518315 0.6522750 0.6527160 0.6531545 0.6535905 0.6540241 0.6544551 [50] 0.6548836 0.6553096 0.6557330 0.6561538 0.6565721 0.6569878 0.6574009 [57] 0.6578113 0.6582192 0.6586244 0.6590269 0.6594268 0.6598240 0.6602185 [64] 0.6606103 0.6609994 0.6613858 0.6617694 0.6621502 0.6625283 0.6629036 [71] 0.6632761 0.6636458 0.6640127 0.6643768 0.6647380 0.6650963 0.6654518 [78] 0.6658043 0.6661540 0.6665007 0.6668446 0.6671855 0.6675234 0.6678584 [85] 0.6681903 0.6685193 0.6688453 0.6691683 0.6694882 0.6698051 0.6701189 [92] 0.6704297 0.6707373 0.6710419 0.6713433 0.6716417 0.6719368 0.6722289 [99] 0.6725177 0.6728034 0.6730858 0.6733651 0.6736412 0.6739140 0.6741835 [106] 0.6744498 0.6747128 0.6749725 0.6752289 0.6754820 0.6757318 0.6759782 [113] 0.6762213 0.6764609 0.6766972 0.6769301 0.6771596 0.6773856 0.6776082 [120] 0.6778274 0.6780430 0.6782552 0.6784639 0.6786690 0.6788707 0.6790687 [127] 0.6792633 0.6794542 0.6796416 0.6798253 0.6800055 0.6801820 0.6803549 [134] 0.6805241 0.6806897 0.6808515 0.6810097 0.6811641 0.6813148 0.6814618 [141] 0.6816050 0.6817444 0.6818801 0.6820119 0.6821399 0.6822641 0.6823844 [148] 0.6825009 0.6826135 0.6827222 0.6828270 0.6829279 0.6830248 0.6831178 [155] 0.6832068 0.6832919 0.6833729 0.6834500 0.6835230 0.6835919 0.6836568 [162] 0.6837177 0.6837744 0.6838271 0.6838756 0.6839200 0.6839603 0.6839964 [169] 0.6840283 0.6840560 0.6840796 0.6840989 0.6841139 0.6841247 0.6841313 [176] 0.6841336 0.6841315 0.6841252 0.6841145 0.6840995 0.6840801 0.6840564 [183] 0.6840282 0.6839957 0.6839588 0.6839174 0.6838715 0.6838212 0.6837665 [190] 0.6837072 0.6836434 0.6835751 0.6835023 0.6834249 0.6833429 0.6832564 [197] 0.6831653 0.6830695 0.6829691 0.6828641 0.6827544 0.6826401 0.6825211 [204] 0.6823973 0.6822689 0.6821357 0.6819978 0.6818551 0.6817076 0.6815554 [211] 0.6813983 0.6812365 0.6810698 0.6808982 0.6807218 0.6805405 0.6803544 [218] 0.6801633 0.6799674 0.6797665 0.6795606 0.6793498 0.6791341 0.6789133 [225] 0.6786876 0.6784568 0.6782211 0.6779803 0.6777344 0.6774835 0.6772275 [232] 0.6769665 0.6767003 0.6764291 0.6761527 0.6758712 0.6755845 0.6752927 [239] 0.6749957 0.6746935 0.6743862 0.6740736 0.6737558 0.6734328 0.6731046 [246] 0.6727711 0.6724324 0.6720884 0.6717391 0.6713846 0.6710247 0.6706596 [253] 0.6702891 0.6699133 0.6695322 0.6691458 0.6687540 0.6683568 0.6679543 [260] 0.6675464 0.6671331 0.6667145 0.6662904 0.6658610 0.6654261 0.6649859 [267] 0.6645402 0.6640890 0.6636325 0.6631705 0.6627031 0.6622302 0.6617519 [274] 0.6612681 0.6607789 0.6602842 0.6597841 0.6592784 0.6587674 0.6582508 [281] 0.6577287 0.6572012 0.6566682 0.6561297 0.6555858 0.6550363 0.6544814 [288] 0.6539210 0.6533551 0.6527838 0.6522069 0.6516246 0.6510368 0.6504435 [295] 0.6498448 0.6492406 0.6486309 0.6480158 0.6473952 0.6467691 0.6461377 [302] 0.6455007 0.6448584 0.6442106 0.6435574 0.6428987 0.6422347 0.6415652 [309] 0.6408904 0.6402102 0.6395246 0.6388336 0.6381373 0.6374356 0.6367286 [316] 0.6360163 0.6352986 0.6345757 0.6338475 0.6331139 0.6323752 0.6316311 [323] 0.6308819 0.6301274 0.6293677 0.6286029 0.6278328 0.6270576 0.6262773 [330] 0.6254918 0.6247012 0.6239056 0.6231048 0.6222990 0.6214882 0.6206724 [337] 0.6198516 0.6190258 0.6181951 0.6173595 0.6165189 0.6156735 0.6148232 [344] 0.6139681 0.6131082 0.6122435 0.6113740 0.6104998 0.6096209 0.6087373 [351] 0.6078491 0.6069562 0.6060587 0.6051567 0.6042501 0.6033390 0.6024235 [358] 0.6015035 0.6005790 0.5996502 0.5987170 0.5977795 0.5968377 0.5958916 [365] 0.5949413 0.5939868 0.5930282 0.5920654 0.5910985 0.5901276 0.5891526 [372] 0.5881737 0.5871908 0.5862040 0.5852133 0.5842188 0.5832205 0.5822184 [379] 0.5812126 0.5802031 0.5791900 0.5781733 0.5771530 0.5761291 0.5751018 [386] 0.5740711 0.5730369 0.5719994 0.5709586 0.5699144 0.5688671 0.5678166 [393] 0.5667629 0.5657061 0.5646462 0.5635834 0.5625175 0.5614488 0.5603771 [400] 0.5593026 0.5582253 > mx [1] 0.6841336 > mxli [1] -0.25 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/18lur1226340708.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/2hex41226340708.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/3dyzr1226340708.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/46nid1226340708.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/51ani1226340708.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/6m1jx1226340708.tab") > > system("convert tmp/18lur1226340708.ps tmp/18lur1226340708.png") > system("convert tmp/2hex41226340708.ps tmp/2hex41226340708.png") > system("convert tmp/3dyzr1226340708.ps tmp/3dyzr1226340708.png") > system("convert tmp/46nid1226340708.ps tmp/46nid1226340708.png") > system("convert tmp/51ani1226340708.ps tmp/51ani1226340708.png") > > > proc.time() user system elapsed 1.355 0.824 1.631