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(392,394,392,396,392,396,419,421,420,418,410,418,426,428,430,424,423,427,441,449,452,462,455,461,461,463,462,456,455,456,472,472,471,465,459,465,468,467,463,460,462,461,476,476,471,453,443,442,444,438,427,424,416,406,431,434,418,412,404,409,412,406,398,397,385,390,413,413,401,397) > #'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.05328462 -0.05328663 -0.05328862 -0.05329060 -0.05329256 -0.05329450 [7] -0.05329643 -0.05329834 -0.05330023 -0.05330211 -0.05330397 -0.05330582 [13] -0.05330765 -0.05330946 -0.05331126 -0.05331304 -0.05331480 -0.05331655 [19] -0.05331828 -0.05331999 -0.05332169 -0.05332337 -0.05332504 -0.05332669 [25] -0.05332832 -0.05332994 -0.05333154 -0.05333312 -0.05333469 -0.05333624 [31] -0.05333777 -0.05333929 -0.05334079 -0.05334228 -0.05334375 -0.05334520 [37] -0.05334664 -0.05334806 -0.05334946 -0.05335085 -0.05335222 -0.05335357 [43] -0.05335491 -0.05335623 -0.05335754 -0.05335883 -0.05336010 -0.05336136 [49] -0.05336260 -0.05336382 -0.05336503 -0.05336622 -0.05336740 -0.05336856 [55] -0.05336970 -0.05337083 -0.05337194 -0.05337303 -0.05337411 -0.05337517 [61] -0.05337621 -0.05337724 -0.05337825 -0.05337925 -0.05338023 -0.05338119 [67] -0.05338214 -0.05338307 -0.05338398 -0.05338488 -0.05338576 -0.05338663 [73] -0.05338748 -0.05338831 -0.05338913 -0.05338993 -0.05339071 -0.05339148 [79] -0.05339223 -0.05339296 -0.05339368 -0.05339438 -0.05339507 -0.05339574 [85] -0.05339639 -0.05339703 -0.05339765 -0.05339826 -0.05339885 -0.05339942 [91] -0.05339997 -0.05340051 -0.05340104 -0.05340154 -0.05340204 -0.05340251 [97] -0.05340297 -0.05340341 -0.05340384 -0.05340425 -0.05340464 -0.05340502 [103] -0.05340538 -0.05340572 -0.05340605 -0.05340636 -0.05340666 -0.05340694 [109] -0.05340720 -0.05340745 -0.05340768 -0.05340790 -0.05340810 -0.05340828 [115] -0.05340844 -0.05340859 -0.05340873 -0.05340885 -0.05340895 -0.05340903 [121] -0.05340910 -0.05340915 -0.05340919 -0.05340921 -0.05340922 -0.05340920 [127] -0.05340918 -0.05340913 -0.05340907 -0.05340900 -0.05340890 -0.05340879 [133] -0.05340867 -0.05340853 -0.05340837 -0.05340820 -0.05340801 -0.05340780 [139] -0.05340758 -0.05340734 -0.05340709 -0.05340682 -0.05340653 -0.05340623 [145] -0.05340591 -0.05340557 -0.05340522 -0.05340486 -0.05340447 -0.05340407 [151] -0.05340366 -0.05340323 -0.05340278 -0.05340231 -0.05340183 -0.05340134 [157] -0.05340083 -0.05340030 -0.05339975 -0.05339919 -0.05339862 -0.05339802 [163] -0.05339742 -0.05339679 -0.05339615 -0.05339549 -0.05339482 -0.05339413 [169] -0.05339343 -0.05339271 -0.05339197 -0.05339122 -0.05339045 -0.05338966 [175] -0.05338886 -0.05338804 -0.05338721 -0.05338636 -0.05338550 -0.05338461 [181] -0.05338372 -0.05338280 -0.05338187 -0.05338093 -0.05337997 -0.05337899 [187] -0.05337800 -0.05337699 -0.05337596 -0.05337492 -0.05337386 -0.05337279 [193] -0.05337170 -0.05337060 -0.05336948 -0.05336834 -0.05336719 -0.05336602 [199] -0.05336483 -0.05336363 -0.05336241 -0.05336118 -0.05335993 -0.05335867 [205] -0.05335739 -0.05335609 -0.05335478 -0.05335345 -0.05335211 -0.05335075 [211] -0.05334937 -0.05334798 -0.05334657 -0.05334515 -0.05334371 -0.05334225 [217] -0.05334078 -0.05333929 -0.05333779 -0.05333627 -0.05333474 -0.05333319 [223] -0.05333162 -0.05333004 -0.05332844 -0.05332682 -0.05332519 -0.05332355 [229] -0.05332189 -0.05332021 -0.05331852 -0.05331681 -0.05331508 -0.05331334 [235] -0.05331159 -0.05330981 -0.05330803 -0.05330622 -0.05330440 -0.05330257 [241] -0.05330072 -0.05329885 -0.05329697 -0.05329507 -0.05329316 -0.05329123 [247] -0.05328928 -0.05328732 -0.05328534 -0.05328335 -0.05328134 -0.05327932 [253] -0.05327728 -0.05327522 -0.05327315 -0.05327106 -0.05326896 -0.05326684 [259] -0.05326471 -0.05326256 -0.05326039 -0.05325821 -0.05325601 -0.05325380 [265] -0.05325157 -0.05324933 -0.05324707 -0.05324479 -0.05324250 -0.05324020 [271] -0.05323787 -0.05323554 -0.05323318 -0.05323081 -0.05322843 -0.05322603 [277] -0.05322361 -0.05322118 -0.05321874 -0.05321627 -0.05321379 -0.05321130 [283] -0.05320879 -0.05320627 -0.05320373 -0.05320117 -0.05319860 -0.05319601 [289] -0.05319341 -0.05319079 -0.05318816 -0.05318551 -0.05318284 -0.05318016 [295] -0.05317747 -0.05317476 -0.05317203 -0.05316929 -0.05316653 -0.05316376 [301] -0.05316097 -0.05315816 -0.05315534 -0.05315251 -0.05314966 -0.05314679 [307] -0.05314391 -0.05314101 -0.05313810 -0.05313517 -0.05313223 -0.05312927 [313] -0.05312630 -0.05312331 -0.05312031 -0.05311728 -0.05311425 -0.05311120 [319] -0.05310813 -0.05310505 -0.05310195 -0.05309884 -0.05309571 -0.05309257 [325] -0.05308941 -0.05308624 -0.05308305 -0.05307984 -0.05307662 -0.05307339 [331] -0.05307014 -0.05306687 -0.05306359 -0.05306030 -0.05305698 -0.05305366 [337] -0.05305032 -0.05304696 -0.05304359 -0.05304020 -0.05303679 -0.05303338 [343] -0.05302994 -0.05302649 -0.05302303 -0.05301955 -0.05301606 -0.05301255 [349] -0.05300902 -0.05300548 -0.05300192 -0.05299835 -0.05299477 -0.05299117 [355] -0.05298755 -0.05298392 -0.05298027 -0.05297661 -0.05297294 -0.05296924 [361] -0.05296554 -0.05296182 -0.05295808 -0.05295433 -0.05295056 -0.05294678 [367] -0.05294298 -0.05293917 -0.05293534 -0.05293149 -0.05292764 -0.05292376 [373] -0.05291988 -0.05291597 -0.05291205 -0.05290812 -0.05290417 -0.05290021 [379] -0.05289623 -0.05289224 -0.05288823 -0.05288421 -0.05288017 -0.05287612 [385] -0.05287205 -0.05286796 -0.05286387 -0.05285975 -0.05285563 -0.05285148 [391] -0.05284732 -0.05284315 -0.05283896 -0.05283476 -0.05283054 -0.05282631 [397] -0.05282206 -0.05281780 -0.05281352 -0.05280923 -0.05280493 > 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/1w85l1226261294.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/2ecj31226261294.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/3vqcy1226261294.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/4joy71226261294.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/5ajc31226261294.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/63u8h1226261294.tab") > > system("convert tmp/1w85l1226261294.ps tmp/1w85l1226261294.png") > system("convert tmp/2ecj31226261294.ps tmp/2ecj31226261294.png") > system("convert tmp/3vqcy1226261294.ps tmp/3vqcy1226261294.png") > system("convert tmp/4joy71226261294.ps tmp/4joy71226261294.png") > system("convert tmp/5ajc31226261294.ps tmp/5ajc31226261294.png") > > > proc.time() user system elapsed 1.285 0.768 1.612