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(11554.5,13182.1,14800.1,12150.7,14478.2,13253.9,12036.8,12653.2,14035.4,14571.4,15400.9,14283.2,14485.3,14196.3,15559.1,13767.4,14634,14381.1,12509.9,12122.3,13122.3,13908.7,13456.5,12441.6,12953,13057.2,14350.1,13830.2,13755.5,13574.4,12802.6,11737.3,13850.2,15081.8,13653.3,14019.1,13962,13768.7,14747.1,13858.1,13188,13693.1,12970,11392.8,13985.2,14994.7,13584.7,14257.8,13553.4,14007.3,16535.8,14721.4,13664.6,16805.9,13829.4,13735.6,15870.5,15962.4,15744.1,16083.7,14863.9,15533.1,17473.1,15925.5,15573.7,17495,14155.8,14913.9,17250.4,15879.8,17647.8,17749.9,17111.8,16934.8,20280,16238.2,17896.1,18089.3,15660,16162.4,17850.1,18520.4,18524.7,16843.7) > #'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.6938769 0.6940353 0.6941932 0.6943507 0.6945077 0.6946644 0.6948206 [8] 0.6949765 0.6951319 0.6952869 0.6954415 0.6955956 0.6957493 0.6959027 [15] 0.6960556 0.6962080 0.6963601 0.6965117 0.6966629 0.6968137 0.6969641 [22] 0.6971140 0.6972635 0.6974126 0.6975613 0.6977095 0.6978573 0.6980047 [29] 0.6981517 0.6982982 0.6984443 0.6985900 0.6987352 0.6988800 0.6990244 [36] 0.6991683 0.6993118 0.6994549 0.6995975 0.6997397 0.6998815 0.7000228 [43] 0.7001637 0.7003042 0.7004442 0.7005838 0.7007229 0.7008616 0.7009999 [50] 0.7011377 0.7012751 0.7014120 0.7015485 0.7016846 0.7018202 0.7019554 [57] 0.7020901 0.7022244 0.7023583 0.7024917 0.7026246 0.7027571 0.7028892 [64] 0.7030208 0.7031520 0.7032827 0.7034129 0.7035428 0.7036721 0.7038011 [71] 0.7039295 0.7040575 0.7041851 0.7043122 0.7044389 0.7045651 0.7046908 [78] 0.7048161 0.7049410 0.7050654 0.7051893 0.7053128 0.7054358 0.7055584 [85] 0.7056805 0.7058022 0.7059234 0.7060441 0.7061644 0.7062842 0.7064035 [92] 0.7065224 0.7066409 0.7067589 0.7068764 0.7069934 0.7071100 0.7072261 [99] 0.7073418 0.7074570 0.7075717 0.7076860 0.7077998 0.7079131 0.7080260 [106] 0.7081384 0.7082503 0.7083618 0.7084728 0.7085833 0.7086934 0.7088030 [113] 0.7089121 0.7090208 0.7091290 0.7092367 0.7093439 0.7094507 0.7095570 [120] 0.7096628 0.7097682 0.7098731 0.7099775 0.7100814 0.7101849 0.7102879 [127] 0.7103904 0.7104924 0.7105940 0.7106950 0.7107956 0.7108958 0.7109954 [134] 0.7110946 0.7111933 0.7112915 0.7113892 0.7114865 0.7115833 0.7116796 [141] 0.7117754 0.7118707 0.7119656 0.7120600 0.7121539 0.7122473 0.7123402 [148] 0.7124327 0.7125246 0.7126161 0.7127071 0.7127976 0.7128876 0.7129772 [155] 0.7130662 0.7131548 0.7132429 0.7133305 0.7134176 0.7135042 0.7135904 [162] 0.7136760 0.7137612 0.7138458 0.7139300 0.7140137 0.7140969 0.7141797 [169] 0.7142619 0.7143436 0.7144249 0.7145056 0.7145859 0.7146657 0.7147450 [176] 0.7148237 0.7149020 0.7149799 0.7150572 0.7151340 0.7152103 0.7152862 [183] 0.7153615 0.7154363 0.7155107 0.7155845 0.7156579 0.7157308 0.7158031 [190] 0.7158750 0.7159464 0.7160173 0.7160877 0.7161576 0.7162270 0.7162958 [197] 0.7163642 0.7164321 0.7164995 0.7165664 0.7166329 0.7166988 0.7167642 [204] 0.7168291 0.7168935 0.7169574 0.7170208 0.7170837 0.7171461 0.7172080 [211] 0.7172694 0.7173303 0.7173907 0.7174506 0.7175100 0.7175689 0.7176273 [218] 0.7176852 0.7177426 0.7177994 0.7178558 0.7179117 0.7179671 0.7180219 [225] 0.7180763 0.7181302 0.7181835 0.7182364 0.7182887 0.7183405 0.7183919 [232] 0.7184427 0.7184930 0.7185428 0.7185921 0.7186409 0.7186892 0.7187370 [239] 0.7187843 0.7188311 0.7188774 0.7189231 0.7189684 0.7190131 0.7190573 [246] 0.7191011 0.7191443 0.7191870 0.7192292 0.7192709 0.7193121 0.7193528 [253] 0.7193929 0.7194326 0.7194717 0.7195104 0.7195485 0.7195861 0.7196232 [260] 0.7196598 0.7196959 0.7197315 0.7197665 0.7198011 0.7198351 0.7198686 [267] 0.7199017 0.7199342 0.7199662 0.7199976 0.7200286 0.7200591 0.7200890 [274] 0.7201184 0.7201474 0.7201758 0.7202037 0.7202310 0.7202579 0.7202843 [281] 0.7203101 0.7203354 0.7203603 0.7203846 0.7204083 0.7204316 0.7204544 [288] 0.7204766 0.7204984 0.7205196 0.7205403 0.7205605 0.7205801 0.7205993 [295] 0.7206179 0.7206361 0.7206537 0.7206708 0.7206874 0.7207034 0.7207190 [302] 0.7207340 0.7207486 0.7207626 0.7207761 0.7207890 0.7208015 0.7208134 [309] 0.7208249 0.7208358 0.7208462 0.7208561 0.7208654 0.7208743 0.7208826 [316] 0.7208904 0.7208977 0.7209045 0.7209108 0.7209165 0.7209218 0.7209265 [323] 0.7209307 0.7209344 0.7209375 0.7209402 0.7209423 0.7209440 0.7209451 [330] 0.7209456 0.7209457 0.7209453 0.7209443 0.7209428 0.7209408 0.7209383 [337] 0.7209352 0.7209317 0.7209276 0.7209230 0.7209179 0.7209123 0.7209062 [344] 0.7208995 0.7208923 0.7208846 0.7208764 0.7208677 0.7208585 0.7208487 [351] 0.7208384 0.7208276 0.7208163 0.7208045 0.7207921 0.7207793 0.7207659 [358] 0.7207520 0.7207376 0.7207226 0.7207072 0.7206912 0.7206747 0.7206577 [365] 0.7206402 0.7206222 0.7206036 0.7205845 0.7205650 0.7205449 0.7205242 [372] 0.7205031 0.7204814 0.7204593 0.7204366 0.7204134 0.7203896 0.7203654 [379] 0.7203406 0.7203153 0.7202895 0.7202632 0.7202364 0.7202091 0.7201812 [386] 0.7201528 0.7201239 0.7200945 0.7200646 0.7200342 0.7200032 0.7199717 [393] 0.7199397 0.7199072 0.7198742 0.7198407 0.7198066 0.7197720 0.7197369 [400] 0.7197013 0.7196652 > mx [1] 0.7209457 > mxli [1] 1.3 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/10ggh1229266437.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/2uysa1229266437.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/3vg4f1229266437.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/49amp1229266437.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/5waf21229266437.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/61wy91229266437.tab") > > system("convert tmp/10ggh1229266437.ps tmp/10ggh1229266437.png") > system("convert tmp/2uysa1229266437.ps tmp/2uysa1229266437.png") > system("convert tmp/3vg4f1229266437.ps tmp/3vg4f1229266437.png") > system("convert tmp/49amp1229266437.ps tmp/49amp1229266437.png") > system("convert tmp/5waf21229266437.ps tmp/5waf21229266437.png") > > > proc.time() user system elapsed 1.055 0.763 1.267