R version 2.8.1 (2008-12-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(325412,326011,328282,317480,317539,313737,312276,309391,302950,300316,304035,333476,337698,335932,323931,313927,314485,313218,309664,302963,298989,298423,310631,329765,335083,327616,309119,295916,291413,291542,284678,276475,272566,264981,263290,296806,303598,286994,276427,266424,267153,268381,262522,255542,253158,243803,250741,280445,285257,270976,261076,255603,260376,263903,264291,263276,262572,256167,264221,293860,300713,287224) > #'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.6977690 -0.6978402 -0.6979108 -0.6979821 -0.6980547 -0.6981216 [7] -0.6981995 -0.6982710 -0.6983423 -0.6984121 -0.6984834 -0.6985542 [13] -0.6986245 -0.6986950 -0.6987650 -0.6988358 -0.6989050 -0.6989753 [19] -0.6990452 -0.6991146 -0.6991836 -0.6992529 -0.6993221 -0.6993911 [25] -0.6994603 -0.6995288 -0.6995973 -0.6996659 -0.6997342 -0.6998024 [31] -0.6998705 -0.6999384 -0.7000061 -0.7000740 -0.7001414 -0.7002088 [37] -0.7002760 -0.7003431 -0.7004100 -0.7004769 -0.7005436 -0.7006101 [43] -0.7006766 -0.7007429 -0.7008090 -0.7008750 -0.7009409 -0.7010066 [49] -0.7010722 -0.7011377 -0.7012030 -0.7012681 -0.7013332 -0.7013981 [55] -0.7014628 -0.7015275 -0.7015919 -0.7016563 -0.7017205 -0.7017846 [61] -0.7018485 -0.7019123 -0.7019759 -0.7020394 -0.7021028 -0.7021660 [67] -0.7022291 -0.7022921 -0.7023549 -0.7024176 -0.7024801 -0.7025425 [73] -0.7026047 -0.7026668 -0.7027288 -0.7027906 -0.7028523 -0.7029139 [79] -0.7029753 -0.7030365 -0.7030976 -0.7031586 -0.7032195 -0.7032802 [85] -0.7033407 -0.7034011 -0.7034614 -0.7035216 -0.7035815 -0.7036414 [91] -0.7037011 -0.7037607 -0.7038201 -0.7038794 -0.7039385 -0.7039975 [97] -0.7040564 -0.7041151 -0.7041736 -0.7042321 -0.7042904 -0.7043485 [103] -0.7044065 -0.7044644 -0.7045221 -0.7045796 -0.7046371 -0.7046943 [109] -0.7047515 -0.7048085 -0.7048653 -0.7049220 -0.7049786 -0.7050350 [115] -0.7050913 -0.7051474 -0.7052034 -0.7052593 -0.7053150 -0.7053705 [121] -0.7054259 -0.7054812 -0.7055363 -0.7055913 -0.7056461 -0.7057008 [127] -0.7057554 -0.7058098 -0.7058640 -0.7059181 -0.7059721 -0.7060259 [133] -0.7060796 -0.7061331 -0.7061865 -0.7062397 -0.7062928 -0.7063458 [139] -0.7063985 -0.7064512 -0.7065037 -0.7065561 -0.7066083 -0.7066603 [145] -0.7067123 -0.7067640 -0.7068157 -0.7068672 -0.7069185 -0.7069697 [151] -0.7070207 -0.7070716 -0.7071224 -0.7071730 -0.7072234 -0.7072737 [157] -0.7073239 -0.7073739 -0.7074238 -0.7074735 -0.7075231 -0.7075725 [163] -0.7076218 -0.7076709 -0.7077199 -0.7077687 -0.7078174 -0.7078659 [169] -0.7079143 -0.7079625 -0.7080106 -0.7080586 -0.7081064 -0.7081540 [175] -0.7082015 -0.7082489 -0.7082961 -0.7083431 -0.7083900 -0.7084368 [181] -0.7084834 -0.7085298 -0.7085761 -0.7086223 -0.7086683 -0.7087142 [187] -0.7087599 -0.7088054 -0.7088509 -0.7088961 -0.7089412 -0.7089862 [193] -0.7090310 -0.7090757 -0.7091202 -0.7091645 -0.7092088 -0.7092528 [199] -0.7092967 -0.7093405 -0.7093841 -0.7094276 -0.7094709 -0.7095140 [205] -0.7095571 -0.7095999 -0.7096426 -0.7096852 -0.7097276 -0.7097699 [211] -0.7098120 -0.7098539 -0.7098957 -0.7099374 -0.7099789 -0.7100202 [217] -0.7100614 -0.7101025 -0.7101434 -0.7101841 -0.7102247 -0.7102652 [223] -0.7103055 -0.7103456 -0.7103856 -0.7104254 -0.7104651 -0.7105046 [229] -0.7105440 -0.7105832 -0.7106223 -0.7106612 -0.7107000 -0.7107386 [235] -0.7107771 -0.7108154 -0.7108536 -0.7108916 -0.7109295 -0.7109672 [241] -0.7110047 -0.7110421 -0.7110794 -0.7111164 -0.7111534 -0.7111902 [247] -0.7112268 -0.7112633 -0.7112996 -0.7113358 -0.7113718 -0.7114077 [253] -0.7114434 -0.7114790 -0.7115144 -0.7115496 -0.7115847 -0.7116197 [259] -0.7116545 -0.7116891 -0.7117236 -0.7117580 -0.7117921 -0.7118262 [265] -0.7118600 -0.7118938 -0.7119273 -0.7119607 -0.7119940 -0.7120271 [271] -0.7120600 -0.7120928 -0.7121255 -0.7121580 -0.7121903 -0.7122225 [277] -0.7122545 -0.7122864 -0.7123181 -0.7123496 -0.7123810 -0.7124123 [283] -0.7124434 -0.7124743 -0.7125051 -0.7125357 -0.7125662 -0.7125965 [289] -0.7126267 -0.7126567 -0.7126866 -0.7127163 -0.7127458 -0.7127752 [295] -0.7128044 -0.7128335 -0.7128624 -0.7128912 -0.7129198 -0.7129483 [301] -0.7129766 -0.7130047 -0.7130327 -0.7130606 -0.7130882 -0.7131158 [307] -0.7131431 -0.7131703 -0.7131974 -0.7132243 -0.7132510 -0.7132776 [313] -0.7133041 -0.7133303 -0.7133565 -0.7133824 -0.7134082 -0.7134339 [319] -0.7134594 -0.7134847 -0.7135099 -0.7135349 -0.7135598 -0.7135845 [325] -0.7136091 -0.7136335 -0.7136577 -0.7136818 -0.7137058 -0.7137295 [331] -0.7137532 -0.7137766 -0.7137999 -0.7138231 -0.7138461 -0.7138689 [337] -0.7138916 -0.7139141 -0.7139365 -0.7139587 -0.7139807 -0.7140026 [343] -0.7140244 -0.7140460 -0.7140674 -0.7140886 -0.7141098 -0.7141307 [349] -0.7141515 -0.7141721 -0.7141926 -0.7142130 -0.7142331 -0.7142531 [355] -0.7142730 -0.7142927 -0.7143122 -0.7143316 -0.7143508 -0.7143699 [361] -0.7143888 -0.7144075 -0.7144261 -0.7144446 -0.7144629 -0.7144810 [367] -0.7144989 -0.7145168 -0.7145344 -0.7145519 -0.7145692 -0.7145864 [373] -0.7146034 -0.7146203 -0.7146370 -0.7146535 -0.7146699 -0.7146861 [379] -0.7147022 -0.7147181 -0.7147339 -0.7147495 -0.7147649 -0.7147802 [385] -0.7147953 -0.7148103 -0.7148251 -0.7148398 -0.7148542 -0.7148686 [391] -0.7148828 -0.7148968 -0.7149106 -0.7149243 -0.7149379 -0.7149513 [397] -0.7149645 -0.7149776 -0.7149905 -0.7150032 -0.7150158 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/rcomp/tmp/1erdz1257351600.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/rcomp/tmp/260x71257351600.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/rcomp/tmp/3qjyi1257351600.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/rcomp/tmp/4h4fb1257351600.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/rcomp/tmp/5e1my1257351600.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/6k3631257351600.tab") > system("convert tmp/1erdz1257351600.ps tmp/1erdz1257351600.png") > system("convert tmp/260x71257351600.ps tmp/260x71257351600.png") > system("convert tmp/3qjyi1257351600.ps tmp/3qjyi1257351600.png") > system("convert tmp/4h4fb1257351600.ps tmp/4h4fb1257351600.png") > system("convert tmp/5e1my1257351600.ps tmp/5e1my1257351600.png") > > > proc.time() user system elapsed 1.380 1.130 2.578