R version 2.8.0 (2008-10-20) 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(2.25,2.33,2.18,2.13,1.97,1.89,2.11,2.16,2.28,2.25,2.18,2.28,2.2,2.18,2.23,2.18,2.22,2.24,2.09,2.05,1.98,2.09,2.1,2.2,2.44,2.64,2.68,2.75,2.83,3.04,3.13,3.17,3.33,3.38,3.49,3.55,3.68,3.69,3.82,3.9,3.88,4.01,4.13,4.29,4.35,4.34,4.1,4.04,4.11,4.01,4.13,3.64,3.58,3.82,4.02,4.22,4.64,4.41,4.32,3.71,2.68) > #'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.7966201 0.7967213 0.7968219 0.7969221 0.7970216 0.7971207 0.7972192 [8] 0.7973172 0.7974146 0.7975115 0.7976079 0.7977037 0.7977990 0.7978938 [15] 0.7979880 0.7980817 0.7981748 0.7982674 0.7983594 0.7984509 0.7985419 [22] 0.7986323 0.7987222 0.7988115 0.7989003 0.7989885 0.7990762 0.7991634 [29] 0.7992500 0.7993360 0.7994215 0.7995064 0.7995908 0.7996747 0.7997579 [36] 0.7998407 0.7999229 0.8000045 0.8000856 0.8001661 0.8002460 0.8003254 [43] 0.8004043 0.8004826 0.8005603 0.8006375 0.8007141 0.8007902 0.8008656 [50] 0.8009406 0.8010149 0.8010888 0.8011620 0.8012347 0.8013068 0.8013783 [57] 0.8014493 0.8015198 0.8015896 0.8016589 0.8017276 0.8017958 0.8018634 [64] 0.8019304 0.8019968 0.8020627 0.8021280 0.8021927 0.8022569 0.8023205 [71] 0.8023835 0.8024459 0.8025078 0.8025691 0.8026298 0.8026900 0.8027495 [78] 0.8028085 0.8028670 0.8029248 0.8029821 0.8030387 0.8030948 0.8031504 [85] 0.8032053 0.8032597 0.8033135 0.8033667 0.8034193 0.8034713 0.8035228 [92] 0.8035736 0.8036239 0.8036736 0.8037228 0.8037713 0.8038192 0.8038666 [99] 0.8039134 0.8039596 0.8040052 0.8040502 0.8040946 0.8041385 0.8041817 [106] 0.8042244 0.8042664 0.8043079 0.8043488 0.8043891 0.8044288 0.8044679 [113] 0.8045065 0.8045444 0.8045817 0.8046185 0.8046546 0.8046902 0.8047251 [120] 0.8047595 0.8047933 0.8048265 0.8048591 0.8048910 0.8049224 0.8049532 [127] 0.8049834 0.8050130 0.8050420 0.8050704 0.8050982 0.8051254 0.8051520 [134] 0.8051780 0.8052034 0.8052283 0.8052525 0.8052761 0.8052991 0.8053215 [141] 0.8053433 0.8053645 0.8053851 0.8054051 0.8054245 0.8054432 0.8054614 [148] 0.8054790 0.8054960 0.8055124 0.8055281 0.8055433 0.8055579 0.8055718 [155] 0.8055852 0.8055979 0.8056101 0.8056216 0.8056325 0.8056429 0.8056526 [162] 0.8056617 0.8056702 0.8056781 0.8056854 0.8056920 0.8056981 0.8057036 [169] 0.8057084 0.8057127 0.8057163 0.8057194 0.8057218 0.8057236 0.8057248 [176] 0.8057254 0.8057254 0.8057248 0.8057236 0.8057217 0.8057193 0.8057162 [183] 0.8057126 0.8057083 0.8057034 0.8056979 0.8056918 0.8056851 0.8056778 [190] 0.8056699 0.8056613 0.8056522 0.8056424 0.8056320 0.8056210 0.8056094 [197] 0.8055972 0.8055844 0.8055710 0.8055569 0.8055423 0.8055270 0.8055112 [204] 0.8054947 0.8054776 0.8054599 0.8054416 0.8054227 0.8054031 0.8053830 [211] 0.8053622 0.8053409 0.8053189 0.8052963 0.8052731 0.8052493 0.8052249 [218] 0.8051999 0.8051742 0.8051480 0.8051211 0.8050937 0.8050656 0.8050369 [225] 0.8050076 0.8049777 0.8049472 0.8049161 0.8048844 0.8048521 0.8048191 [232] 0.8047856 0.8047514 0.8047166 0.8046813 0.8046453 0.8046087 0.8045715 [239] 0.8045337 0.8044953 0.8044562 0.8044166 0.8043764 0.8043356 0.8042941 [246] 0.8042521 0.8042094 0.8041661 0.8041223 0.8040778 0.8040327 0.8039871 [253] 0.8039408 0.8038939 0.8038464 0.8037983 0.8037496 0.8037003 0.8036504 [260] 0.8035999 0.8035488 0.8034971 0.8034448 0.8033919 0.8033384 0.8032843 [267] 0.8032296 0.8031743 0.8031184 0.8030619 0.8030048 0.8029471 0.8028888 [274] 0.8028299 0.8027704 0.8027103 0.8026496 0.8025883 0.8025264 0.8024640 [281] 0.8024009 0.8023372 0.8022730 0.8022081 0.8021427 0.8020767 0.8020101 [288] 0.8019428 0.8018750 0.8018066 0.8017377 0.8016681 0.8015979 0.8015272 [295] 0.8014558 0.8013839 0.8013114 0.8012383 0.8011646 0.8010903 0.8010154 [302] 0.8009400 0.8008640 0.8007874 0.8007102 0.8006324 0.8005540 0.8004751 [309] 0.8003956 0.8003154 0.8002348 0.8001535 0.8000717 0.7999892 0.7999062 [316] 0.7998227 0.7997385 0.7996538 0.7995685 0.7994826 0.7993962 0.7993092 [323] 0.7992216 0.7991334 0.7990447 0.7989554 0.7988655 0.7987750 0.7986840 [330] 0.7985924 0.7985003 0.7984076 0.7983143 0.7982204 0.7981260 0.7980310 [337] 0.7979355 0.7978394 0.7977427 0.7976455 0.7975477 0.7974494 0.7973505 [344] 0.7972510 0.7971510 0.7970504 0.7969493 0.7968476 0.7967453 0.7966425 [351] 0.7965392 0.7964353 0.7963308 0.7962258 0.7961203 0.7960142 0.7959075 [358] 0.7958003 0.7956926 0.7955843 0.7954754 0.7953660 0.7952561 0.7951457 [365] 0.7950346 0.7949231 0.7948110 0.7946984 0.7945852 0.7944715 0.7943572 [372] 0.7942425 0.7941272 0.7940113 0.7938949 0.7937780 0.7936606 0.7935426 [379] 0.7934241 0.7933050 0.7931855 0.7930654 0.7929448 0.7928236 0.7927020 [386] 0.7925798 0.7924570 0.7923338 0.7922101 0.7920858 0.7919610 0.7918357 [393] 0.7917098 0.7915835 0.7914566 0.7913293 0.7912014 0.7910730 0.7909440 [400] 0.7908146 0.7906847 > mx [1] 0.8057254 > mxli [1] -0.25 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1z0e61226432421.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/freestat/rcomp/tmp/28sxn1226432421.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/freestat/rcomp/tmp/3jboc1226432421.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/freestat/rcomp/tmp/4933b1226432421.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/freestat/rcomp/tmp/51vih1226432421.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/6tdgs1226432421.tab") > > system("convert tmp/1z0e61226432421.ps tmp/1z0e61226432421.png") > system("convert tmp/28sxn1226432421.ps tmp/28sxn1226432421.png") > system("convert tmp/3jboc1226432421.ps tmp/3jboc1226432421.png") > system("convert tmp/4933b1226432421.ps tmp/4933b1226432421.png") > system("convert tmp/51vih1226432421.ps tmp/51vih1226432421.png") > > > proc.time() user system elapsed 1.729 1.287 2.819