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(180144,173666,165688,161570,156145,153730,182698,200765,176512,166618,158644,159585,163095,159044,155511,153745,150569,150605,179612,194690,189917,184128,175335,179566,181140,177876,175041,169292,166070,166972,206348,215706,202108,195411,193111,195198,198770,194163,190420,189733,186029,191531,232571,243477,227247,217859,208679,213188,216234,213586,209465,204045,200237,203666,241476,260307,243324,244460,233575,237217,235243,230354,227184,221678,217142,219452,256446,265845,248624,241114,229245,231805,219277,219313,212610,214771,211142,211457,240048,240636,230580,208795,197922,194596) > #'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.7193632 0.7193938 0.7194255 0.7194550 0.7194850 0.7195143 0.7195432 [8] 0.7195714 0.7195990 0.7196264 0.7196531 0.7196793 0.7197048 0.7197302 [15] 0.7197547 0.7197789 0.7198025 0.7198254 0.7198479 0.7198699 0.7198914 [22] 0.7199123 0.7199326 0.7199525 0.7199719 0.7199906 0.7200089 0.7200267 [29] 0.7200439 0.7200606 0.7200767 0.7200924 0.7201074 0.7201219 0.7201360 [36] 0.7201494 0.7201624 0.7201748 0.7201866 0.7201980 0.7202087 0.7202190 [43] 0.7202287 0.7202379 0.7202465 0.7202546 0.7202621 0.7202691 0.7202756 [50] 0.7202815 0.7202869 0.7202918 0.7202961 0.7202998 0.7203030 0.7203057 [57] 0.7203078 0.7203094 0.7203104 0.7203109 0.7203108 0.7203102 0.7203090 [64] 0.7203073 0.7203051 0.7203023 0.7202989 0.7202950 0.7202905 0.7202855 [71] 0.7202800 0.7202739 0.7202672 0.7202600 0.7202522 0.7202439 0.7202350 [78] 0.7202256 0.7202156 0.7202051 0.7201940 0.7201824 0.7201702 0.7201574 [85] 0.7201441 0.7201302 0.7201158 0.7201008 0.7200853 0.7200692 0.7200525 [92] 0.7200353 0.7200176 0.7199992 0.7199803 0.7199609 0.7199409 0.7199203 [99] 0.7198992 0.7198775 0.7198552 0.7198324 0.7198091 0.7197851 0.7197606 [106] 0.7197356 0.7197100 0.7196838 0.7196570 0.7196297 0.7196018 0.7195734 [113] 0.7195444 0.7195148 0.7194847 0.7194540 0.7194228 0.7193909 0.7193585 [120] 0.7193256 0.7192921 0.7192580 0.7192233 0.7191881 0.7191523 0.7191160 [127] 0.7190790 0.7190416 0.7190035 0.7189649 0.7189257 0.7188859 0.7188456 [134] 0.7188047 0.7187632 0.7187212 0.7186786 0.7186354 0.7185917 0.7185474 [141] 0.7185025 0.7184571 0.7184111 0.7183645 0.7183173 0.7182696 0.7182213 [148] 0.7181724 0.7181230 0.7180730 0.7180224 0.7179713 0.7179196 0.7178673 [155] 0.7178144 0.7177610 0.7177070 0.7176524 0.7175973 0.7175416 0.7174853 [162] 0.7174284 0.7173710 0.7173130 0.7172544 0.7171953 0.7171356 0.7170753 [169] 0.7170144 0.7169530 0.7168910 0.7168284 0.7167653 0.7167016 0.7166373 [176] 0.7165724 0.7165070 0.7164410 0.7163744 0.7163073 0.7162396 0.7161713 [183] 0.7161024 0.7160330 0.7159630 0.7158924 0.7158213 0.7157496 0.7156773 [190] 0.7156045 0.7155310 0.7154570 0.7153825 0.7153073 0.7152316 0.7151553 [197] 0.7150785 0.7150010 0.7149231 0.7148445 0.7147654 0.7146856 0.7146054 [204] 0.7145245 0.7144431 0.7143611 0.7142786 0.7141955 0.7141118 0.7140275 [211] 0.7139427 0.7138573 0.7137713 0.7136848 0.7135976 0.7135100 0.7134217 [218] 0.7133329 0.7132435 0.7131536 0.7130631 0.7129720 0.7128803 0.7127881 [225] 0.7126953 0.7126020 0.7125081 0.7124136 0.7123185 0.7122229 0.7121267 [232] 0.7120300 0.7119327 0.7118348 0.7117364 0.7116373 0.7115378 0.7114376 [239] 0.7113369 0.7112357 0.7111339 0.7110315 0.7109285 0.7108250 0.7107209 [246] 0.7106163 0.7105111 0.7104053 0.7102990 0.7101921 0.7100847 0.7099767 [253] 0.7098681 0.7097590 0.7096493 0.7095391 0.7094282 0.7093169 0.7092050 [260] 0.7090925 0.7089795 0.7088659 0.7087517 0.7086370 0.7085218 0.7084059 [267] 0.7082896 0.7081726 0.7080552 0.7079371 0.7078185 0.7076994 0.7075797 [274] 0.7074594 0.7073386 0.7072173 0.7070954 0.7069729 0.7068499 0.7067263 [281] 0.7066022 0.7064776 0.7063524 0.7062266 0.7061003 0.7059734 0.7058460 [288] 0.7057181 0.7055896 0.7054605 0.7053310 0.7052008 0.7050701 0.7049389 [295] 0.7048071 0.7046748 0.7045420 0.7044086 0.7042746 0.7041401 0.7040051 [302] 0.7038696 0.7037334 0.7035968 0.7034596 0.7033219 0.7031836 0.7030448 [309] 0.7029055 0.7027656 0.7026252 0.7024842 0.7023428 0.7022007 0.7020582 [316] 0.7019151 0.7017715 0.7016273 0.7014826 0.7013374 0.7011917 0.7010454 [323] 0.7008986 0.7007512 0.7006034 0.7004550 0.7003060 0.7001566 0.7000066 [330] 0.6998561 0.6997051 0.6995535 0.6994014 0.6992488 0.6990957 0.6989420 [337] 0.6987879 0.6986332 0.6984780 0.6983222 0.6981660 0.6980092 0.6978519 [344] 0.6976941 0.6975357 0.6973769 0.6972175 0.6970577 0.6968973 0.6967364 [351] 0.6965749 0.6964130 0.6962506 0.6960876 0.6959241 0.6957602 0.6955957 [358] 0.6954307 0.6952652 0.6950991 0.6949326 0.6947656 0.6945981 0.6944300 [365] 0.6942615 0.6940924 0.6939229 0.6937528 0.6935823 0.6934112 0.6932397 [372] 0.6930676 0.6928951 0.6927220 0.6925485 0.6923745 0.6921999 0.6920249 [379] 0.6918494 0.6916733 0.6914968 0.6913198 0.6911423 0.6909643 0.6907858 [386] 0.6906069 0.6904274 0.6902475 0.6900670 0.6898861 0.6897047 0.6895228 [393] 0.6893405 0.6891576 0.6889743 0.6887904 0.6886061 0.6884214 0.6882361 [400] 0.6880504 0.6878641 > mx [1] 0.7203109 > mxli [1] -1.41 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1eifh1229266774.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/2ruvo1229266774.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/34xqz1229266774.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/4fsnz1229266774.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/5tj6x1229266774.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/64bou1229266774.tab") > > system("convert tmp/1eifh1229266774.ps tmp/1eifh1229266774.png") > system("convert tmp/2ruvo1229266774.ps tmp/2ruvo1229266774.png") > system("convert tmp/34xqz1229266774.ps tmp/34xqz1229266774.png") > system("convert tmp/4fsnz1229266774.ps tmp/4fsnz1229266774.png") > system("convert tmp/5tj6x1229266774.ps tmp/5tj6x1229266774.png") > > > proc.time() user system elapsed 1.096 0.779 1.281