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(7.3,7.6,7.5,7.6,7.9,7.9,8.1,8.2,8,7.5,6.8,6.5,6.6,7.6,8,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.9,7.7,7.4,7.5) > #'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.4383802 -0.4383909 -0.4384016 -0.4384122 -0.4384228 -0.4384332 [7] -0.4384435 -0.4384537 -0.4384639 -0.4384739 -0.4384839 -0.4384937 [13] -0.4385035 -0.4385132 -0.4385227 -0.4385322 -0.4385416 -0.4385509 [19] -0.4385601 -0.4385693 -0.4385783 -0.4385872 -0.4385961 -0.4386048 [25] -0.4386135 -0.4386220 -0.4386305 -0.4386389 -0.4386472 -0.4386554 [31] -0.4386635 -0.4386715 -0.4386794 -0.4386873 -0.4386950 -0.4387026 [37] -0.4387102 -0.4387176 -0.4387250 -0.4387323 -0.4387395 -0.4387466 [43] -0.4387536 -0.4387605 -0.4387673 -0.4387740 -0.4387806 -0.4387872 [49] -0.4387936 -0.4388000 -0.4388062 -0.4388124 -0.4388185 -0.4388245 [55] -0.4388304 -0.4388362 -0.4388419 -0.4388475 -0.4388530 -0.4388585 [61] -0.4388638 -0.4388691 -0.4388742 -0.4388793 -0.4388843 -0.4388892 [67] -0.4388940 -0.4388987 -0.4389033 -0.4389078 -0.4389123 -0.4389166 [73] -0.4389208 -0.4389250 -0.4389291 -0.4389330 -0.4389369 -0.4389407 [79] -0.4389444 -0.4389480 -0.4389515 -0.4389550 -0.4389583 -0.4389616 [85] -0.4389647 -0.4389678 -0.4389707 -0.4389736 -0.4389764 -0.4389791 [91] -0.4389817 -0.4389842 -0.4389867 -0.4389890 -0.4389912 -0.4389934 [97] -0.4389955 -0.4389974 -0.4389993 -0.4390011 -0.4390028 -0.4390044 [103] -0.4390059 -0.4390074 -0.4390087 -0.4390100 -0.4390111 -0.4390122 [109] -0.4390132 -0.4390141 -0.4390149 -0.4390156 -0.4390162 -0.4390167 [115] -0.4390171 -0.4390175 -0.4390178 -0.4390179 -0.4390180 -0.4390180 [121] -0.4390179 -0.4390177 -0.4390174 -0.4390170 -0.4390166 -0.4390160 [127] -0.4390154 -0.4390146 -0.4390138 -0.4390129 -0.4390119 -0.4390108 [133] -0.4390096 -0.4390084 -0.4390070 -0.4390056 -0.4390040 -0.4390024 [139] -0.4390007 -0.4389989 -0.4389970 -0.4389950 -0.4389929 -0.4389908 [145] -0.4389885 -0.4389862 -0.4389838 -0.4389812 -0.4389786 -0.4389759 [151] -0.4389732 -0.4389703 -0.4389673 -0.4389643 -0.4389611 -0.4389579 [157] -0.4389546 -0.4389512 -0.4389477 -0.4389441 -0.4389405 -0.4389367 [163] -0.4389329 -0.4389289 -0.4389249 -0.4389208 -0.4389166 -0.4389123 [169] -0.4389079 -0.4389035 -0.4388989 -0.4388943 -0.4388895 -0.4388847 [175] -0.4388798 -0.4388748 -0.4388698 -0.4388646 -0.4388593 -0.4388540 [181] -0.4388486 -0.4388431 -0.4388375 -0.4388318 -0.4388260 -0.4388201 [187] -0.4388142 -0.4388081 -0.4388020 -0.4387958 -0.4387895 -0.4387831 [193] -0.4387766 -0.4387701 -0.4387634 -0.4387567 -0.4387499 -0.4387429 [199] -0.4387359 -0.4387289 -0.4387217 -0.4387144 -0.4387071 -0.4386997 [205] -0.4386922 -0.4386846 -0.4386769 -0.4386691 -0.4386612 -0.4386533 [211] -0.4386452 -0.4386371 -0.4386289 -0.4386206 -0.4386123 -0.4386038 [217] -0.4385952 -0.4385866 -0.4385779 -0.4385691 -0.4385602 -0.4385512 [223] -0.4385421 -0.4385330 -0.4385238 -0.4385144 -0.4385050 -0.4384956 [229] -0.4384860 -0.4384763 -0.4384666 -0.4384567 -0.4384468 -0.4384368 [235] -0.4384267 -0.4384166 -0.4384063 -0.4383960 -0.4383856 -0.4383750 [241] -0.4383644 -0.4383538 -0.4383430 -0.4383322 -0.4383212 -0.4383102 [247] -0.4382991 -0.4382879 -0.4382767 -0.4382653 -0.4382539 -0.4382423 [253] -0.4382307 -0.4382191 -0.4382073 -0.4381954 -0.4381835 -0.4381715 [259] -0.4381593 -0.4381472 -0.4381349 -0.4381225 -0.4381101 -0.4380976 [265] -0.4380849 -0.4380723 -0.4380595 -0.4380466 -0.4380337 -0.4380207 [271] -0.4380076 -0.4379944 -0.4379811 -0.4379677 -0.4379543 -0.4379408 [277] -0.4379272 -0.4379135 -0.4378997 -0.4378859 -0.4378719 -0.4378579 [283] -0.4378438 -0.4378296 -0.4378154 -0.4378010 -0.4377866 -0.4377721 [289] -0.4377575 -0.4377428 -0.4377281 -0.4377132 -0.4376983 -0.4376833 [295] -0.4376682 -0.4376531 -0.4376378 -0.4376225 -0.4376071 -0.4375916 [301] -0.4375761 -0.4375604 -0.4375447 -0.4375289 -0.4375130 -0.4374970 [307] -0.4374809 -0.4374648 -0.4374486 -0.4374323 -0.4374159 -0.4373995 [313] -0.4373829 -0.4373663 -0.4373496 -0.4373328 -0.4373160 -0.4372990 [319] -0.4372820 -0.4372649 -0.4372477 -0.4372305 -0.4372131 -0.4371957 [325] -0.4371782 -0.4371606 -0.4371430 -0.4371252 -0.4371074 -0.4370895 [331] -0.4370715 -0.4370535 -0.4370353 -0.4370171 -0.4369988 -0.4369805 [337] -0.4369620 -0.4369435 -0.4369249 -0.4369062 -0.4368874 -0.4368686 [343] -0.4368497 -0.4368307 -0.4368116 -0.4367924 -0.4367732 -0.4367539 [349] -0.4367345 -0.4367150 -0.4366954 -0.4366758 -0.4366561 -0.4366363 [355] -0.4366165 -0.4365965 -0.4365765 -0.4365564 -0.4365362 -0.4365160 [361] -0.4364957 -0.4364753 -0.4364548 -0.4364342 -0.4364136 -0.4363929 [367] -0.4363721 -0.4363512 -0.4363303 -0.4363093 -0.4362882 -0.4362670 [373] -0.4362457 -0.4362244 -0.4362030 -0.4361815 -0.4361600 -0.4361383 [379] -0.4361166 -0.4360949 -0.4360730 -0.4360511 -0.4360290 -0.4360070 [385] -0.4359848 -0.4359626 -0.4359402 -0.4359178 -0.4358954 -0.4358728 [391] -0.4358502 -0.4358275 -0.4358048 -0.4357819 -0.4357590 -0.4357360 [397] -0.4357129 -0.4356898 -0.4356666 -0.4356433 -0.4356199 > 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/13lcs1257423858.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/2p9xj1257423858.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/3s8bj1257423858.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/4qww01257423858.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/50xi21257423859.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/60gjp1257423859.tab") > > system("convert tmp/13lcs1257423858.ps tmp/13lcs1257423858.png") > system("convert tmp/2p9xj1257423858.ps tmp/2p9xj1257423858.png") > system("convert tmp/3s8bj1257423858.ps tmp/3s8bj1257423858.png") > system("convert tmp/4qww01257423858.ps tmp/4qww01257423858.png") > system("convert tmp/50xi21257423859.ps tmp/50xi21257423859.png") > > > proc.time() user system elapsed 1.068 0.765 1.477