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(4.77,4.75,4.91,4.68,4.71,4.61,4.36,4.3,4.54,4.71,4.57,4.63,4.57,4.33,4.14,4.08,3.98,3.89,3.82,3.74,3.67,3.61,3.51,3.36) > #'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.9128760 -0.9129220 -0.9129679 -0.9130136 -0.9130591 -0.9131045 [7] -0.9131497 -0.9131947 -0.9132395 -0.9132842 -0.9133287 -0.9133730 [13] -0.9134171 -0.9134611 -0.9135049 -0.9135485 -0.9135920 -0.9136353 [19] -0.9136784 -0.9137213 -0.9137641 -0.9138067 -0.9138491 -0.9138913 [25] -0.9139334 -0.9139753 -0.9140171 -0.9140586 -0.9141000 -0.9141412 [31] -0.9141823 -0.9142232 -0.9142639 -0.9143044 -0.9143447 -0.9143849 [37] -0.9144249 -0.9144648 -0.9145045 -0.9145440 -0.9145833 -0.9146225 [43] -0.9146614 -0.9147003 -0.9147389 -0.9147774 -0.9148157 -0.9148538 [49] -0.9148918 -0.9149296 -0.9149672 -0.9150046 -0.9150419 -0.9150790 [55] -0.9151160 -0.9151527 -0.9151893 -0.9152258 -0.9152620 -0.9152981 [61] -0.9153340 -0.9153697 -0.9154053 -0.9154407 -0.9154760 -0.9155110 [67] -0.9155459 -0.9155806 -0.9156152 -0.9156496 -0.9156838 -0.9157178 [73] -0.9157517 -0.9157854 -0.9158189 -0.9158523 -0.9158855 -0.9159185 [79] -0.9159514 -0.9159841 -0.9160166 -0.9160489 -0.9160811 -0.9161131 [85] -0.9161450 -0.9161767 -0.9162082 -0.9162395 -0.9162707 -0.9163017 [91] -0.9163325 -0.9163632 -0.9163937 -0.9164240 -0.9164541 -0.9164841 [97] -0.9165139 -0.9165436 -0.9165731 -0.9166024 -0.9166316 -0.9166605 [103] -0.9166894 -0.9167180 -0.9167465 -0.9167748 -0.9168029 -0.9168309 [109] -0.9168587 -0.9168864 -0.9169138 -0.9169412 -0.9169683 -0.9169953 [115] -0.9170221 -0.9170487 -0.9170752 -0.9171015 -0.9171276 -0.9171536 [121] -0.9171794 -0.9172051 -0.9172306 -0.9172559 -0.9172810 -0.9173060 [127] -0.9173308 -0.9173554 -0.9173799 -0.9174042 -0.9174284 -0.9174524 [133] -0.9174762 -0.9174999 -0.9175234 -0.9175467 -0.9175698 -0.9175928 [139] -0.9176157 -0.9176383 -0.9176608 -0.9176832 -0.9177053 -0.9177273 [145] -0.9177492 -0.9177709 -0.9177924 -0.9178137 -0.9178349 -0.9178560 [151] -0.9178768 -0.9178975 -0.9179180 -0.9179384 -0.9179586 -0.9179787 [157] -0.9179985 -0.9180183 -0.9180378 -0.9180572 -0.9180764 -0.9180955 [163] -0.9181144 -0.9181331 -0.9181517 -0.9181701 -0.9181884 -0.9182065 [169] -0.9182244 -0.9182422 -0.9182598 -0.9182772 -0.9182945 -0.9183116 [175] -0.9183286 -0.9183454 -0.9183620 -0.9183785 -0.9183948 -0.9184110 [181] -0.9184270 -0.9184428 -0.9184585 -0.9184740 -0.9184893 -0.9185045 [187] -0.9185195 -0.9185344 -0.9185491 -0.9185637 -0.9185781 -0.9185923 [193] -0.9186064 -0.9186203 -0.9186340 -0.9186476 -0.9186611 -0.9186743 [199] -0.9186874 -0.9187004 -0.9187132 -0.9187258 -0.9187383 -0.9187506 [205] -0.9187628 -0.9187748 -0.9187867 -0.9187984 -0.9188099 -0.9188213 [211] -0.9188325 -0.9188435 -0.9188544 -0.9188652 -0.9188758 -0.9188862 [217] -0.9188965 -0.9189066 -0.9189166 -0.9189264 -0.9189360 -0.9189455 [223] -0.9189548 -0.9189640 -0.9189730 -0.9189819 -0.9189906 -0.9189992 [229] -0.9190076 -0.9190158 -0.9190239 -0.9190318 -0.9190396 -0.9190472 [235] -0.9190547 -0.9190620 -0.9190692 -0.9190762 -0.9190830 -0.9190897 [241] -0.9190962 -0.9191026 -0.9191089 -0.9191149 -0.9191209 -0.9191266 [247] -0.9191323 -0.9191377 -0.9191430 -0.9191482 -0.9191532 -0.9191580 [253] -0.9191627 -0.9191673 -0.9191717 -0.9191759 -0.9191800 -0.9191840 [259] -0.9191877 -0.9191914 -0.9191949 -0.9191982 -0.9192014 -0.9192044 [265] -0.9192073 -0.9192100 -0.9192126 -0.9192150 -0.9192173 -0.9192194 [271] -0.9192214 -0.9192232 -0.9192248 -0.9192264 -0.9192277 -0.9192290 [277] -0.9192300 -0.9192309 -0.9192317 -0.9192323 -0.9192328 -0.9192331 [283] -0.9192333 -0.9192333 -0.9192332 -0.9192329 -0.9192325 -0.9192320 [289] -0.9192312 -0.9192304 -0.9192294 -0.9192282 -0.9192269 -0.9192254 [295] -0.9192238 -0.9192221 -0.9192202 -0.9192181 -0.9192159 -0.9192136 [301] -0.9192111 -0.9192085 -0.9192057 -0.9192028 -0.9191997 -0.9191965 [307] -0.9191931 -0.9191896 -0.9191860 -0.9191822 -0.9191782 -0.9191741 [313] -0.9191699 -0.9191655 -0.9191610 -0.9191563 -0.9191515 -0.9191465 [319] -0.9191414 -0.9191362 -0.9191308 -0.9191253 -0.9191196 -0.9191138 [325] -0.9191078 -0.9191017 -0.9190954 -0.9190890 -0.9190825 -0.9190758 [331] -0.9190690 -0.9190620 -0.9190549 -0.9190477 -0.9190403 -0.9190327 [337] -0.9190251 -0.9190172 -0.9190093 -0.9190012 -0.9189929 -0.9189846 [343] -0.9189760 -0.9189674 -0.9189586 -0.9189496 -0.9189405 -0.9189313 [349] -0.9189219 -0.9189124 -0.9189028 -0.9188930 -0.9188831 -0.9188730 [355] -0.9188628 -0.9188524 -0.9188420 -0.9188313 -0.9188206 -0.9188097 [361] -0.9187986 -0.9187875 -0.9187761 -0.9187647 -0.9187531 -0.9187414 [367] -0.9187295 -0.9187175 -0.9187054 -0.9186931 -0.9186807 -0.9186681 [373] -0.9186554 -0.9186426 -0.9186296 -0.9186165 -0.9186033 -0.9185899 [379] -0.9185764 -0.9185628 -0.9185490 -0.9185351 -0.9185210 -0.9185068 [385] -0.9184925 -0.9184781 -0.9184635 -0.9184488 -0.9184339 -0.9184189 [391] -0.9184038 -0.9183885 -0.9183731 -0.9183576 -0.9183419 -0.9183261 [397] -0.9183102 -0.9182941 -0.9182780 -0.9182616 -0.9182452 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1smtr1226619604.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/2hfdx1226619604.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/3gggg1226619604.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/4mn3q1226619604.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/5yeg71226619604.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/6hwjx1226619604.tab") > > system("convert tmp/1smtr1226619604.ps tmp/1smtr1226619604.png") > system("convert tmp/2hfdx1226619604.ps tmp/2hfdx1226619604.png") > system("convert tmp/3gggg1226619604.ps tmp/3gggg1226619604.png") > system("convert tmp/4mn3q1226619604.ps tmp/4mn3q1226619604.png") > system("convert tmp/5yeg71226619604.ps tmp/5yeg71226619604.png") > > > proc.time() user system elapsed 1.666 1.229 1.840