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(8.2,8.0,7.5,6.8,6.5,6.6,7.6,8.0,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.0,7.1,7.2,7.1,6.9,7.0,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) > #'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.4577087 -0.4577139 -0.4577190 -0.4577240 -0.4577289 -0.4577337 [7] -0.4577385 -0.4577432 -0.4577478 -0.4577524 -0.4577568 -0.4577612 [13] -0.4577655 -0.4577697 -0.4577738 -0.4577779 -0.4577818 -0.4577857 [19] -0.4577896 -0.4577933 -0.4577969 -0.4578005 -0.4578040 -0.4578074 [25] -0.4578108 -0.4578140 -0.4578172 -0.4578203 -0.4578233 -0.4578263 [31] -0.4578291 -0.4578319 -0.4578346 -0.4578372 -0.4578398 -0.4578423 [37] -0.4578446 -0.4578469 -0.4578492 -0.4578513 -0.4578534 -0.4578554 [43] -0.4578573 -0.4578591 -0.4578609 -0.4578626 -0.4578642 -0.4578657 [49] -0.4578671 -0.4578685 -0.4578698 -0.4578710 -0.4578721 -0.4578732 [55] -0.4578742 -0.4578750 -0.4578759 -0.4578766 -0.4578773 -0.4578778 [61] -0.4578784 -0.4578788 -0.4578791 -0.4578794 -0.4578796 -0.4578797 [67] -0.4578797 -0.4578797 -0.4578796 -0.4578794 -0.4578791 -0.4578788 [73] -0.4578783 -0.4578778 -0.4578773 -0.4578766 -0.4578759 -0.4578751 [79] -0.4578742 -0.4578732 -0.4578722 -0.4578710 -0.4578698 -0.4578686 [85] -0.4578672 -0.4578658 -0.4578643 -0.4578627 -0.4578610 -0.4578593 [91] -0.4578575 -0.4578556 -0.4578536 -0.4578516 -0.4578495 -0.4578473 [97] -0.4578450 -0.4578427 -0.4578402 -0.4578377 -0.4578352 -0.4578325 [103] -0.4578298 -0.4578270 -0.4578241 -0.4578211 -0.4578181 -0.4578150 [109] -0.4578118 -0.4578086 -0.4578052 -0.4578018 -0.4577984 -0.4577948 [115] -0.4577912 -0.4577875 -0.4577837 -0.4577798 -0.4577759 -0.4577719 [121] -0.4577678 -0.4577636 -0.4577594 -0.4577551 -0.4577507 -0.4577462 [127] -0.4577417 -0.4577371 -0.4577324 -0.4577277 -0.4577228 -0.4577179 [133] -0.4577129 -0.4577079 -0.4577028 -0.4576975 -0.4576923 -0.4576869 [139] -0.4576815 -0.4576760 -0.4576704 -0.4576648 -0.4576591 -0.4576533 [145] -0.4576474 -0.4576415 -0.4576354 -0.4576293 -0.4576232 -0.4576170 [151] -0.4576106 -0.4576043 -0.4575978 -0.4575913 -0.4575847 -0.4575780 [157] -0.4575713 -0.4575644 -0.4575575 -0.4575506 -0.4575435 -0.4575364 [163] -0.4575292 -0.4575220 -0.4575147 -0.4575073 -0.4574998 -0.4574922 [169] -0.4574846 -0.4574769 -0.4574692 -0.4574613 -0.4574534 -0.4574454 [175] -0.4574374 -0.4574293 -0.4574211 -0.4574128 -0.4574045 -0.4573961 [181] -0.4573876 -0.4573790 -0.4573704 -0.4573617 -0.4573529 -0.4573441 [187] -0.4573352 -0.4573262 -0.4573172 -0.4573080 -0.4572989 -0.4572896 [193] -0.4572803 -0.4572709 -0.4572614 -0.4572518 -0.4572422 -0.4572325 [199] -0.4572228 -0.4572129 -0.4572030 -0.4571931 -0.4571830 -0.4571729 [205] -0.4571628 -0.4571525 -0.4571422 -0.4571318 -0.4571213 -0.4571108 [211] -0.4571002 -0.4570895 -0.4570788 -0.4570680 -0.4570571 -0.4570462 [217] -0.4570352 -0.4570241 -0.4570129 -0.4570017 -0.4569904 -0.4569791 [223] -0.4569676 -0.4569561 -0.4569446 -0.4569329 -0.4569212 -0.4569095 [229] -0.4568976 -0.4568857 -0.4568737 -0.4568617 -0.4568496 -0.4568374 [235] -0.4568252 -0.4568128 -0.4568005 -0.4567880 -0.4567755 -0.4567629 [241] -0.4567502 -0.4567375 -0.4567247 -0.4567119 -0.4566989 -0.4566860 [247] -0.4566729 -0.4566598 -0.4566466 -0.4566333 -0.4566200 -0.4566066 [253] -0.4565931 -0.4565796 -0.4565660 -0.4565523 -0.4565386 -0.4565248 [259] -0.4565110 -0.4564970 -0.4564830 -0.4564690 -0.4564549 -0.4564407 [265] -0.4564264 -0.4564121 -0.4563977 -0.4563832 -0.4563687 -0.4563541 [271] -0.4563395 -0.4563248 -0.4563100 -0.4562951 -0.4562802 -0.4562652 [277] -0.4562502 -0.4562351 -0.4562199 -0.4562047 -0.4561894 -0.4561740 [283] -0.4561586 -0.4561431 -0.4561275 -0.4561119 -0.4560962 -0.4560804 [289] -0.4560646 -0.4560487 -0.4560328 -0.4560167 -0.4560007 -0.4559845 [295] -0.4559683 -0.4559521 -0.4559357 -0.4559193 -0.4559029 -0.4558863 [301] -0.4558698 -0.4558531 -0.4558364 -0.4558196 -0.4558028 -0.4557859 [307] -0.4557689 -0.4557519 -0.4557348 -0.4557176 -0.4557004 -0.4556831 [313] -0.4556658 -0.4556484 -0.4556309 -0.4556134 -0.4555958 -0.4555781 [319] -0.4555604 -0.4555427 -0.4555248 -0.4555069 -0.4554889 -0.4554709 [325] -0.4554528 -0.4554347 -0.4554165 -0.4553982 -0.4553799 -0.4553615 [331] -0.4553430 -0.4553245 -0.4553059 -0.4552873 -0.4552686 -0.4552498 [337] -0.4552310 -0.4552121 -0.4551932 -0.4551742 -0.4551551 -0.4551360 [343] -0.4551168 -0.4550976 -0.4550783 -0.4550589 -0.4550395 -0.4550200 [349] -0.4550004 -0.4549808 -0.4549612 -0.4549414 -0.4549217 -0.4549018 [355] -0.4548819 -0.4548619 -0.4548419 -0.4548218 -0.4548017 -0.4547815 [361] -0.4547612 -0.4547409 -0.4547206 -0.4547001 -0.4546796 -0.4546591 [367] -0.4546385 -0.4546178 -0.4545971 -0.4545763 -0.4545554 -0.4545345 [373] -0.4545136 -0.4544926 -0.4544715 -0.4544503 -0.4544292 -0.4544079 [379] -0.4543866 -0.4543652 -0.4543438 -0.4543223 -0.4543008 -0.4542792 [385] -0.4542575 -0.4542358 -0.4542141 -0.4541922 -0.4541704 -0.4541484 [391] -0.4541264 -0.4541044 -0.4540823 -0.4540601 -0.4540379 -0.4540156 [397] -0.4539933 -0.4539709 -0.4539485 -0.4539260 -0.4539034 > 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/18y141257891938.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/23afg1257891938.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/3coeq1257891938.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/4mzpu1257891938.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/5iug91257891938.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/651yt1257891938.tab") > > system("convert tmp/18y141257891938.ps tmp/18y141257891938.png") > system("convert tmp/23afg1257891938.ps tmp/23afg1257891938.png") > system("convert tmp/3coeq1257891938.ps tmp/3coeq1257891938.png") > system("convert tmp/4mzpu1257891938.ps tmp/4mzpu1257891938.png") > system("convert tmp/5iug91257891938.ps tmp/5iug91257891938.png") > > > proc.time() user system elapsed 1.075 0.797 3.730