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(8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.5,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.6,8.2,8.1,8,8.6,8.7,8.8,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8.1,8.2,8.1,8.1,7.9,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.6,6.2,6.2,6.8,6.9,6.8) > #'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.7359445 -0.7359835 -0.7360223 -0.7360608 -0.7360990 -0.7361370 [7] -0.7361747 -0.7362122 -0.7362494 -0.7362863 -0.7363230 -0.7363594 [13] -0.7363955 -0.7364314 -0.7364670 -0.7365023 -0.7365374 -0.7365722 [19] -0.7366068 -0.7366411 -0.7366751 -0.7367089 -0.7367424 -0.7367756 [25] -0.7368086 -0.7368413 -0.7368737 -0.7369059 -0.7369378 -0.7369695 [31] -0.7370009 -0.7370320 -0.7370629 -0.7370935 -0.7371239 -0.7371540 [37] -0.7371838 -0.7372133 -0.7372426 -0.7372717 -0.7373005 -0.7373290 [43] -0.7373572 -0.7373852 -0.7374129 -0.7374404 -0.7374676 -0.7374945 [49] -0.7375212 -0.7375476 -0.7375738 -0.7375997 -0.7376253 -0.7376507 [55] -0.7376758 -0.7377006 -0.7377252 -0.7377496 -0.7377736 -0.7377974 [61] -0.7378210 -0.7378443 -0.7378673 -0.7378900 -0.7379125 -0.7379348 [67] -0.7379567 -0.7379785 -0.7379999 -0.7380211 -0.7380420 -0.7380627 [73] -0.7380831 -0.7381033 -0.7381232 -0.7381428 -0.7381622 -0.7381813 [79] -0.7382002 -0.7382188 -0.7382371 -0.7382552 -0.7382730 -0.7382905 [85] -0.7383078 -0.7383249 -0.7383416 -0.7383582 -0.7383744 -0.7383904 [91] -0.7384062 -0.7384216 -0.7384369 -0.7384518 -0.7384665 -0.7384810 [97] -0.7384952 -0.7385091 -0.7385228 -0.7385362 -0.7385494 -0.7385623 [103] -0.7385749 -0.7385873 -0.7385994 -0.7386113 -0.7386229 -0.7386342 [109] -0.7386453 -0.7386562 -0.7386667 -0.7386771 -0.7386871 -0.7386969 [115] -0.7387065 -0.7387158 -0.7387248 -0.7387336 -0.7387421 -0.7387504 [121] -0.7387584 -0.7387662 -0.7387737 -0.7387809 -0.7387879 -0.7387946 [127] -0.7388011 -0.7388073 -0.7388133 -0.7388190 -0.7388244 -0.7388296 [133] -0.7388346 -0.7388392 -0.7388437 -0.7388479 -0.7388518 -0.7388554 [139] -0.7388589 -0.7388620 -0.7388649 -0.7388676 -0.7388700 -0.7388721 [145] -0.7388740 -0.7388756 -0.7388770 -0.7388781 -0.7388790 -0.7388796 [151] -0.7388800 -0.7388801 -0.7388799 -0.7388795 -0.7388789 -0.7388780 [157] -0.7388768 -0.7388754 -0.7388737 -0.7388718 -0.7388697 -0.7388672 [163] -0.7388646 -0.7388617 -0.7388585 -0.7388551 -0.7388514 -0.7388474 [169] -0.7388433 -0.7388388 -0.7388341 -0.7388292 -0.7388240 -0.7388186 [175] -0.7388129 -0.7388069 -0.7388008 -0.7387943 -0.7387876 -0.7387807 [181] -0.7387735 -0.7387660 -0.7387583 -0.7387504 -0.7387422 -0.7387338 [187] -0.7387251 -0.7387161 -0.7387069 -0.7386975 -0.7386878 -0.7386779 [193] -0.7386677 -0.7386572 -0.7386466 -0.7386356 -0.7386244 -0.7386130 [199] -0.7386013 -0.7385894 -0.7385772 -0.7385648 -0.7385521 -0.7385392 [205] -0.7385261 -0.7385127 -0.7384990 -0.7384851 -0.7384709 -0.7384565 [211] -0.7384419 -0.7384270 -0.7384119 -0.7383965 -0.7383808 -0.7383650 [217] -0.7383488 -0.7383325 -0.7383159 -0.7382990 -0.7382819 -0.7382645 [223] -0.7382469 -0.7382291 -0.7382110 -0.7381927 -0.7381741 -0.7381553 [229] -0.7381362 -0.7381169 -0.7380973 -0.7380775 -0.7380575 -0.7380372 [235] -0.7380167 -0.7379959 -0.7379749 -0.7379536 -0.7379321 -0.7379104 [241] -0.7378884 -0.7378662 -0.7378437 -0.7378210 -0.7377980 -0.7377748 [247] -0.7377514 -0.7377277 -0.7377038 -0.7376796 -0.7376552 -0.7376305 [253] -0.7376056 -0.7375805 -0.7375551 -0.7375295 -0.7375037 -0.7374776 [259] -0.7374512 -0.7374246 -0.7373978 -0.7373708 -0.7373435 -0.7373159 [265] -0.7372882 -0.7372601 -0.7372319 -0.7372034 -0.7371747 -0.7371457 [271] -0.7371165 -0.7370870 -0.7370573 -0.7370274 -0.7369972 -0.7369668 [277] -0.7369362 -0.7369053 -0.7368742 -0.7368428 -0.7368112 -0.7367794 [283] -0.7367474 -0.7367150 -0.7366825 -0.7366497 -0.7366167 -0.7365835 [289] -0.7365500 -0.7365163 -0.7364823 -0.7364481 -0.7364137 -0.7363790 [295] -0.7363441 -0.7363090 -0.7362736 -0.7362380 -0.7362022 -0.7361661 [301] -0.7361298 -0.7360932 -0.7360565 -0.7360194 -0.7359822 -0.7359447 [307] -0.7359070 -0.7358691 -0.7358309 -0.7357925 -0.7357538 -0.7357149 [313] -0.7356758 -0.7356365 -0.7355969 -0.7355571 -0.7355170 -0.7354768 [319] -0.7354363 -0.7353955 -0.7353546 -0.7353134 -0.7352719 -0.7352303 [325] -0.7351884 -0.7351462 -0.7351039 -0.7350613 -0.7350185 -0.7349754 [331] -0.7349322 -0.7348887 -0.7348449 -0.7348010 -0.7347568 -0.7347124 [337] -0.7346677 -0.7346228 -0.7345777 -0.7345324 -0.7344868 -0.7344410 [343] -0.7343950 -0.7343487 -0.7343022 -0.7342555 -0.7342086 -0.7341614 [349] -0.7341141 -0.7340664 -0.7340186 -0.7339705 -0.7339222 -0.7338737 [355] -0.7338250 -0.7337760 -0.7337268 -0.7336773 -0.7336277 -0.7335778 [361] -0.7335277 -0.7334774 -0.7334268 -0.7333760 -0.7333250 -0.7332738 [367] -0.7332224 -0.7331707 -0.7331188 -0.7330667 -0.7330143 -0.7329617 [373] -0.7329089 -0.7328559 -0.7328027 -0.7327492 -0.7326955 -0.7326416 [379] -0.7325875 -0.7325331 -0.7324785 -0.7324237 -0.7323687 -0.7323135 [385] -0.7322580 -0.7322023 -0.7321464 -0.7320903 -0.7320339 -0.7319774 [391] -0.7319206 -0.7318636 -0.7318063 -0.7317489 -0.7316912 -0.7316333 [397] -0.7315752 -0.7315169 -0.7314583 -0.7313995 -0.7313406 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1qsd21226572851.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/2znky1226572851.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/3rgd11226572851.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/4b5gs1226572851.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/5z8to1226572851.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/6zs3g1226572851.tab") > > system("convert tmp/1qsd21226572851.ps tmp/1qsd21226572851.png") > system("convert tmp/2znky1226572851.ps tmp/2znky1226572851.png") > system("convert tmp/3rgd11226572851.ps tmp/3rgd11226572851.png") > system("convert tmp/4b5gs1226572851.ps tmp/4b5gs1226572851.png") > system("convert tmp/5z8to1226572851.ps tmp/5z8to1226572851.png") > > > proc.time() user system elapsed 1.352 0.812 1.858