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(15.5,15.1,11.7,16.3,16.7,15,14.9,14.6,15.3,17.9,16.4,15.4,17.9,15.9,13.9,17.8,17.9,17.4,16.7,16,16.6,19.1,17.8,17.2,18.6,16.3,15.1,19.2,17.7,19.1,18,17.5,17.8,21.1,17.2,19.4,19.8,17.6,16.2,19.5,19.9,20,17.3,18.9,18.6,21.4,18.6,19.8,20.8,19.6,17.7,19.8,22.2,20.7,17.9,20.9,21.2,21.4,23,21.3,23.9,22.4,18.3,22.8,22.3,17.8,16.4,16,16.4,17.7,16.6,16.2,18.3) > #'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.5327153 0.5327791 0.5328422 0.5329044 0.5329658 0.5330263 0.5330860 [8] 0.5331449 0.5332029 0.5332602 0.5333165 0.5333721 0.5334268 0.5334807 [15] 0.5335338 0.5335861 0.5336375 0.5336881 0.5337379 0.5337869 0.5338351 [22] 0.5338824 0.5339290 0.5339747 0.5340196 0.5340637 0.5341070 0.5341495 [29] 0.5341912 0.5342321 0.5342722 0.5343115 0.5343500 0.5343877 0.5344246 [36] 0.5344607 0.5344960 0.5345306 0.5345643 0.5345972 0.5346294 0.5346608 [43] 0.5346914 0.5347212 0.5347502 0.5347785 0.5348059 0.5348327 0.5348586 [50] 0.5348837 0.5349081 0.5349318 0.5349546 0.5349767 0.5349980 0.5350186 [57] 0.5350384 0.5350574 0.5350757 0.5350933 0.5351101 0.5351261 0.5351414 [64] 0.5351559 0.5351697 0.5351827 0.5351950 0.5352066 0.5352174 0.5352275 [71] 0.5352368 0.5352455 0.5352533 0.5352605 0.5352669 0.5352726 0.5352776 [78] 0.5352818 0.5352854 0.5352882 0.5352903 0.5352916 0.5352923 0.5352922 [85] 0.5352915 0.5352900 0.5352878 0.5352849 0.5352814 0.5352771 0.5352721 [92] 0.5352664 0.5352600 0.5352530 0.5352452 0.5352367 0.5352276 0.5352178 [99] 0.5352073 0.5351961 0.5351842 0.5351717 0.5351584 0.5351445 0.5351300 [106] 0.5351147 0.5350988 0.5350822 0.5350650 0.5350471 0.5350285 0.5350093 [113] 0.5349894 0.5349689 0.5349477 0.5349259 0.5349034 0.5348802 0.5348564 [120] 0.5348320 0.5348069 0.5347812 0.5347549 0.5347279 0.5347003 0.5346721 [127] 0.5346432 0.5346137 0.5345836 0.5345528 0.5345214 0.5344894 0.5344568 [134] 0.5344236 0.5343898 0.5343553 0.5343203 0.5342846 0.5342483 0.5342114 [141] 0.5341740 0.5341359 0.5340972 0.5340579 0.5340181 0.5339776 0.5339365 [148] 0.5338949 0.5338527 0.5338099 0.5337665 0.5337225 0.5336780 0.5336329 [155] 0.5335872 0.5335409 0.5334941 0.5334466 0.5333987 0.5333501 0.5333010 [162] 0.5332514 0.5332012 0.5331504 0.5330991 0.5330472 0.5329947 0.5329418 [169] 0.5328882 0.5328342 0.5327796 0.5327244 0.5326687 0.5326125 0.5325557 [176] 0.5324984 0.5324406 0.5323823 0.5323234 0.5322640 0.5322040 0.5321436 [183] 0.5320826 0.5320211 0.5319592 0.5318966 0.5318336 0.5317701 0.5317060 [190] 0.5316415 0.5315765 0.5315109 0.5314449 0.5313783 0.5313113 0.5312437 [197] 0.5311757 0.5311072 0.5310382 0.5309687 0.5308987 0.5308283 0.5307574 [204] 0.5306859 0.5306141 0.5305417 0.5304689 0.5303956 0.5303218 0.5302475 [211] 0.5301728 0.5300977 0.5300220 0.5299459 0.5298694 0.5297924 0.5297149 [218] 0.5296370 0.5295587 0.5294799 0.5294006 0.5293209 0.5292408 0.5291602 [225] 0.5290792 0.5289977 0.5289158 0.5288335 0.5287508 0.5286676 0.5285840 [232] 0.5284999 0.5284155 0.5283306 0.5282453 0.5281596 0.5280734 0.5279869 [239] 0.5278999 0.5278125 0.5277247 0.5276365 0.5275479 0.5274589 0.5273695 [246] 0.5272797 0.5271895 0.5270989 0.5270079 0.5269165 0.5268247 0.5267326 [253] 0.5266400 0.5265470 0.5264537 0.5263600 0.5262659 0.5261714 0.5260766 [260] 0.5259813 0.5258857 0.5257897 0.5256934 0.5255967 0.5254996 0.5254021 [267] 0.5253043 0.5252061 0.5251076 0.5250087 0.5249094 0.5248098 0.5247098 [274] 0.5246095 0.5245088 0.5244078 0.5243064 0.5242047 0.5241027 0.5240003 [281] 0.5238975 0.5237944 0.5236910 0.5235873 0.5234832 0.5233788 0.5232740 [288] 0.5231689 0.5230635 0.5229578 0.5228517 0.5227453 0.5226386 0.5225316 [295] 0.5224242 0.5223166 0.5222086 0.5221003 0.5219917 0.5218828 0.5217735 [302] 0.5216640 0.5215542 0.5214440 0.5213336 0.5212228 0.5211118 0.5210004 [309] 0.5208888 0.5207769 0.5206646 0.5205521 0.5204393 0.5203262 0.5202128 [316] 0.5200991 0.5199851 0.5198709 0.5197563 0.5196415 0.5195264 0.5194111 [323] 0.5192954 0.5191795 0.5190633 0.5189468 0.5188301 0.5187131 0.5185958 [330] 0.5184783 0.5183605 0.5182424 0.5181241 0.5180055 0.5178866 0.5177675 [337] 0.5176482 0.5175285 0.5174087 0.5172885 0.5171682 0.5170475 0.5169266 [344] 0.5168055 0.5166842 0.5165625 0.5164407 0.5163186 0.5161963 0.5160737 [351] 0.5159509 0.5158278 0.5157045 0.5155810 0.5154573 0.5153333 0.5152091 [358] 0.5150846 0.5149600 0.5148351 0.5147099 0.5145846 0.5144590 0.5143332 [365] 0.5142072 0.5140810 0.5139546 0.5138279 0.5137010 0.5135740 0.5134467 [372] 0.5133192 0.5131914 0.5130635 0.5129354 0.5128070 0.5126785 0.5125498 [379] 0.5124208 0.5122917 0.5121623 0.5120328 0.5119030 0.5117731 0.5116429 [386] 0.5115126 0.5113821 0.5112513 0.5111204 0.5109893 0.5108580 0.5107266 [393] 0.5105949 0.5104631 0.5103310 0.5101988 0.5100664 0.5099338 0.5098011 [400] 0.5096682 0.5095350 > mx [1] 0.5352923 > mxli [1] -1.18 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1ud811261053500.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/2wywl1261053500.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/3o2cp1261053500.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/4ga4u1261053500.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/50lvt1261053500.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/659nw1261053500.tab") > > try(system("convert tmp/1ud811261053500.ps tmp/1ud811261053500.png",intern=TRUE)) character(0) > try(system("convert tmp/2wywl1261053500.ps tmp/2wywl1261053500.png",intern=TRUE)) character(0) > try(system("convert tmp/3o2cp1261053500.ps tmp/3o2cp1261053500.png",intern=TRUE)) character(0) > try(system("convert tmp/4ga4u1261053500.ps tmp/4ga4u1261053500.png",intern=TRUE)) character(0) > try(system("convert tmp/50lvt1261053500.ps tmp/50lvt1261053500.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.114 0.801 1.348