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(1.8,1.7,1.4,1.2,1,1.7,2.4,2,2.1,2,1.8,2.7,2.3,1.9,2,2.3,2.8,2.4,2.3,2.7,2.7,2.9,3,2.2,2.3,2.8,2.8,2.8,2.2,2.6,2.8,2.5,2.4,2.3,1.9,1.7,2,2.1,1.7,1.8,1.8,1.8,1.3,1.3,1.3,1.2,1.4,2.2,2.9,3.1,3.5,3.6,4.4,4.1,5.1,5.8,5.9,5.4,5.5,4.8,3.2) > #'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.3741608 0.3750656 0.3759730 0.3768829 0.3777953 0.3787103 0.3796278 [8] 0.3805478 0.3814703 0.3823952 0.3833226 0.3842524 0.3851845 0.3861191 [15] 0.3870561 0.3879954 0.3889370 0.3898809 0.3908271 0.3917756 0.3927263 [22] 0.3936793 0.3946344 0.3955918 0.3965513 0.3975129 0.3984767 0.3994425 [29] 0.4004105 0.4013804 0.4023524 0.4033264 0.4043023 0.4052802 0.4062601 [36] 0.4072418 0.4082253 0.4092108 0.4101980 0.4111870 0.4121778 0.4131703 [43] 0.4141645 0.4151604 0.4161580 0.4171571 0.4181579 0.4191602 0.4201640 [50] 0.4211693 0.4221761 0.4231843 0.4241940 0.4252050 0.4262173 0.4272309 [57] 0.4282458 0.4292620 0.4302793 0.4312979 0.4323175 0.4333383 0.4343601 [64] 0.4353830 0.4364068 0.4374316 0.4384574 0.4394840 0.4405115 0.4415398 [71] 0.4425688 0.4435986 0.4446291 0.4456603 0.4466921 0.4477244 0.4487573 [78] 0.4497907 0.4508246 0.4518589 0.4528936 0.4539286 0.4549640 0.4559995 [85] 0.4570353 0.4580713 0.4591075 0.4601437 0.4611799 0.4622162 0.4632524 [92] 0.4642886 0.4653246 0.4663605 0.4673961 0.4684315 0.4694667 0.4705014 [99] 0.4715358 0.4725697 0.4736032 0.4746361 0.4756685 0.4767003 0.4777314 [106] 0.4787618 0.4797914 0.4808202 0.4818482 0.4828753 0.4839015 0.4849267 [113] 0.4859508 0.4869739 0.4879958 0.4890166 0.4900362 0.4910544 0.4920714 [120] 0.4930870 0.4941012 0.4951139 0.4961251 0.4971348 0.4981429 0.4991493 [127] 0.5001540 0.5011570 0.5021581 0.5031575 0.5041549 0.5051504 0.5061439 [134] 0.5071354 0.5081248 0.5091121 0.5100972 0.5110800 0.5120606 0.5130389 [141] 0.5140148 0.5149883 0.5159593 0.5169278 0.5178938 0.5188571 0.5198178 [148] 0.5207758 0.5217311 0.5226836 0.5236332 0.5245800 0.5255238 0.5264646 [155] 0.5274025 0.5283372 0.5292689 0.5301974 0.5311227 0.5320448 0.5329635 [162] 0.5338790 0.5347910 0.5356997 0.5366048 0.5375065 0.5384046 0.5392992 [169] 0.5401901 0.5410773 0.5419608 0.5428406 0.5437166 0.5445887 0.5454569 [176] 0.5463213 0.5471817 0.5480380 0.5488904 0.5497387 0.5505829 0.5514229 [183] 0.5522587 0.5530903 0.5539177 0.5547408 0.5555595 0.5563739 0.5571839 [190] 0.5579894 0.5587905 0.5595871 0.5603792 0.5611666 0.5619495 0.5627278 [197] 0.5635014 0.5642704 0.5650346 0.5657940 0.5665487 0.5672986 0.5680437 [204] 0.5687839 0.5695192 0.5702496 0.5709750 0.5716955 0.5724110 0.5731215 [211] 0.5738269 0.5745273 0.5752226 0.5759128 0.5765979 0.5772778 0.5779526 [218] 0.5786221 0.5792865 0.5799456 0.5805995 0.5812481 0.5818915 0.5825295 [225] 0.5831623 0.5837897 0.5844117 0.5850284 0.5856397 0.5862457 0.5868462 [232] 0.5874413 0.5880310 0.5886153 0.5891941 0.5897675 0.5903354 0.5908978 [239] 0.5914548 0.5920062 0.5925522 0.5930927 0.5936276 0.5941570 0.5946809 [246] 0.5951993 0.5957122 0.5962195 0.5967213 0.5972175 0.5977082 0.5981934 [253] 0.5986730 0.5991471 0.5996156 0.6000786 0.6005361 0.6009880 0.6014343 [260] 0.6018752 0.6023105 0.6027402 0.6031645 0.6035832 0.6039964 0.6044042 [267] 0.6048064 0.6052031 0.6055943 0.6059801 0.6063603 0.6067351 0.6071045 [274] 0.6074684 0.6078269 0.6081799 0.6085275 0.6088697 0.6092066 0.6095380 [281] 0.6098641 0.6101848 0.6105002 0.6108102 0.6111150 0.6114144 0.6117085 [288] 0.6119974 0.6122810 0.6125594 0.6128326 0.6131005 0.6133632 0.6136208 [295] 0.6138732 0.6141205 0.6143627 0.6145997 0.6148317 0.6150586 0.6152805 [302] 0.6154973 0.6157091 0.6159160 0.6161179 0.6163148 0.6165068 0.6166939 [309] 0.6168762 0.6170535 0.6172261 0.6173938 0.6175567 0.6177149 0.6178683 [316] 0.6180170 0.6181610 0.6183003 0.6184350 0.6185650 0.6186905 0.6188113 [323] 0.6189276 0.6190394 0.6191467 0.6192494 0.6193478 0.6194417 0.6195312 [330] 0.6196163 0.6196971 0.6197735 0.6198457 0.6199135 0.6199771 0.6200365 [337] 0.6200917 0.6201428 0.6201897 0.6202324 0.6202711 0.6203058 0.6203364 [344] 0.6203629 0.6203855 0.6204042 0.6204189 0.6204297 0.6204367 0.6204398 [351] 0.6204391 0.6204346 0.6204264 0.6204144 0.6203987 0.6203793 0.6203563 [358] 0.6203297 0.6202994 0.6202656 0.6202283 0.6201874 0.6201431 0.6200953 [365] 0.6200440 0.6199894 0.6199314 0.6198700 0.6198054 0.6197374 0.6196662 [372] 0.6195917 0.6195140 0.6194332 0.6193492 0.6192620 0.6191718 0.6190785 [379] 0.6189821 0.6188827 0.6187804 0.6186750 0.6185667 0.6184556 0.6183415 [386] 0.6182246 0.6181048 0.6179822 0.6178569 0.6177288 0.6175980 0.6174645 [393] 0.6173283 0.6171894 0.6170480 0.6169039 0.6167573 0.6166081 0.6164564 [400] 0.6163022 0.6161455 > mx [1] 0.6204398 > mxli [1] 1.49 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1eh001293271374.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/www/html/rcomp/tmp/2eh001293271374.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/www/html/rcomp/tmp/3oqil1293271374.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/www/html/rcomp/tmp/4oqil1293271374.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/www/html/rcomp/tmp/5oqil1293271374.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/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/69ryr1293271374.tab") > > try(system("convert tmp/1eh001293271374.ps tmp/1eh001293271374.png",intern=TRUE)) character(0) > try(system("convert tmp/2eh001293271374.ps tmp/2eh001293271374.png",intern=TRUE)) character(0) > try(system("convert tmp/3oqil1293271374.ps tmp/3oqil1293271374.png",intern=TRUE)) character(0) > try(system("convert tmp/4oqil1293271374.ps tmp/4oqil1293271374.png",intern=TRUE)) character(0) > try(system("convert tmp/5oqil1293271374.ps tmp/5oqil1293271374.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.094 0.815 4.394