R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(122.2,122.6,122.2,118.8,119,118.2,117.8,116.8,114.6,113.4,113.8,124.2,125.8,125.6,122.4,119,119.4,118.6,118,116,114.8,114.6,114.6,124,125.2,124,117.6,113.2,111.4,112.2,109.8,106.4,105.2,102.2,99.8,111,113,108.4,105.4,102,102.8,103.4,101.6,98.6,98,93.8,95.6,105.6,106.8,103.6,101.2,100.4,103.2,105.6,106.6,107.2,107.4,104.8,107.2,117.4) > #'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.6549755 -0.6550615 -0.6551474 -0.6552331 -0.6553187 -0.6554041 [7] -0.6554893 -0.6555745 -0.6556594 -0.6557442 -0.6558289 -0.6559134 [13] -0.6559977 -0.6560819 -0.6561660 -0.6562498 -0.6563336 -0.6564172 [19] -0.6565006 -0.6565839 -0.6566670 -0.6567500 -0.6568329 -0.6569155 [25] -0.6569981 -0.6570804 -0.6571627 -0.6572447 -0.6573266 -0.6574084 [31] -0.6574900 -0.6575715 -0.6576528 -0.6577340 -0.6578150 -0.6578958 [37] -0.6579765 -0.6580571 -0.6581375 -0.6582177 -0.6582978 -0.6583777 [43] -0.6584575 -0.6585371 -0.6586166 -0.6586959 -0.6587751 -0.6588541 [49] -0.6589330 -0.6590117 -0.6590903 -0.6591687 -0.6592470 -0.6593251 [55] -0.6594030 -0.6594808 -0.6595585 -0.6596360 -0.6597133 -0.6597905 [61] -0.6598675 -0.6599444 -0.6600211 -0.6600977 -0.6601741 -0.6602504 [67] -0.6603265 -0.6604025 -0.6604783 -0.6605539 -0.6606294 -0.6607048 [73] -0.6607800 -0.6608550 -0.6609299 -0.6610046 -0.6610792 -0.6611537 [79] -0.6612279 -0.6613020 -0.6613760 -0.6614498 -0.6615235 -0.6615970 [85] -0.6616703 -0.6617435 -0.6618166 -0.6618895 -0.6619622 -0.6620348 [91] -0.6621072 -0.6621795 -0.6622516 -0.6623236 -0.6623954 -0.6624671 [97] -0.6625386 -0.6626100 -0.6626812 -0.6627522 -0.6628231 -0.6628938 [103] -0.6629644 -0.6630349 -0.6631051 -0.6631753 -0.6632452 -0.6633150 [109] -0.6633847 -0.6634542 -0.6635236 -0.6635928 -0.6636618 -0.6637307 [115] -0.6637994 -0.6638680 -0.6639365 -0.6640047 -0.6640728 -0.6641408 [121] -0.6642086 -0.6642763 -0.6643438 -0.6644111 -0.6644783 -0.6645454 [127] -0.6646123 -0.6646790 -0.6647456 -0.6648120 -0.6648783 -0.6649444 [133] -0.6650104 -0.6650762 -0.6651418 -0.6652073 -0.6652727 -0.6653379 [139] -0.6654029 -0.6654678 -0.6655325 -0.6655971 -0.6656615 -0.6657258 [145] -0.6657899 -0.6658538 -0.6659176 -0.6659813 -0.6660448 -0.6661081 [151] -0.6661713 -0.6662343 -0.6662972 -0.6663599 -0.6664225 -0.6664849 [157] -0.6665472 -0.6666093 -0.6666712 -0.6667330 -0.6667946 -0.6668561 [163] -0.6669175 -0.6669786 -0.6670397 -0.6671005 -0.6671612 -0.6672218 [169] -0.6672822 -0.6673425 -0.6674026 -0.6674625 -0.6675223 -0.6675819 [175] -0.6676414 -0.6677007 -0.6677599 -0.6678189 -0.6678778 -0.6679365 [181] -0.6679950 -0.6680534 -0.6681117 -0.6681698 -0.6682277 -0.6682855 [187] -0.6683431 -0.6684006 -0.6684579 -0.6685150 -0.6685721 -0.6686289 [193] -0.6686856 -0.6687422 -0.6687985 -0.6688548 -0.6689109 -0.6689668 [199] -0.6690226 -0.6690782 -0.6691336 -0.6691890 -0.6692441 -0.6692991 [205] -0.6693540 -0.6694087 -0.6694632 -0.6695176 -0.6695718 -0.6696259 [211] -0.6696798 -0.6697336 -0.6697872 -0.6698407 -0.6698940 -0.6699471 [217] -0.6700001 -0.6700530 -0.6701056 -0.6701582 -0.6702106 -0.6702628 [223] -0.6703149 -0.6703668 -0.6704185 -0.6704702 -0.6705216 -0.6705729 [229] -0.6706241 -0.6706751 -0.6707259 -0.6707766 -0.6708271 -0.6708775 [235] -0.6709277 -0.6709778 -0.6710277 -0.6710775 -0.6711271 -0.6711765 [241] -0.6712258 -0.6712750 -0.6713240 -0.6713728 -0.6714215 -0.6714700 [247] -0.6715184 -0.6715666 -0.6716147 -0.6716626 -0.6717104 -0.6717580 [253] -0.6718054 -0.6718527 -0.6718999 -0.6719469 -0.6719937 -0.6720404 [259] -0.6720870 -0.6721333 -0.6721796 -0.6722256 -0.6722716 -0.6723173 [265] -0.6723629 -0.6724084 -0.6724537 -0.6724989 -0.6725439 -0.6725887 [271] -0.6726334 -0.6726779 -0.6727223 -0.6727666 -0.6728106 -0.6728546 [277] -0.6728983 -0.6729420 -0.6729854 -0.6730288 -0.6730719 -0.6731149 [283] -0.6731578 -0.6732005 -0.6732430 -0.6732854 -0.6733277 -0.6733698 [289] -0.6734117 -0.6734535 -0.6734951 -0.6735366 -0.6735779 -0.6736191 [295] -0.6736601 -0.6737010 -0.6737417 -0.6737823 -0.6738227 -0.6738629 [301] -0.6739030 -0.6739430 -0.6739828 -0.6740224 -0.6740619 -0.6741013 [307] -0.6741405 -0.6741795 -0.6742184 -0.6742571 -0.6742957 -0.6743341 [313] -0.6743724 -0.6744105 -0.6744485 -0.6744863 -0.6745240 -0.6745615 [319] -0.6745989 -0.6746361 -0.6746732 -0.6747101 -0.6747468 -0.6747834 [325] -0.6748199 -0.6748562 -0.6748923 -0.6749283 -0.6749642 -0.6749999 [331] -0.6750354 -0.6750708 -0.6751061 -0.6751411 -0.6751761 -0.6752109 [337] -0.6752455 -0.6752800 -0.6753143 -0.6753485 -0.6753825 -0.6754164 [343] -0.6754501 -0.6754837 -0.6755171 -0.6755504 -0.6755835 -0.6756165 [349] -0.6756493 -0.6756820 -0.6757145 -0.6757469 -0.6757791 -0.6758111 [355] -0.6758431 -0.6758748 -0.6759064 -0.6759379 -0.6759692 -0.6760004 [361] -0.6760314 -0.6760622 -0.6760929 -0.6761235 -0.6761539 -0.6761842 [367] -0.6762143 -0.6762442 -0.6762740 -0.6763037 -0.6763332 -0.6763626 [373] -0.6763918 -0.6764208 -0.6764497 -0.6764785 -0.6765071 -0.6765356 [379] -0.6765639 -0.6765920 -0.6766200 -0.6766479 -0.6766756 -0.6767032 [385] -0.6767306 -0.6767578 -0.6767849 -0.6768119 -0.6768387 -0.6768654 [391] -0.6768919 -0.6769183 -0.6769445 -0.6769705 -0.6769965 -0.6770222 [397] -0.6770478 -0.6770733 -0.6770986 -0.6771238 -0.6771488 > 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/1wnjj1261296645.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/2ba2y1261296645.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/3dmkt1261296645.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/4kxc81261296645.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/529421261296645.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/6d3sc1261296645.tab") > > try(system("convert tmp/1wnjj1261296645.ps tmp/1wnjj1261296645.png",intern=TRUE)) character(0) > try(system("convert tmp/2ba2y1261296645.ps tmp/2ba2y1261296645.png",intern=TRUE)) character(0) > try(system("convert tmp/3dmkt1261296645.ps tmp/3dmkt1261296645.png",intern=TRUE)) character(0) > try(system("convert tmp/4kxc81261296645.ps tmp/4kxc81261296645.png",intern=TRUE)) character(0) > try(system("convert tmp/529421261296645.ps tmp/529421261296645.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.083 0.799 1.358