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(93,98.4,92.6,94.6,99.5,97.6,91.3,93.6,93.1,78.4,70.2,69.3,71.1,73.5,85.9,91.5,91.8,88.3,91.3,94,99.3,96.7,88,96.7,106.8,114.3,105.7,90.1,91.6,97.7,100.8,104.6,95.9,102.7,104,107.9,113.8,113.8,123.1,125.1,137.6,134,140.3,152.1,150.6,167.3,153.2,142,154.4,158.5,180.9,181.3,172.4,192,199.3,215.4,214.3,201.5,190.5,196) > #'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.7806918 0.7812778 0.7818618 0.7824439 0.7830241 0.7836023 0.7841785 [8] 0.7847527 0.7853249 0.7858952 0.7864634 0.7870296 0.7875938 0.7881559 [15] 0.7887160 0.7892741 0.7898301 0.7903841 0.7909360 0.7914858 0.7920335 [22] 0.7925791 0.7931227 0.7936641 0.7942034 0.7947406 0.7952757 0.7958086 [29] 0.7963394 0.7968680 0.7973945 0.7979189 0.7984410 0.7989610 0.7994788 [36] 0.7999944 0.8005078 0.8010191 0.8015281 0.8020349 0.8025395 0.8030418 [43] 0.8035420 0.8040399 0.8045355 0.8050289 0.8055201 0.8060089 0.8064956 [50] 0.8069799 0.8074620 0.8079418 0.8084193 0.8088945 0.8093675 0.8098381 [57] 0.8103064 0.8107724 0.8112361 0.8116975 0.8121565 0.8126132 0.8130676 [64] 0.8135196 0.8139693 0.8144167 0.8148617 0.8153043 0.8157446 0.8161825 [71] 0.8166180 0.8170512 0.8174820 0.8179104 0.8183365 0.8187601 0.8191814 [78] 0.8196002 0.8200167 0.8204308 0.8208424 0.8212517 0.8216585 0.8220630 [85] 0.8224650 0.8228646 0.8232618 0.8236565 0.8240488 0.8244387 0.8248262 [92] 0.8252112 0.8255938 0.8259740 0.8263517 0.8267270 0.8270998 0.8274702 [99] 0.8278381 0.8282036 0.8285667 0.8289272 0.8292854 0.8296410 0.8299942 [106] 0.8303450 0.8306933 0.8310391 0.8313824 0.8317233 0.8320618 0.8323977 [113] 0.8327312 0.8330622 0.8333908 0.8337169 0.8340405 0.8343616 0.8346803 [120] 0.8349965 0.8353102 0.8356215 0.8359303 0.8362366 0.8365404 0.8368418 [127] 0.8371407 0.8374371 0.8377310 0.8380225 0.8383115 0.8385980 0.8388821 [134] 0.8391637 0.8394428 0.8397194 0.8399936 0.8402653 0.8405345 0.8408013 [141] 0.8410656 0.8413275 0.8415868 0.8418438 0.8420982 0.8423502 0.8425997 [148] 0.8428468 0.8430915 0.8433336 0.8435733 0.8438106 0.8440454 0.8442778 [155] 0.8445077 0.8447352 0.8449602 0.8451828 0.8454030 0.8456207 0.8458360 [162] 0.8460488 0.8462593 0.8464673 0.8466728 0.8468760 0.8470767 0.8472750 [169] 0.8474709 0.8476644 0.8478555 0.8480442 0.8482305 0.8484143 0.8485958 [176] 0.8487749 0.8489515 0.8491258 0.8492977 0.8494673 0.8496344 0.8497992 [183] 0.8499616 0.8501216 0.8502793 0.8504346 0.8505875 0.8507381 0.8508863 [190] 0.8510322 0.8511757 0.8513169 0.8514557 0.8515923 0.8517264 0.8518583 [197] 0.8519878 0.8521151 0.8522400 0.8523626 0.8524829 0.8526008 0.8527165 [204] 0.8528299 0.8529410 0.8530499 0.8531564 0.8532607 0.8533626 0.8534624 [211] 0.8535598 0.8536550 0.8537480 0.8538387 0.8539271 0.8540133 0.8540973 [218] 0.8541790 0.8542586 0.8543359 0.8544109 0.8544838 0.8545545 0.8546229 [225] 0.8546892 0.8547532 0.8548151 0.8548748 0.8549323 0.8549877 0.8550409 [232] 0.8550919 0.8551408 0.8551875 0.8552320 0.8552745 0.8553148 0.8553529 [239] 0.8553890 0.8554229 0.8554547 0.8554844 0.8555120 0.8555375 0.8555609 [246] 0.8555822 0.8556014 0.8556186 0.8556337 0.8556467 0.8556577 0.8556666 [253] 0.8556734 0.8556783 0.8556811 0.8556818 0.8556805 0.8556773 0.8556720 [260] 0.8556647 0.8556554 0.8556441 0.8556308 0.8556155 0.8555983 0.8555790 [267] 0.8555579 0.8555347 0.8555096 0.8554826 0.8554536 0.8554227 0.8553898 [274] 0.8553550 0.8553183 0.8552797 0.8552392 0.8551968 0.8551525 0.8551063 [281] 0.8550583 0.8550083 0.8549565 0.8549028 0.8548473 0.8547899 0.8547307 [288] 0.8546697 0.8546068 0.8545421 0.8544755 0.8544072 0.8543371 0.8542651 [295] 0.8541914 0.8541158 0.8540385 0.8539595 0.8538786 0.8537960 0.8537116 [302] 0.8536255 0.8535377 0.8534481 0.8533568 0.8532637 0.8531689 0.8530725 [309] 0.8529743 0.8528744 0.8527729 0.8526696 0.8525647 0.8524581 0.8523498 [316] 0.8522399 0.8521283 0.8520151 0.8519003 0.8517838 0.8516657 0.8515459 [323] 0.8514246 0.8513016 0.8511770 0.8510509 0.8509231 0.8507938 0.8506629 [330] 0.8505305 0.8503964 0.8502608 0.8501237 0.8499850 0.8498448 0.8497031 [337] 0.8495598 0.8494150 0.8492687 0.8491209 0.8489716 0.8488208 0.8486686 [344] 0.8485148 0.8483596 0.8482029 0.8480448 0.8478852 0.8477241 0.8475617 [351] 0.8473977 0.8472324 0.8470656 0.8468975 0.8467279 0.8465569 0.8463845 [358] 0.8462108 0.8460356 0.8458591 0.8456812 0.8455019 0.8453213 0.8451394 [365] 0.8449561 0.8447714 0.8445855 0.8443982 0.8442096 0.8440196 0.8438284 [372] 0.8436359 0.8434421 0.8432469 0.8430506 0.8428529 0.8426540 0.8424538 [379] 0.8422523 0.8420496 0.8418457 0.8416405 0.8414341 0.8412265 0.8410177 [386] 0.8408076 0.8405963 0.8403839 0.8401702 0.8399554 0.8397394 0.8395222 [393] 0.8393038 0.8390843 0.8388636 0.8386418 0.8384188 0.8381947 0.8379695 [400] 0.8377431 0.8375156 > mx [1] 0.8556818 > mxli [1] 0.55 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/11bkf1226574983.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/2dozh1226574983.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/3b4ok1226574983.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/4ybwp1226574983.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/5kcsp1226574983.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/6inw31226574983.tab") > > system("convert tmp/11bkf1226574983.ps tmp/11bkf1226574983.png") > system("convert tmp/2dozh1226574983.ps tmp/2dozh1226574983.png") > system("convert tmp/3b4ok1226574983.ps tmp/3b4ok1226574983.png") > system("convert tmp/4ybwp1226574983.ps tmp/4ybwp1226574983.png") > system("convert tmp/5kcsp1226574983.ps tmp/5kcsp1226574983.png") > > > proc.time() user system elapsed 1.313 0.775 1.587