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(154.783,187.646,237.863,215.54,231.745,199.548,164.147,159.388,203.514,224.901,211.539,211.16,181.712,203.908,240.774,232.819,255.221,246.7,206.263,211.679,236.601,237.43,233.767,219.52,222.625,216.238,248.587,221.376,242.453,246.539,189.351,185.956,213.175,228.732,212.93,218.254,227.103,219.026,264.529,262.057,258.779,231.928,211.167,205.439,224.883,228.624,209.435,215.607,287.356,306.015,338.546,344.16,328.412,342.006,277.668,290.477,314.967,324.627,290.646,315.033) > #'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.6953637 0.6956202 0.6958759 0.6961306 0.6963844 0.6966372 0.6968891 [8] 0.6971400 0.6973900 0.6976391 0.6978872 0.6981344 0.6983806 0.6986258 [15] 0.6988701 0.6991134 0.6993557 0.6995970 0.6998374 0.7000768 0.7003153 [22] 0.7005527 0.7007891 0.7010246 0.7012591 0.7014925 0.7017250 0.7019565 [29] 0.7021869 0.7024164 0.7026448 0.7028723 0.7030987 0.7033241 0.7035485 [36] 0.7037719 0.7039942 0.7042155 0.7044358 0.7046551 0.7048733 0.7050905 [43] 0.7053066 0.7055217 0.7057358 0.7059488 0.7061608 0.7063717 0.7065815 [50] 0.7067903 0.7069981 0.7072048 0.7074104 0.7076150 0.7078185 0.7080209 [57] 0.7082223 0.7084226 0.7086218 0.7088199 0.7090170 0.7092130 0.7094079 [64] 0.7096017 0.7097945 0.7099861 0.7101767 0.7103662 0.7105546 0.7107419 [71] 0.7109281 0.7111132 0.7112972 0.7114801 0.7116619 0.7118426 0.7120222 [78] 0.7122007 0.7123781 0.7125543 0.7127295 0.7129036 0.7130765 0.7132483 [85] 0.7134190 0.7135886 0.7137571 0.7139245 0.7140907 0.7142559 0.7144199 [92] 0.7145827 0.7147445 0.7149051 0.7150646 0.7152230 0.7153802 0.7155364 [99] 0.7156913 0.7158452 0.7159979 0.7161495 0.7163000 0.7164493 0.7165975 [106] 0.7167445 0.7168905 0.7170352 0.7171789 0.7173214 0.7174627 0.7176030 [113] 0.7177421 0.7178800 0.7180168 0.7181525 0.7182870 0.7184204 0.7185526 [120] 0.7186837 0.7188136 0.7189424 0.7190701 0.7191966 0.7193220 0.7194462 [127] 0.7195693 0.7196912 0.7198120 0.7199317 0.7200502 0.7201675 0.7202837 [134] 0.7203988 0.7205127 0.7206255 0.7207371 0.7208476 0.7209569 0.7210651 [141] 0.7211722 0.7212781 0.7213829 0.7214865 0.7215889 0.7216903 0.7217905 [148] 0.7218895 0.7219874 0.7220842 0.7221798 0.7222743 0.7223676 0.7224598 [155] 0.7225508 0.7226408 0.7227295 0.7228172 0.7229037 0.7229890 0.7230733 [162] 0.7231564 0.7232383 0.7233191 0.7233988 0.7234774 0.7235548 0.7236311 [169] 0.7237063 0.7237803 0.7238532 0.7239250 0.7239957 0.7240652 0.7241336 [176] 0.7242009 0.7242670 0.7243321 0.7243960 0.7244588 0.7245205 0.7245810 [183] 0.7246405 0.7246988 0.7247560 0.7248121 0.7248671 0.7249210 0.7249737 [190] 0.7250254 0.7250760 0.7251254 0.7251738 0.7252210 0.7252672 0.7253122 [197] 0.7253562 0.7253990 0.7254408 0.7254814 0.7255210 0.7255595 0.7255969 [204] 0.7256332 0.7256684 0.7257025 0.7257355 0.7257675 0.7257984 0.7258282 [211] 0.7258569 0.7258846 0.7259112 0.7259367 0.7259611 0.7259845 0.7260068 [218] 0.7260280 0.7260482 0.7260673 0.7260854 0.7261024 0.7261183 0.7261332 [225] 0.7261471 0.7261599 0.7261716 0.7261823 0.7261920 0.7262006 0.7262082 [232] 0.7262147 0.7262202 0.7262247 0.7262281 0.7262305 0.7262319 0.7262322 [239] 0.7262316 0.7262299 0.7262272 0.7262234 0.7262187 0.7262129 0.7262061 [246] 0.7261984 0.7261896 0.7261798 0.7261690 0.7261572 0.7261444 0.7261306 [253] 0.7261159 0.7261001 0.7260833 0.7260656 0.7260469 0.7260272 0.7260065 [260] 0.7259848 0.7259622 0.7259386 0.7259140 0.7258885 0.7258619 0.7258345 [267] 0.7258060 0.7257766 0.7257463 0.7257150 0.7256827 0.7256495 0.7256154 [274] 0.7255803 0.7255443 0.7255073 0.7254694 0.7254306 0.7253908 0.7253501 [281] 0.7253085 0.7252660 0.7252225 0.7251781 0.7251328 0.7250866 0.7250395 [288] 0.7249915 0.7249425 0.7248927 0.7248420 0.7247903 0.7247378 0.7246844 [295] 0.7246301 0.7245749 0.7245188 0.7244619 0.7244040 0.7243453 0.7242857 [302] 0.7242253 0.7241639 0.7241017 0.7240387 0.7239748 0.7239100 0.7238444 [309] 0.7237779 0.7237105 0.7236424 0.7235733 0.7235035 0.7234328 0.7233612 [316] 0.7232889 0.7232157 0.7231416 0.7230668 0.7229911 0.7229146 0.7228373 [323] 0.7227592 0.7226802 0.7226005 0.7225199 0.7224386 0.7223564 0.7222735 [330] 0.7221897 0.7221052 0.7220198 0.7219337 0.7218468 0.7217591 0.7216707 [337] 0.7215814 0.7214914 0.7214006 0.7213091 0.7212168 0.7211237 0.7210299 [344] 0.7209353 0.7208399 0.7207438 0.7206470 0.7205494 0.7204511 0.7203520 [351] 0.7202522 0.7201517 0.7200504 0.7199484 0.7198457 0.7197422 0.7196381 [358] 0.7195332 0.7194276 0.7193212 0.7192142 0.7191065 0.7189981 0.7188889 [365] 0.7187791 0.7186686 0.7185573 0.7184454 0.7183328 0.7182195 0.7181056 [372] 0.7179909 0.7178756 0.7177596 0.7176429 0.7175256 0.7174076 0.7172890 [379] 0.7171696 0.7170497 0.7169290 0.7168077 0.7166858 0.7165632 0.7164400 [386] 0.7163161 0.7161916 0.7160665 0.7159407 0.7158143 0.7156873 0.7155596 [393] 0.7154314 0.7153025 0.7151729 0.7150428 0.7149121 0.7147807 0.7146488 [400] 0.7145162 0.7143831 > mx [1] 0.7262322 > mxli [1] 0.37 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1ksm41226256105.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/2xmv71226256105.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/3bnon1226256105.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/4nt7c1226256105.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/5bz3m1226256105.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/6e21t1226256105.tab") > > system("convert tmp/1ksm41226256105.ps tmp/1ksm41226256105.png") > system("convert tmp/2xmv71226256105.ps tmp/2xmv71226256105.png") > system("convert tmp/3bnon1226256105.ps tmp/3bnon1226256105.png") > system("convert tmp/4nt7c1226256105.ps tmp/4nt7c1226256105.png") > system("convert tmp/5bz3m1226256105.ps tmp/5bz3m1226256105.png") > > > proc.time() user system elapsed 1.377 0.841 1.672