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(99.5,98.2,108.9,100.0,105.0,108.4,96.7,100.5,115.6,114.9,110.7,107.7,113.5,106.9,119.6,109.4,106.9,118.7,108.9,113.1,125.1,126.5,122.7,127.5,107.1,112.0,122.1,111.5,113.2,128.2,115.1,117.4,132.0,130.8,128.0,132.7,117.0,110.9,123.5,117.4,122.7,123.5,111.5,113.8,131.2,127.0,126.2,121.2,118.8,117.9,135.2,120.7,126.4,129.6,113.4,120.5,135.5,137.6,130.6,133.1,121.5,120.5,136.9,123.7,128.5,135.0,120.9,121.1,132.2,134.5,133.6,136.1,124.5,124.6,133.5,132.3,125.3,135.5,121.2,117.5,135.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.7322338 0.7322223 0.7322106 0.7321987 0.7321866 0.7321743 0.7321618 [8] 0.7321491 0.7321361 0.7321230 0.7321097 0.7320962 0.7320825 0.7320685 [15] 0.7320544 0.7320401 0.7320256 0.7320109 0.7319959 0.7319808 0.7319655 [22] 0.7319500 0.7319342 0.7319183 0.7319022 0.7318859 0.7318693 0.7318526 [29] 0.7318357 0.7318186 0.7318012 0.7317837 0.7317660 0.7317481 0.7317300 [36] 0.7317117 0.7316931 0.7316744 0.7316555 0.7316364 0.7316171 0.7315976 [43] 0.7315779 0.7315580 0.7315379 0.7315176 0.7314971 0.7314765 0.7314556 [50] 0.7314345 0.7314132 0.7313918 0.7313701 0.7313482 0.7313262 0.7313039 [57] 0.7312815 0.7312588 0.7312360 0.7312129 0.7311897 0.7311663 0.7311426 [64] 0.7311188 0.7310948 0.7310706 0.7310462 0.7310216 0.7309968 0.7309719 [71] 0.7309467 0.7309213 0.7308958 0.7308700 0.7308440 0.7308179 0.7307916 [78] 0.7307650 0.7307383 0.7307114 0.7306843 0.7306570 0.7306295 0.7306019 [85] 0.7305740 0.7305459 0.7305177 0.7304892 0.7304606 0.7304318 0.7304028 [92] 0.7303736 0.7303442 0.7303146 0.7302848 0.7302548 0.7302247 0.7301943 [99] 0.7301638 0.7301331 0.7301022 0.7300711 0.7300398 0.7300083 0.7299766 [106] 0.7299448 0.7299127 0.7298805 0.7298481 0.7298155 0.7297827 0.7297497 [113] 0.7297166 0.7296832 0.7296497 0.7296159 0.7295820 0.7295479 0.7295136 [120] 0.7294792 0.7294445 0.7294097 0.7293747 0.7293394 0.7293041 0.7292685 [127] 0.7292327 0.7291968 0.7291606 0.7291243 0.7290878 0.7290511 0.7290143 [134] 0.7289772 0.7289400 0.7289026 0.7288650 0.7288272 0.7287892 0.7287511 [141] 0.7287128 0.7286743 0.7286356 0.7285967 0.7285576 0.7285184 0.7284790 [148] 0.7284394 0.7283996 0.7283597 0.7283195 0.7282792 0.7282387 0.7281981 [155] 0.7281572 0.7281162 0.7280750 0.7280336 0.7279920 0.7279503 0.7279084 [162] 0.7278663 0.7278240 0.7277815 0.7277389 0.7276961 0.7276531 0.7276099 [169] 0.7275666 0.7275231 0.7274794 0.7274355 0.7273915 0.7273472 0.7273029 [176] 0.7272583 0.7272135 0.7271686 0.7271235 0.7270783 0.7270328 0.7269872 [183] 0.7269414 0.7268955 0.7268493 0.7268030 0.7267565 0.7267099 0.7266630 [190] 0.7266161 0.7265689 0.7265215 0.7264740 0.7264263 0.7263785 0.7263305 [197] 0.7262823 0.7262339 0.7261854 0.7261366 0.7260878 0.7260387 0.7259895 [204] 0.7259401 0.7258906 0.7258408 0.7257910 0.7257409 0.7256907 0.7256403 [211] 0.7255897 0.7255390 0.7254881 0.7254370 0.7253858 0.7253344 0.7252828 [218] 0.7252311 0.7251792 0.7251271 0.7250749 0.7250225 0.7249699 0.7249172 [225] 0.7248643 0.7248113 0.7247581 0.7247047 0.7246511 0.7245974 0.7245435 [232] 0.7244895 0.7244353 0.7243810 0.7243264 0.7242717 0.7242169 0.7241619 [239] 0.7241067 0.7240514 0.7239959 0.7239403 0.7238844 0.7238285 0.7237723 [246] 0.7237160 0.7236596 0.7236030 0.7235462 0.7234893 0.7234322 0.7233749 [253] 0.7233175 0.7232600 0.7232022 0.7231444 0.7230863 0.7230281 0.7229698 [260] 0.7229113 0.7228526 0.7227938 0.7227348 0.7226757 0.7226164 0.7225570 [267] 0.7224974 0.7224376 0.7223777 0.7223176 0.7222574 0.7221971 0.7221365 [274] 0.7220759 0.7220150 0.7219541 0.7218929 0.7218316 0.7217702 0.7217086 [281] 0.7216469 0.7215850 0.7215229 0.7214607 0.7213984 0.7213359 0.7212732 [288] 0.7212104 0.7211475 0.7210844 0.7210212 0.7209578 0.7208942 0.7208305 [295] 0.7207667 0.7207027 0.7206386 0.7205743 0.7205099 0.7204453 0.7203805 [302] 0.7203157 0.7202507 0.7201855 0.7201202 0.7200547 0.7199891 0.7199234 [309] 0.7198575 0.7197915 0.7197253 0.7196589 0.7195925 0.7195259 0.7194591 [316] 0.7193922 0.7193252 0.7192580 0.7191907 0.7191232 0.7190556 0.7189878 [323] 0.7189199 0.7188519 0.7187837 0.7187154 0.7186470 0.7185784 0.7185096 [330] 0.7184407 0.7183717 0.7183026 0.7182333 0.7181638 0.7180943 0.7180246 [337] 0.7179547 0.7178847 0.7178146 0.7177443 0.7176739 0.7176034 0.7175327 [344] 0.7174619 0.7173910 0.7173199 0.7172487 0.7171773 0.7171059 0.7170342 [351] 0.7169625 0.7168906 0.7168186 0.7167464 0.7166741 0.7166017 0.7165291 [358] 0.7164565 0.7163836 0.7163107 0.7162376 0.7161644 0.7160910 0.7160175 [365] 0.7159439 0.7158702 0.7157963 0.7157223 0.7156482 0.7155739 0.7154995 [372] 0.7154250 0.7153504 0.7152756 0.7152007 0.7151257 0.7150505 0.7149752 [379] 0.7148998 0.7148242 0.7147486 0.7146728 0.7145968 0.7145208 0.7144446 [386] 0.7143683 0.7142919 0.7142153 0.7141387 0.7140619 0.7139849 0.7139079 [393] 0.7138307 0.7137534 0.7136760 0.7135984 0.7135208 0.7134430 0.7133651 [400] 0.7132870 0.7132089 > mx [1] 0.7322338 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1o81y1229011838.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/2ntut1229011838.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/3js7x1229011838.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/4bzav1229011838.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/592yp1229011838.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/6jrop1229011838.tab") > > system("convert tmp/1o81y1229011838.ps tmp/1o81y1229011838.png") > system("convert tmp/2ntut1229011838.ps tmp/2ntut1229011838.png") > system("convert tmp/3js7x1229011838.ps tmp/3js7x1229011838.png") > system("convert tmp/4bzav1229011838.ps tmp/4bzav1229011838.png") > system("convert tmp/592yp1229011838.ps tmp/592yp1229011838.png") > > > proc.time() user system elapsed 2.375 1.328 2.575