R version 2.7.0 (2008-04-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(3202.1,3650.2,2805.1,3957.5,3941.3,3905.4,3546.9,3208.7,3402,3661.1,3073.9,3419.2,3532.8,3693.1,2622.9,3130.8,3487.5,3349.7,3044.2,3266,3351.5,3606.8,3419.5,3829.5,3505.1,3845.3,2566.6,3658.5,3954,3460.1,3454.1,3412.8,3418,3349.5,3423.4,3242.8,3277.2,3833,2606.3,3643.8,3686.4,3281.6,3669.3,3191.5,3512.7,3970.7,3601.2,3610,4172.1,3956.2,3142.7,3884.3,3892.2,3613,3730.5,3481.3,3649.5,4215.2,4066.6,4196.8,4536.6,4441.6,3548.3,4735.9,4130.6,4356.2,4159.6,3988,4167.8,4902.2,3909.4,4697.6,4308.9,4420.4,3544.2,4433,4479.7,4533.2,4237.5,4207.4,4394,5148.4,4202.2,4682.5,4884.3,5288.9,4505.2,4611.5,5081.1,4523.1,4412.8,4647.4,4778.6,4495.3,4633.5,4360.5,4517.9) > #'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.6491735 0.6495814 0.6499885 0.6503946 0.6507999 0.6512042 0.6516076 [8] 0.6520102 0.6524118 0.6528124 0.6532122 0.6536110 0.6540090 0.6544060 [15] 0.6548020 0.6551972 0.6555914 0.6559847 0.6563770 0.6567684 0.6571589 [22] 0.6575484 0.6579370 0.6583247 0.6587114 0.6590971 0.6594819 0.6598658 [29] 0.6602487 0.6606307 0.6610117 0.6613917 0.6617708 0.6621489 0.6625261 [36] 0.6629023 0.6632775 0.6636518 0.6640251 0.6643974 0.6647687 0.6651391 [43] 0.6655085 0.6658770 0.6662444 0.6666109 0.6669764 0.6673409 0.6677044 [50] 0.6680670 0.6684285 0.6687891 0.6691487 0.6695073 0.6698649 0.6702215 [57] 0.6705771 0.6709317 0.6712853 0.6716380 0.6719896 0.6723402 0.6726898 [64] 0.6730384 0.6733860 0.6737326 0.6740782 0.6744228 0.6747664 0.6751090 [71] 0.6754505 0.6757911 0.6761306 0.6764691 0.6768066 0.6771431 0.6774786 [78] 0.6778130 0.6781465 0.6784789 0.6788102 0.6791406 0.6794699 0.6797983 [85] 0.6801255 0.6804518 0.6807770 0.6811012 0.6814244 0.6817465 0.6820677 [92] 0.6823877 0.6827068 0.6830248 0.6833418 0.6836577 0.6839726 0.6842865 [99] 0.6845993 0.6849111 0.6852219 0.6855316 0.6858403 0.6861479 0.6864545 [106] 0.6867600 0.6870645 0.6873680 0.6876704 0.6879718 0.6882721 0.6885714 [113] 0.6888696 0.6891668 0.6894630 0.6897581 0.6900521 0.6903451 0.6906371 [120] 0.6909280 0.6912178 0.6915066 0.6917943 0.6920810 0.6923667 0.6926512 [127] 0.6929348 0.6932173 0.6934987 0.6937791 0.6940584 0.6943366 0.6946139 [134] 0.6948900 0.6951651 0.6954391 0.6957121 0.6959841 0.6962549 0.6965247 [141] 0.6967935 0.6970612 0.6973278 0.6975934 0.6978580 0.6981214 0.6983838 [148] 0.6986452 0.6989055 0.6991647 0.6994229 0.6996800 0.6999361 0.7001911 [155] 0.7004450 0.7006979 0.7009498 0.7012005 0.7014502 0.7016989 0.7019465 [162] 0.7021930 0.7024385 0.7026829 0.7029262 0.7031685 0.7034098 0.7036500 [169] 0.7038891 0.7041271 0.7043642 0.7046001 0.7048350 0.7050688 0.7053016 [176] 0.7055333 0.7057640 0.7059936 0.7062221 0.7064496 0.7066760 0.7069014 [183] 0.7071257 0.7073490 0.7075712 0.7077924 0.7080125 0.7082315 0.7084495 [190] 0.7086665 0.7088823 0.7090972 0.7093110 0.7095237 0.7097354 0.7099460 [197] 0.7101555 0.7103641 0.7105715 0.7107780 0.7109833 0.7111876 0.7113909 [204] 0.7115931 0.7117943 0.7119944 0.7121935 0.7123915 0.7125885 0.7127845 [211] 0.7129794 0.7131732 0.7133660 0.7135578 0.7137485 0.7139382 0.7141268 [218] 0.7143144 0.7145009 0.7146864 0.7148709 0.7150543 0.7152367 0.7154181 [225] 0.7155984 0.7157777 0.7159559 0.7161331 0.7163093 0.7164844 0.7166585 [232] 0.7168316 0.7170036 0.7171747 0.7173446 0.7175136 0.7176815 0.7178484 [239] 0.7180142 0.7181791 0.7183429 0.7185056 0.7186674 0.7188281 0.7189878 [246] 0.7191465 0.7193041 0.7194608 0.7196164 0.7197710 0.7199246 0.7200771 [253] 0.7202287 0.7203792 0.7205287 0.7206772 0.7208246 0.7209711 0.7211165 [260] 0.7212610 0.7214044 0.7215468 0.7216882 0.7218286 0.7219680 0.7221064 [267] 0.7222438 0.7223801 0.7225155 0.7226499 0.7227832 0.7229156 0.7230469 [274] 0.7231773 0.7233066 0.7234350 0.7235624 0.7236887 0.7238141 0.7239385 [281] 0.7240619 0.7241843 0.7243057 0.7244261 0.7245455 0.7246639 0.7247814 [288] 0.7248978 0.7250133 0.7251278 0.7252413 0.7253538 0.7254654 0.7255759 [295] 0.7256855 0.7257941 0.7259017 0.7260084 0.7261141 0.7262188 0.7263225 [302] 0.7264252 0.7265270 0.7266278 0.7267277 0.7268266 0.7269245 0.7270214 [309] 0.7271174 0.7272124 0.7273065 0.7273995 0.7274917 0.7275828 0.7276731 [316] 0.7277623 0.7278506 0.7279379 0.7280243 0.7281098 0.7281942 0.7282778 [323] 0.7283604 0.7284420 0.7285227 0.7286024 0.7286812 0.7287591 0.7288360 [330] 0.7289119 0.7289870 0.7290611 0.7291342 0.7292064 0.7292777 0.7293480 [337] 0.7294174 0.7294859 0.7295535 0.7296201 0.7296858 0.7297505 0.7298143 [344] 0.7298772 0.7299392 0.7300003 0.7300604 0.7301196 0.7301779 0.7302353 [351] 0.7302917 0.7303473 0.7304019 0.7304556 0.7305084 0.7305603 0.7306113 [358] 0.7306614 0.7307105 0.7307588 0.7308061 0.7308526 0.7308981 0.7309428 [365] 0.7309865 0.7310293 0.7310713 0.7311123 0.7311525 0.7311917 0.7312301 [372] 0.7312676 0.7313041 0.7313398 0.7313746 0.7314086 0.7314416 0.7314737 [379] 0.7315050 0.7315354 0.7315649 0.7315935 0.7316212 0.7316481 0.7316741 [386] 0.7316992 0.7317234 0.7317468 0.7317693 0.7317909 0.7318117 0.7318316 [393] 0.7318506 0.7318688 0.7318861 0.7319025 0.7319181 0.7319328 0.7319466 [400] 0.7319596 0.7319718 > mx [1] 0.7319718 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1hm731226417098.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/2c0c21226417098.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/33hmr1226417098.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/4ipv31226417098.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/5vlgl1226417098.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/68hfy1226417098.tab") > > system("convert tmp/1hm731226417098.ps tmp/1hm731226417098.png") > system("convert tmp/2c0c21226417098.ps tmp/2c0c21226417098.png") > system("convert tmp/33hmr1226417098.ps tmp/33hmr1226417098.png") > system("convert tmp/4ipv31226417098.ps tmp/4ipv31226417098.png") > system("convert tmp/5vlgl1226417098.ps tmp/5vlgl1226417098.png") > > > proc.time() user system elapsed 2.395 1.297 2.604