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(98.6,98,106.8,96.7,100.2,107.7,92,98.4,107.4,117.7,105.7,97.5,99.9,98.2,104.5,100.8,101.5,103.9,99.6,98.4,112.7,118.4,108.1,105.4,114.6,106.9,115.9,109.8,101.8,114.2,110.8,108.4,127.5,128.6,116.6,127.4,105,108.3,125,111.6,106.5,130.3,115,116.1,134,126.5,125.8,136.4,114.9,110.9,125.5,116.8,116.8,125.5,104.2,115.1,132.8,123.3,124.8,122,117.4,117.9,137.4,114.6,124.7,129.6,109.4,120.9,134.9,136.3,133.2,127.2,122.7,120.5,137.8,119.1,124.3,134.4,121.1,122.2,127.7,137.4,132.2,129.2,124.9,124.8,128.2,134.4,118.6,132.6,123.2,112.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.7244016 0.7243681 0.7243343 0.7243003 0.7242661 0.7242316 0.7241969 [8] 0.7241620 0.7241269 0.7240915 0.7240559 0.7240201 0.7239841 0.7239478 [15] 0.7239113 0.7238745 0.7238376 0.7238004 0.7237630 0.7237254 0.7236875 [22] 0.7236494 0.7236111 0.7235726 0.7235338 0.7234948 0.7234556 0.7234161 [29] 0.7233765 0.7233366 0.7232964 0.7232561 0.7232155 0.7231747 0.7231337 [36] 0.7230924 0.7230509 0.7230092 0.7229673 0.7229251 0.7228827 0.7228401 [43] 0.7227973 0.7227542 0.7227110 0.7226674 0.7226237 0.7225797 0.7225356 [50] 0.7224911 0.7224465 0.7224016 0.7223566 0.7223112 0.7222657 0.7222200 [57] 0.7221740 0.7221278 0.7220813 0.7220347 0.7219878 0.7219407 0.7218934 [64] 0.7218458 0.7217980 0.7217500 0.7217018 0.7216533 0.7216047 0.7215558 [71] 0.7215067 0.7214573 0.7214077 0.7213580 0.7213079 0.7212577 0.7212072 [78] 0.7211566 0.7211057 0.7210545 0.7210032 0.7209516 0.7208998 0.7208478 [85] 0.7207956 0.7207431 0.7206904 0.7206375 0.7205844 0.7205310 0.7204775 [92] 0.7204237 0.7203697 0.7203154 0.7202610 0.7202063 0.7201514 0.7200963 [99] 0.7200410 0.7199854 0.7199296 0.7198736 0.7198174 0.7197609 0.7197043 [106] 0.7196474 0.7195903 0.7195330 0.7194754 0.7194177 0.7193597 0.7193015 [113] 0.7192431 0.7191844 0.7191256 0.7190665 0.7190072 0.7189477 0.7188879 [120] 0.7188280 0.7187678 0.7187074 0.7186468 0.7185860 0.7185249 0.7184637 [127] 0.7184022 0.7183405 0.7182786 0.7182164 0.7181541 0.7180915 0.7180287 [134] 0.7179657 0.7179025 0.7178391 0.7177754 0.7177115 0.7176474 0.7175831 [141] 0.7175186 0.7174539 0.7173889 0.7173238 0.7172584 0.7171928 0.7171269 [148] 0.7170609 0.7169947 0.7169282 0.7168615 0.7167946 0.7167275 0.7166602 [155] 0.7165927 0.7165249 0.7164570 0.7163888 0.7163204 0.7162518 0.7161830 [162] 0.7161139 0.7160447 0.7159752 0.7159056 0.7158357 0.7157656 0.7156953 [169] 0.7156247 0.7155540 0.7154830 0.7154119 0.7153405 0.7152689 0.7151971 [176] 0.7151251 0.7150529 0.7149805 0.7149078 0.7148350 0.7147619 0.7146886 [183] 0.7146151 0.7145414 0.7144675 0.7143934 0.7143191 0.7142446 0.7141698 [190] 0.7140948 0.7140197 0.7139443 0.7138687 0.7137929 0.7137169 0.7136407 [197] 0.7135643 0.7134877 0.7134108 0.7133338 0.7132565 0.7131791 0.7131014 [204] 0.7130235 0.7129454 0.7128672 0.7127887 0.7127100 0.7126310 0.7125519 [211] 0.7124726 0.7123931 0.7123133 0.7122334 0.7121533 0.7120729 0.7119923 [218] 0.7119116 0.7118306 0.7117494 0.7116681 0.7115865 0.7115047 0.7114227 [225] 0.7113405 0.7112581 0.7111755 0.7110927 0.7110097 0.7109265 0.7108431 [232] 0.7107595 0.7106756 0.7105916 0.7105074 0.7104230 0.7103383 0.7102535 [239] 0.7101685 0.7100832 0.7099978 0.7099122 0.7098263 0.7097403 0.7096540 [246] 0.7095676 0.7094810 0.7093941 0.7093071 0.7092198 0.7091324 0.7090448 [253] 0.7089569 0.7088689 0.7087807 0.7086922 0.7086036 0.7085148 0.7084257 [260] 0.7083365 0.7082471 0.7081575 0.7080676 0.7079776 0.7078874 0.7077970 [267] 0.7077064 0.7076156 0.7075246 0.7074334 0.7073420 0.7072504 0.7071586 [274] 0.7070667 0.7069745 0.7068821 0.7067896 0.7066968 0.7066039 0.7065107 [281] 0.7064174 0.7063239 0.7062301 0.7061362 0.7060421 0.7059478 0.7058533 [288] 0.7057586 0.7056637 0.7055687 0.7054734 0.7053780 0.7052823 0.7051865 [295] 0.7050904 0.7049942 0.7048978 0.7048012 0.7047044 0.7046074 0.7045103 [302] 0.7044129 0.7043153 0.7042176 0.7041197 0.7040216 0.7039233 0.7038248 [309] 0.7037261 0.7036272 0.7035281 0.7034289 0.7033295 0.7032298 0.7031300 [316] 0.7030300 0.7029299 0.7028295 0.7027289 0.7026282 0.7025273 0.7024262 [323] 0.7023249 0.7022234 0.7021217 0.7020199 0.7019178 0.7018156 0.7017132 [330] 0.7016106 0.7015079 0.7014049 0.7013018 0.7011985 0.7010950 0.7009913 [337] 0.7008874 0.7007834 0.7006791 0.7005747 0.7004701 0.7003654 0.7002604 [344] 0.7001553 0.7000500 0.6999445 0.6998388 0.6997329 0.6996269 0.6995207 [351] 0.6994143 0.6993077 0.6992010 0.6990941 0.6989870 0.6988797 0.6987722 [358] 0.6986646 0.6985568 0.6984488 0.6983406 0.6982322 0.6981237 0.6980150 [365] 0.6979061 0.6977971 0.6976879 0.6975785 0.6974689 0.6973591 0.6972492 [372] 0.6971391 0.6970288 0.6969184 0.6968078 0.6966970 0.6965860 0.6964749 [379] 0.6963636 0.6962521 0.6961404 0.6960286 0.6959166 0.6958044 0.6956921 [386] 0.6955796 0.6954669 0.6953540 0.6952410 0.6951278 0.6950144 0.6949009 [393] 0.6947872 0.6946733 0.6945593 0.6944451 0.6943307 0.6942162 0.6941014 [400] 0.6939866 0.6938715 > mx [1] 0.7244016 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1tvd41226497878.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/247yu1226497878.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/3yfm01226497878.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/4wxrd1226497878.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/594so1226497878.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/6inyb1226497878.tab") > > system("convert tmp/1tvd41226497878.ps tmp/1tvd41226497878.png") > system("convert tmp/247yu1226497878.ps tmp/247yu1226497878.png") > system("convert tmp/3yfm01226497878.ps tmp/3yfm01226497878.png") > system("convert tmp/4wxrd1226497878.ps tmp/4wxrd1226497878.png") > system("convert tmp/594so1226497878.ps tmp/594so1226497878.png") > > > proc.time() user system elapsed 1.347 0.815 1.603