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(32.68,31.54,32.43,26.54,25.85,27.6,25.71,25.38,28.57,27.64,25.36,25.9,26.29,21.74,19.2,19.32,19.82,20.36,24.31,25.97,25.61,24.67,25.59,26.09,28.37,27.34,24.46,27.46,30.23,32.33,29.87,24.87,25.48,27.28,28.24,29.58,26.95,29.08,28.76,29.59,30.7,30.52,32.67,33.19,37.13,35.54,37.75,41.84,42.94,49.14,44.61,40.22,44.23,45.85,53.38,53.26,51.8,55.3,57.81,63.96,63.77,59.15,56.12,57.42,63.52,61.71,63.01,68.18,72.03,69.75,74.41,74.33,64.24,60.03,59.44,62.5,55.04,58.34,61.92,67.65,67.68,70.3,75.26,71.44,76.36,81.71,92.6,90.6,92.23,94.09,102.79,109.65,124.05,132.69,135.81,116.07,101.42,75.73,55.48) > #'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.7787220 0.7794432 0.7801625 0.7808801 0.7815958 0.7823096 0.7830217 [8] 0.7837319 0.7844402 0.7851466 0.7858511 0.7865537 0.7872544 0.7879532 [15] 0.7886500 0.7893449 0.7900378 0.7907287 0.7914176 0.7921045 0.7927894 [22] 0.7934723 0.7941531 0.7948319 0.7955085 0.7961831 0.7968557 0.7975260 [29] 0.7981943 0.7988605 0.7995244 0.8001863 0.8008459 0.8015034 0.8021586 [36] 0.8028117 0.8034625 0.8041111 0.8047574 0.8054014 0.8060432 0.8066826 [43] 0.8073198 0.8079546 0.8085871 0.8092172 0.8098450 0.8104704 0.8110933 [50] 0.8117139 0.8123321 0.8129478 0.8135610 0.8141718 0.8147801 0.8153859 [57] 0.8159892 0.8165900 0.8171882 0.8177838 0.8183769 0.8189674 0.8195553 [64] 0.8201406 0.8207232 0.8213032 0.8218805 0.8224551 0.8230270 0.8235962 [71] 0.8241627 0.8247264 0.8252874 0.8258456 0.8264010 0.8269535 0.8275033 [78] 0.8280502 0.8285942 0.8291353 0.8296735 0.8302089 0.8307412 0.8312707 [85] 0.8317971 0.8323206 0.8328410 0.8333585 0.8338729 0.8343842 0.8348924 [92] 0.8353976 0.8358996 0.8363985 0.8368942 0.8373868 0.8378762 0.8383623 [99] 0.8388453 0.8393249 0.8398013 0.8402745 0.8407443 0.8412107 0.8416738 [106] 0.8421336 0.8425899 0.8430429 0.8434924 0.8439385 0.8443810 0.8448201 [113] 0.8452557 0.8456877 0.8461162 0.8465411 0.8469623 0.8473800 0.8477940 [120] 0.8482044 0.8486110 0.8490140 0.8494132 0.8498086 0.8502003 0.8505881 [127] 0.8509722 0.8513524 0.8517287 0.8521011 0.8524696 0.8528342 0.8531948 [134] 0.8535514 0.8539040 0.8542526 0.8545971 0.8549375 0.8552738 0.8556060 [141] 0.8559340 0.8562579 0.8565775 0.8568929 0.8572041 0.8575109 0.8578135 [148] 0.8581118 0.8584057 0.8586952 0.8589803 0.8592610 0.8595372 0.8598089 [155] 0.8600762 0.8603389 0.8605971 0.8608506 0.8610996 0.8613439 0.8615836 [162] 0.8618186 0.8620489 0.8622745 0.8624953 0.8627113 0.8629225 0.8631289 [169] 0.8633304 0.8635270 0.8637187 0.8639055 0.8640872 0.8642641 0.8644358 [176] 0.8646026 0.8647643 0.8649208 0.8650723 0.8652186 0.8653598 0.8654957 [183] 0.8656264 0.8657519 0.8658721 0.8659870 0.8660966 0.8662009 0.8662998 [190] 0.8663932 0.8664813 0.8665639 0.8666410 0.8667127 0.8667788 0.8668394 [197] 0.8668944 0.8669438 0.8669876 0.8670258 0.8670583 0.8670851 0.8671062 [204] 0.8671216 0.8671312 0.8671350 0.8671331 0.8671253 0.8671117 0.8670922 [211] 0.8670669 0.8670356 0.8669984 0.8669553 0.8669062 0.8668511 0.8667900 [218] 0.8667228 0.8666496 0.8665704 0.8664851 0.8663936 0.8662961 0.8661924 [225] 0.8660825 0.8659665 0.8658443 0.8657159 0.8655812 0.8654403 0.8652932 [232] 0.8651398 0.8649801 0.8648141 0.8646418 0.8644632 0.8642782 0.8640869 [239] 0.8638892 0.8636851 0.8634747 0.8632578 0.8630346 0.8628049 0.8625688 [246] 0.8623263 0.8620773 0.8618218 0.8615599 0.8612916 0.8610167 0.8607354 [253] 0.8604476 0.8601532 0.8598524 0.8595451 0.8592313 0.8589109 0.8585841 [260] 0.8582507 0.8579108 0.8575644 0.8572115 0.8568520 0.8564861 0.8561136 [267] 0.8557346 0.8553491 0.8549570 0.8545585 0.8541534 0.8537419 0.8533239 [274] 0.8528993 0.8524683 0.8520308 0.8515868 0.8511364 0.8506795 0.8502162 [281] 0.8497464 0.8492703 0.8487876 0.8482986 0.8478032 0.8473015 0.8467933 [288] 0.8462788 0.8457580 0.8452308 0.8446974 0.8441576 0.8436116 0.8430593 [295] 0.8425008 0.8419360 0.8413651 0.8407880 0.8402047 0.8396152 0.8390197 [302] 0.8384180 0.8378103 0.8371965 0.8365767 0.8359509 0.8353191 0.8346814 [309] 0.8340377 0.8333882 0.8327327 0.8320715 0.8314044 0.8307315 0.8300528 [316] 0.8293684 0.8286784 0.8279826 0.8272812 0.8265742 0.8258617 0.8251436 [323] 0.8244200 0.8236909 0.8229564 0.8222164 0.8214712 0.8207205 0.8199646 [330] 0.8192035 0.8184371 0.8176655 0.8168888 0.8161069 0.8153200 0.8145281 [337] 0.8137312 0.8129293 0.8121226 0.8113109 0.8104944 0.8096732 0.8088472 [344] 0.8080165 0.8071812 0.8063412 0.8054967 0.8046476 0.8037941 0.8029361 [351] 0.8020737 0.8012070 0.8003360 0.7994607 0.7985812 0.7976975 0.7968098 [358] 0.7959179 0.7950220 0.7941222 0.7932184 0.7923107 0.7913992 0.7904839 [365] 0.7895648 0.7886421 0.7877157 0.7867857 0.7858522 0.7849152 0.7839747 [372] 0.7830308 0.7820836 0.7811331 0.7801793 0.7792223 0.7782622 0.7772989 [379] 0.7763326 0.7753633 0.7743910 0.7734159 0.7724378 0.7714570 0.7704734 [386] 0.7694871 0.7684981 0.7675065 0.7665124 0.7655158 0.7645167 0.7635152 [393] 0.7625113 0.7615051 0.7604967 0.7594860 0.7584732 0.7574582 0.7564412 [400] 0.7554222 0.7544012 > mx [1] 0.867135 > mxli [1] 0.05 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/11mfz1229170610.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/2d7q81229170610.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/3zmrs1229170610.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/4p9tp1229170610.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/50gzf1229170610.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/653la1229170610.tab") > > system("convert tmp/11mfz1229170610.ps tmp/11mfz1229170610.png") > system("convert tmp/2d7q81229170610.ps tmp/2d7q81229170610.png") > system("convert tmp/3zmrs1229170610.ps tmp/3zmrs1229170610.png") > system("convert tmp/4p9tp1229170610.ps tmp/4p9tp1229170610.png") > system("convert tmp/50gzf1229170610.ps tmp/50gzf1229170610.png") > > > proc.time() user system elapsed 1.739 1.290 1.978