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(109.7,99.1,86.7,111.4,78.4,76.7,114.2,99.7,94.2,173.5,83.1,88.9,132.0,122.1,105.1,133.7,63.6,112.7,120.5,112.0,126.2,209.2,91.0,116.7,137.6,108.1,136.6,152.3,114.3,120.7,131.8,129.4,187.5,189.5,109.2,158.1,176.2,125.5,155.0,170.3,99.4,139.2,169.6,136.1,168.2,318.6,154.1,161.4,183.4,166.3,203,174.6,124.3,154.4,170.5,169.4,171.1,289.2,145.6,134.4,168.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.5908927 0.5914567 0.5920180 0.5925766 0.5931325 0.5936857 0.5942363 [8] 0.5947841 0.5953291 0.5958714 0.5964109 0.5969475 0.5974814 0.5980125 [15] 0.5985406 0.5990660 0.5995884 0.6001079 0.6006245 0.6011382 0.6016489 [22] 0.6021567 0.6026614 0.6031632 0.6036619 0.6041576 0.6046502 0.6051398 [29] 0.6056263 0.6061096 0.6065899 0.6070670 0.6075409 0.6080117 0.6084793 [36] 0.6089437 0.6094048 0.6098627 0.6103174 0.6107688 0.6112169 0.6116616 [43] 0.6121031 0.6125412 0.6129760 0.6134074 0.6138354 0.6142599 0.6146811 [50] 0.6150988 0.6155131 0.6159239 0.6163312 0.6167350 0.6171353 0.6175320 [57] 0.6179252 0.6183148 0.6187008 0.6190833 0.6194621 0.6198372 0.6202087 [64] 0.6205766 0.6209407 0.6213012 0.6216579 0.6220109 0.6223602 0.6227057 [71] 0.6230474 0.6233853 0.6237194 0.6240497 0.6243761 0.6246987 0.6250174 [78] 0.6253322 0.6256431 0.6259500 0.6262531 0.6265521 0.6268472 0.6271384 [85] 0.6274255 0.6277086 0.6279876 0.6282627 0.6285336 0.6288005 0.6290633 [92] 0.6293220 0.6295765 0.6298269 0.6300732 0.6303153 0.6305532 0.6307869 [99] 0.6310164 0.6312417 0.6314627 0.6316795 0.6318920 0.6321002 0.6323041 [106] 0.6325037 0.6326989 0.6328898 0.6330764 0.6332586 0.6334363 0.6336097 [113] 0.6337787 0.6339432 0.6341033 0.6342590 0.6344101 0.6345568 0.6346990 [120] 0.6348366 0.6349697 0.6350983 0.6352224 0.6353418 0.6354567 0.6355670 [127] 0.6356727 0.6357737 0.6358701 0.6359619 0.6360490 0.6361315 0.6362092 [134] 0.6362823 0.6363506 0.6364142 0.6364731 0.6365272 0.6365766 0.6366212 [141] 0.6366610 0.6366960 0.6367262 0.6367516 0.6367721 0.6367878 0.6367987 [148] 0.6368046 0.6368057 0.6368019 0.6367933 0.6367796 0.6367611 0.6367377 [155] 0.6367092 0.6366759 0.6366376 0.6365943 0.6365460 0.6364927 0.6364344 [162] 0.6363711 0.6363027 0.6362294 0.6361510 0.6360675 0.6359790 0.6358854 [169] 0.6357867 0.6356829 0.6355740 0.6354601 0.6353410 0.6352168 0.6350874 [176] 0.6349529 0.6348133 0.6346685 0.6345186 0.6343635 0.6342032 0.6340377 [183] 0.6338670 0.6336912 0.6335101 0.6333239 0.6331324 0.6329357 0.6327338 [190] 0.6325266 0.6323142 0.6320966 0.6318737 0.6316456 0.6314122 0.6311735 [197] 0.6309296 0.6306805 0.6304260 0.6301663 0.6299013 0.6296310 0.6293554 [204] 0.6290746 0.6287884 0.6284970 0.6282003 0.6278983 0.6275910 0.6272783 [211] 0.6269604 0.6266372 0.6263087 0.6259749 0.6256358 0.6252914 0.6249416 [218] 0.6245866 0.6242263 0.6238607 0.6234898 0.6231136 0.6227321 0.6223453 [225] 0.6219533 0.6215559 0.6211533 0.6207454 0.6203322 0.6199137 0.6194900 [232] 0.6190610 0.6186268 0.6181873 0.6177426 0.6172926 0.6168373 0.6163769 [239] 0.6159112 0.6154403 0.6149642 0.6144829 0.6139964 0.6135047 0.6130079 [246] 0.6125058 0.6119986 0.6114863 0.6109688 0.6104461 0.6099184 0.6093855 [253] 0.6088475 0.6083045 0.6077563 0.6072031 0.6066449 0.6060816 0.6055132 [260] 0.6049398 0.6043615 0.6037781 0.6031898 0.6025965 0.6019982 0.6013950 [267] 0.6007869 0.6001739 0.5995560 0.5989332 0.5983056 0.5976731 0.5970358 [274] 0.5963937 0.5957468 0.5950952 0.5944388 0.5937777 0.5931118 0.5924413 [281] 0.5917661 0.5910862 0.5904017 0.5897126 0.5890189 0.5883206 0.5876178 [288] 0.5869104 0.5861986 0.5854822 0.5847614 0.5840362 0.5833066 0.5825725 [295] 0.5818342 0.5810914 0.5803444 0.5795930 0.5788375 0.5780776 0.5773136 [302] 0.5765453 0.5757730 0.5749964 0.5742158 0.5734311 0.5726424 0.5718496 [309] 0.5710528 0.5702521 0.5694474 0.5686389 0.5678264 0.5670101 0.5661900 [316] 0.5653661 0.5645385 0.5637071 0.5628721 0.5620333 0.5611910 0.5603450 [323] 0.5594955 0.5586425 0.5577859 0.5569259 0.5560624 0.5551956 0.5543253 [330] 0.5534518 0.5525749 0.5516948 0.5508114 0.5499249 0.5490352 0.5481423 [337] 0.5472464 0.5463474 0.5454454 0.5445404 0.5436324 0.5427216 0.5418078 [344] 0.5408912 0.5399718 0.5390497 0.5381248 0.5371972 0.5362670 0.5353342 [351] 0.5343987 0.5334608 0.5325203 0.5315773 0.5306319 0.5296842 0.5287341 [358] 0.5277816 0.5268269 0.5258699 0.5249108 0.5239495 0.5229860 0.5220205 [365] 0.5210529 0.5200834 0.5191118 0.5181383 0.5171630 0.5161858 0.5152067 [372] 0.5142259 0.5132434 0.5122592 0.5112733 0.5102858 0.5092968 0.5083062 [379] 0.5073141 0.5063205 0.5053255 0.5043292 0.5033315 0.5023325 0.5013322 [386] 0.5003307 0.4993280 0.4983242 0.4973193 0.4963133 0.4953063 0.4942983 [393] 0.4932893 0.4922794 0.4912687 0.4902571 0.4892447 0.4882316 0.4872177 [400] 0.4862031 0.4851879 > mx [1] 0.6368057 > mxli [1] -0.52 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/12dhk1257456274.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/2w9f91257456274.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/3vi4t1257456274.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/49p7u1257456274.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/5ra1d1257456274.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/6q3ti1257456274.tab") > system("convert tmp/12dhk1257456274.ps tmp/12dhk1257456274.png") > system("convert tmp/2w9f91257456274.ps tmp/2w9f91257456274.png") > system("convert tmp/3vi4t1257456274.ps tmp/3vi4t1257456274.png") > system("convert tmp/49p7u1257456274.ps tmp/49p7u1257456274.png") > system("convert tmp/5ra1d1257456274.ps tmp/5ra1d1257456274.png") > > > proc.time() user system elapsed 1.060 0.781 2.722