R version 2.8.1 (2008-12-22) 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(100,100,93.5483871,88.17204301,89.24731183,91.39784946,92.47311828,91.39784946,88.17204301,87.09677419,84.94623656,92.47311828,93.5483871,93.5483871,91.39784946,90.32258065,91.39784946,93.5483871,93.5483871,92.47311828,91.39784946,89.24731183,86.02150538,88.17204301,87.09677419,87.09677419,86.02150538,84.94623656,84.94623656,86.02150538,86.02150538,84.94623656,86.02150538,82.79569892,77.41935484,80.64516129,78.49462366,75.2688172,75.2688172,75.2688172,77.41935484,78.49462366,76.34408602,73.11827957,68.8172043,65.59139785,69.89247312,82.79569892,84.94623656,80.64516129,74.19354839,70.96774194,74.19354839,82.79569892,86.02150538,86.02150538,82.79569892,78.49462366,79.56989247,87.09677419) > #'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.6194545 -0.6196914 -0.6199282 -0.6201648 -0.6204012 -0.6206375 [7] -0.6208736 -0.6211096 -0.6213454 -0.6215811 -0.6218166 -0.6220519 [13] -0.6222870 -0.6225221 -0.6227569 -0.6229916 -0.6232261 -0.6234605 [19] -0.6236946 -0.6239287 -0.6241625 -0.6243962 -0.6246298 -0.6248631 [25] -0.6250964 -0.6253294 -0.6255623 -0.6257950 -0.6260275 -0.6262599 [31] -0.6264921 -0.6267241 -0.6269560 -0.6271877 -0.6274192 -0.6276506 [37] -0.6278818 -0.6281128 -0.6283437 -0.6285744 -0.6288049 -0.6290352 [43] -0.6292654 -0.6294954 -0.6297253 -0.6299549 -0.6301844 -0.6304137 [49] -0.6306429 -0.6308718 -0.6311006 -0.6313293 -0.6315577 -0.6317860 [55] -0.6320141 -0.6322420 -0.6324698 -0.6326973 -0.6329247 -0.6331519 [61] -0.6333790 -0.6336059 -0.6338325 -0.6340591 -0.6342854 -0.6345115 [67] -0.6347375 -0.6349633 -0.6351889 -0.6354144 -0.6356396 -0.6358647 [73] -0.6360896 -0.6363143 -0.6365389 -0.6367632 -0.6369874 -0.6372114 [79] -0.6374352 -0.6376588 -0.6378823 -0.6381055 -0.6383286 -0.6385515 [85] -0.6387742 -0.6389968 -0.6392191 -0.6394413 -0.6396632 -0.6398850 [91] -0.6401066 -0.6403280 -0.6405493 -0.6407703 -0.6409911 -0.6412118 [97] -0.6414323 -0.6416526 -0.6418727 -0.6420926 -0.6423123 -0.6425319 [103] -0.6427512 -0.6429704 -0.6431893 -0.6434081 -0.6436267 -0.6438451 [109] -0.6440633 -0.6442813 -0.6444991 -0.6447168 -0.6449342 -0.6451514 [115] -0.6453685 -0.6455853 -0.6458020 -0.6460185 -0.6462348 -0.6464508 [121] -0.6466667 -0.6468824 -0.6470979 -0.6473132 -0.6475283 -0.6477432 [127] -0.6479580 -0.6481725 -0.6483868 -0.6486009 -0.6488148 -0.6490286 [133] -0.6492421 -0.6494554 -0.6496686 -0.6498815 -0.6500942 -0.6503068 [139] -0.6505191 -0.6507312 -0.6509432 -0.6511549 -0.6513664 -0.6515778 [145] -0.6517889 -0.6519998 -0.6522106 -0.6524211 -0.6526314 -0.6528415 [151] -0.6530514 -0.6532612 -0.6534707 -0.6536800 -0.6538891 -0.6540980 [157] -0.6543067 -0.6545151 -0.6547234 -0.6549315 -0.6551394 -0.6553470 [163] -0.6555545 -0.6557617 -0.6559688 -0.6561756 -0.6563823 -0.6565887 [169] -0.6567949 -0.6570009 -0.6572067 -0.6574123 -0.6576177 -0.6578228 [175] -0.6580278 -0.6582326 -0.6584371 -0.6586414 -0.6588456 -0.6590495 [181] -0.6592532 -0.6594567 -0.6596599 -0.6598630 -0.6600658 -0.6602685 [187] -0.6604709 -0.6606731 -0.6608751 -0.6610769 -0.6612785 -0.6614798 [193] -0.6616810 -0.6618819 -0.6620826 -0.6622831 -0.6624834 -0.6626835 [199] -0.6628834 -0.6630830 -0.6632824 -0.6634816 -0.6636806 -0.6638794 [205] -0.6640779 -0.6642763 -0.6644744 -0.6646723 -0.6648700 -0.6650675 [211] -0.6652647 -0.6654617 -0.6656585 -0.6658551 -0.6660515 -0.6662476 [217] -0.6664436 -0.6666393 -0.6668348 -0.6670300 -0.6672251 -0.6674199 [223] -0.6676145 -0.6678089 -0.6680031 -0.6681970 -0.6683907 -0.6685842 [229] -0.6687775 -0.6689705 -0.6691633 -0.6693559 -0.6695483 -0.6697405 [235] -0.6699324 -0.6701241 -0.6703156 -0.6705068 -0.6706978 -0.6708886 [241] -0.6710792 -0.6712696 -0.6714597 -0.6716496 -0.6718392 -0.6720287 [247] -0.6722179 -0.6724069 -0.6725956 -0.6727842 -0.6729725 -0.6731606 [253] -0.6733484 -0.6735360 -0.6737234 -0.6739106 -0.6740975 -0.6742842 [259] -0.6744707 -0.6746569 -0.6748429 -0.6750287 -0.6752142 -0.6753995 [265] -0.6755846 -0.6757695 -0.6759541 -0.6761385 -0.6763226 -0.6765066 [271] -0.6766903 -0.6768737 -0.6770569 -0.6772399 -0.6774227 -0.6776052 [277] -0.6777875 -0.6779696 -0.6781514 -0.6783330 -0.6785143 -0.6786955 [283] -0.6788763 -0.6790570 -0.6792374 -0.6794176 -0.6795975 -0.6797772 [289] -0.6799567 -0.6801359 -0.6803149 -0.6804937 -0.6806722 -0.6808505 [295] -0.6810285 -0.6812063 -0.6813839 -0.6815612 -0.6817383 -0.6819152 [301] -0.6820918 -0.6822682 -0.6824443 -0.6826202 -0.6827959 -0.6829713 [307] -0.6831465 -0.6833214 -0.6834961 -0.6836706 -0.6838448 -0.6840187 [313] -0.6841925 -0.6843660 -0.6845392 -0.6847122 -0.6848850 -0.6850575 [319] -0.6852298 -0.6854018 -0.6855736 -0.6857452 -0.6859165 -0.6860876 [325] -0.6862584 -0.6864290 -0.6865993 -0.6867694 -0.6869392 -0.6871088 [331] -0.6872782 -0.6874473 -0.6876162 -0.6877848 -0.6879532 -0.6881213 [337] -0.6882892 -0.6884568 -0.6886242 -0.6887914 -0.6889583 -0.6891249 [343] -0.6892913 -0.6894575 -0.6896234 -0.6897891 -0.6899545 -0.6901197 [349] -0.6902846 -0.6904493 -0.6906137 -0.6907779 -0.6909418 -0.6911055 [355] -0.6912689 -0.6914321 -0.6915950 -0.6917577 -0.6919202 -0.6920823 [361] -0.6922443 -0.6924060 -0.6925674 -0.6927286 -0.6928895 -0.6930502 [367] -0.6932106 -0.6933708 -0.6935307 -0.6936904 -0.6938498 -0.6940090 [373] -0.6941679 -0.6943266 -0.6944850 -0.6946432 -0.6948011 -0.6949588 [379] -0.6951162 -0.6952733 -0.6954302 -0.6955869 -0.6957433 -0.6958994 [385] -0.6960553 -0.6962109 -0.6963663 -0.6965214 -0.6966763 -0.6968309 [391] -0.6969853 -0.6971394 -0.6972932 -0.6974468 -0.6976001 -0.6977532 [397] -0.6979061 -0.6980586 -0.6982109 -0.6983630 -0.6985148 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/rcomp/tmp/1j7jl1257604541.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/rcomp/tmp/21cj61257604541.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/rcomp/tmp/3t5dr1257604541.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/rcomp/tmp/4as1i1257604541.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/rcomp/tmp/5n2gc1257604541.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/62c0p1257604541.tab") > > system("convert tmp/1j7jl1257604541.ps tmp/1j7jl1257604541.png") > system("convert tmp/21cj61257604541.ps tmp/21cj61257604541.png") > system("convert tmp/3t5dr1257604541.ps tmp/3t5dr1257604541.png") > system("convert tmp/4as1i1257604541.ps tmp/4as1i1257604541.png") > system("convert tmp/5n2gc1257604541.ps tmp/5n2gc1257604541.png") > > > proc.time() user system elapsed 1.350 1.100 1.929