R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(4,4,6,8,8,4,4,8,5,4,4,4,4,4,4,8,4,4,4,8,4,7,4,4,5,4,4,4,4,4,4,4,15,10,4,8,4,4,4,4,7,4,6,5,4,16,5,12,6,9,9,4,5,4,4,5,4,4,4,5,4,6,4,4,18,4,6,4,4,5,4,4,5,10,5,8,8,5,4,4,4,5,4,4,8,4,5,14,8,8,4,4,6,4,7,7,4,6,4,7,4,4,8,4,4,10,8,6,4,4,4,5,4,6,4,5,7,8,5,8,10,8,5,12,4,5,4,6,4,4,7,7,10,4,5,8,11,7,4,8,6,7,5,4,8,4,8,6,4,9,5,6,4,4,4,5,6,16,6,6,4,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.17259002 0.17246330 0.17233609 0.17220840 0.17208023 0.17195157 [7] 0.17182242 0.17169279 0.17156266 0.17143204 0.17130092 0.17116930 [13] 0.17103719 0.17090458 0.17077146 0.17063784 0.17050372 0.17036909 [19] 0.17023395 0.17009829 0.16996213 0.16982545 0.16968826 0.16955054 [25] 0.16941231 0.16927356 0.16913428 0.16899448 0.16885415 0.16871329 [31] 0.16857190 0.16842998 0.16828752 0.16814453 0.16800100 0.16785693 [37] 0.16771232 0.16756717 0.16742147 0.16727522 0.16712843 0.16698108 [43] 0.16683318 0.16668473 0.16653572 0.16638615 0.16623602 0.16608533 [49] 0.16593408 0.16578226 0.16562987 0.16547691 0.16532338 0.16516928 [55] 0.16501460 0.16485934 0.16470351 0.16454709 0.16439009 0.16423251 [61] 0.16407434 0.16391558 0.16375623 0.16359628 0.16343574 0.16327461 [67] 0.16311288 0.16295054 0.16278761 0.16262407 0.16245992 0.16229517 [73] 0.16212980 0.16196383 0.16179723 0.16163003 0.16146220 0.16129376 [79] 0.16112469 0.16095500 0.16078469 0.16061375 0.16044217 0.16026997 [85] 0.16009713 0.15992366 0.15974955 0.15957480 0.15939941 0.15922338 [91] 0.15904670 0.15886938 0.15869140 0.15851278 0.15833350 0.15815357 [97] 0.15797299 0.15779174 0.15760984 0.15742727 0.15724404 0.15706014 [103] 0.15687558 0.15669034 0.15650444 0.15631786 0.15613061 0.15594268 [109] 0.15575407 0.15556478 0.15537481 0.15518416 0.15499282 0.15480079 [115] 0.15460807 0.15441466 0.15422056 0.15402577 0.15383027 0.15363408 [121] 0.15343720 0.15323961 0.15304131 0.15284231 0.15264261 0.15244220 [127] 0.15224108 0.15203924 0.15183670 0.15163344 0.15142946 0.15122477 [133] 0.15101936 0.15081323 0.15060638 0.15039880 0.15019050 0.14998147 [139] 0.14977172 0.14956123 0.14935002 0.14913807 0.14892540 0.14871198 [145] 0.14849784 0.14828295 0.14806733 0.14785097 0.14763387 0.14741603 [151] 0.14719744 0.14697811 0.14675804 0.14653722 0.14631566 0.14609334 [157] 0.14587028 0.14564647 0.14542191 0.14519660 0.14497053 0.14474372 [163] 0.14451615 0.14428782 0.14405874 0.14382891 0.14359831 0.14336697 [169] 0.14313486 0.14290200 0.14266838 0.14243400 0.14219886 0.14196296 [175] 0.14172630 0.14148889 0.14125071 0.14101177 0.14077208 0.14053162 [181] 0.14029040 0.14004842 0.13980568 0.13956218 0.13931792 0.13907290 [187] 0.13882712 0.13858059 0.13833329 0.13808523 0.13783642 0.13758685 [193] 0.13733652 0.13708544 0.13683360 0.13658101 0.13632766 0.13607356 [199] 0.13581870 0.13556310 0.13530674 0.13504964 0.13479179 0.13453319 [205] 0.13427384 0.13401375 0.13375292 0.13349135 0.13322903 0.13296598 [211] 0.13270220 0.13243767 0.13217242 0.13190643 0.13163971 0.13137227 [217] 0.13110410 0.13083521 0.13056560 0.13029527 0.13002422 0.12975246 [223] 0.12947998 0.12920680 0.12893291 0.12865832 0.12838303 0.12810704 [229] 0.12783036 0.12755298 0.12727492 0.12699616 0.12671673 0.12643662 [235] 0.12615583 0.12587437 0.12559224 0.12530945 0.12502600 0.12474188 [241] 0.12445712 0.12417170 0.12388564 0.12359894 0.12331160 0.12302363 [247] 0.12273503 0.12244580 0.12215595 0.12186549 0.12157442 0.12128275 [253] 0.12099047 0.12069760 0.12040413 0.12011008 0.11981545 0.11952025 [259] 0.11922447 0.11892813 0.11863123 0.11833378 0.11803578 0.11773724 [265] 0.11743816 0.11713855 0.11683841 0.11653776 0.11623660 0.11593493 [271] 0.11563276 0.11533009 0.11502694 0.11472331 0.11441921 0.11411464 [277] 0.11380961 0.11350413 0.11319820 0.11289183 0.11258502 0.11227780 [283] 0.11197015 0.11166210 0.11135364 0.11104479 0.11073554 0.11042592 [289] 0.11011592 0.10980556 0.10949484 0.10918377 0.10887236 0.10856062 [295] 0.10824855 0.10793616 0.10762347 0.10731047 0.10699718 0.10668360 [301] 0.10636975 0.10605563 0.10574125 0.10542662 0.10511175 0.10479665 [307] 0.10448132 0.10416578 0.10385003 0.10353408 0.10321794 0.10290162 [313] 0.10258513 0.10226848 0.10195168 0.10163473 0.10131765 0.10100044 [319] 0.10068312 0.10036569 0.10004816 0.09973055 0.09941285 0.09909509 [325] 0.09877727 0.09845939 0.09814148 0.09782353 0.09750556 0.09718758 [331] 0.09686960 0.09655162 0.09623367 0.09591573 0.09559783 0.09527998 [337] 0.09496219 0.09464445 0.09432679 0.09400922 0.09369174 0.09337436 [343] 0.09305710 0.09273996 0.09242295 0.09210608 0.09178936 0.09147281 [349] 0.09115643 0.09084022 0.09052421 0.09020840 0.08989279 0.08957741 [355] 0.08926225 0.08894733 0.08863266 0.08831825 0.08800410 0.08769023 [361] 0.08737664 0.08706335 0.08675036 0.08643768 0.08612532 0.08581330 [367] 0.08550162 0.08519029 0.08487931 0.08456871 0.08425848 0.08394864 [373] 0.08363919 0.08333015 0.08302151 0.08271330 0.08240552 0.08209818 [379] 0.08179129 0.08148485 0.08117887 0.08087337 0.08056835 0.08026382 [385] 0.07995979 0.07965626 0.07935325 0.07905076 0.07874880 0.07844738 [391] 0.07814650 0.07784618 0.07754642 0.07724722 0.07694861 0.07665058 [397] 0.07635314 0.07605630 0.07576006 0.07546444 0.07516944 > mx [1] 0.17259 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/wessaorg/rcomp/tmp/14wpp1321808530.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/2m1h11321808530.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/3ot441321808530.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/4axw11321808530.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/5xr601321808530.ps",horizontal=F,onefile=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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/60zrw1321808530.tab") > > try(system("convert tmp/14wpp1321808530.ps tmp/14wpp1321808530.png",intern=TRUE)) character(0) > try(system("convert tmp/2m1h11321808530.ps tmp/2m1h11321808530.png",intern=TRUE)) character(0) > try(system("convert tmp/3ot441321808530.ps tmp/3ot441321808530.png",intern=TRUE)) character(0) > try(system("convert tmp/4axw11321808530.ps tmp/4axw11321808530.png",intern=TRUE)) character(0) > try(system("convert tmp/5xr601321808530.ps tmp/5xr601321808530.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.450 0.257 1.723