R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(72.50,59.40,85.70,88.20,62.80,87.00,79.20,112.00,79.20,132.10,40.10,69.00,59.40,73.80,57.40,81.10,46.60,41.40,71.20,67.90,72.00,145.50,39.70,51.90,73.70,70.90,60.80,61.00,54.50,39.10,66.60,58.50,59.80,80.90,37.30,44.60,48.70,54.00,49.50,61.60,35.00,35.70,51.30,49.00,41.50,72.50,42.10,44.10,45.10,50.30,40.90,47.20,36.90,40.90,38.30,46.30,28.40,78.40,36.80,50.70,42.80) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Normality Plot (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxnorm.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.5656786 -0.5659945 -0.5663086 -0.5666208 -0.5669311 -0.5672395 [7] -0.5675459 -0.5678504 -0.5681530 -0.5684536 -0.5687523 -0.5690490 [13] -0.5693437 -0.5696364 -0.5699271 -0.5702158 -0.5705024 -0.5707871 [19] -0.5710697 -0.5713502 -0.5716287 -0.5719051 -0.5721795 -0.5724517 [25] -0.5727218 -0.5729898 -0.5732557 -0.5735195 -0.5737811 -0.5740405 [31] -0.5742978 -0.5745529 -0.5748058 -0.5750565 -0.5753050 -0.5755513 [37] -0.5757954 -0.5760372 -0.5762767 -0.5765140 -0.5767491 -0.5769818 [43] -0.5772122 -0.5774403 -0.5776661 -0.5778896 -0.5781107 -0.5783295 [49] -0.5785459 -0.5787600 -0.5789716 -0.5791808 -0.5793877 -0.5795921 [55] -0.5797941 -0.5799936 -0.5801907 -0.5803853 -0.5805774 -0.5807670 [61] -0.5809541 -0.5811387 -0.5813208 -0.5815003 -0.5816773 -0.5818517 [67] -0.5820236 -0.5821928 -0.5823594 -0.5825235 -0.5826849 -0.5828436 [73] -0.5829997 -0.5831532 -0.5833040 -0.5834520 -0.5835974 -0.5837401 [79] -0.5838800 -0.5840172 -0.5841517 -0.5842833 -0.5844122 -0.5845383 [85] -0.5846616 -0.5847821 -0.5848998 -0.5850146 -0.5851266 -0.5852356 [91] -0.5853419 -0.5854452 -0.5855456 -0.5856430 -0.5857376 -0.5858292 [97] -0.5859178 -0.5860035 -0.5860861 -0.5861658 -0.5862424 -0.5863161 [103] -0.5863866 -0.5864541 -0.5865186 -0.5865800 -0.5866382 -0.5866934 [109] -0.5867454 -0.5867943 -0.5868400 -0.5868826 -0.5869220 -0.5869582 [115] -0.5869912 -0.5870210 -0.5870475 -0.5870708 -0.5870908 -0.5871075 [121] -0.5871210 -0.5871311 -0.5871380 -0.5871415 -0.5871416 -0.5871384 [127] -0.5871318 -0.5871218 -0.5871085 -0.5870917 -0.5870714 -0.5870478 [133] -0.5870206 -0.5869900 -0.5869560 -0.5869184 -0.5868773 -0.5868326 [139] -0.5867845 -0.5867327 -0.5866774 -0.5866186 -0.5865561 -0.5864900 [145] -0.5864203 -0.5863469 -0.5862699 -0.5861893 -0.5861049 -0.5860169 [151] -0.5859251 -0.5858297 -0.5857305 -0.5856275 -0.5855208 -0.5854103 [157] -0.5852961 -0.5851780 -0.5850561 -0.5849304 -0.5848008 -0.5846674 [163] -0.5845302 -0.5843890 -0.5842440 -0.5840951 -0.5839422 -0.5837854 [169] -0.5836247 -0.5834600 -0.5832914 -0.5831188 -0.5829421 -0.5827615 [175] -0.5825769 -0.5823882 -0.5821956 -0.5819988 -0.5817980 -0.5815931 [181] -0.5813842 -0.5811711 -0.5809540 -0.5807327 -0.5805073 -0.5802777 [187] -0.5800440 -0.5798062 -0.5795641 -0.5793179 -0.5790676 -0.5788130 [193] -0.5785542 -0.5782911 -0.5780239 -0.5777524 -0.5774767 -0.5771967 [199] -0.5769124 -0.5766239 -0.5763311 -0.5760340 -0.5757326 -0.5754268 [205] -0.5751168 -0.5748025 -0.5744838 -0.5741608 -0.5738334 -0.5735017 [211] -0.5731657 -0.5728253 -0.5724805 -0.5721313 -0.5717777 -0.5714198 [217] -0.5710575 -0.5706908 -0.5703196 -0.5699441 -0.5695642 -0.5691798 [223] -0.5687910 -0.5683978 -0.5680002 -0.5675982 -0.5671917 -0.5667808 [229] -0.5663654 -0.5659456 -0.5655214 -0.5650927 -0.5646596 -0.5642220 [235] -0.5637800 -0.5633335 -0.5628826 -0.5624273 -0.5619675 -0.5615032 [241] -0.5610345 -0.5605614 -0.5600838 -0.5596018 -0.5591153 -0.5586244 [247] -0.5581291 -0.5576293 -0.5571251 -0.5566165 -0.5561034 -0.5555860 [253] -0.5550641 -0.5545378 -0.5540071 -0.5534720 -0.5529326 -0.5523887 [259] -0.5518405 -0.5512879 -0.5507309 -0.5501695 -0.5496038 -0.5490338 [265] -0.5484594 -0.5478807 -0.5472977 -0.5467104 -0.5461188 -0.5455229 [271] -0.5449227 -0.5443182 -0.5437095 -0.5430965 -0.5424793 -0.5418579 [277] -0.5412323 -0.5406025 -0.5399684 -0.5393303 -0.5386879 -0.5380414 [283] -0.5373908 -0.5367361 -0.5360773 -0.5354144 -0.5347474 -0.5340763 [289] -0.5334013 -0.5327222 -0.5320391 -0.5313520 -0.5306609 -0.5299660 [295] -0.5292670 -0.5285642 -0.5278574 -0.5271468 -0.5264324 -0.5257141 [301] -0.5249919 -0.5242660 -0.5235363 -0.5228029 -0.5220657 -0.5213249 [307] -0.5205803 -0.5198321 -0.5190802 -0.5183247 -0.5175656 -0.5168030 [313] -0.5160368 -0.5152670 -0.5144938 -0.5137171 -0.5129370 -0.5121534 [319] -0.5113664 -0.5105761 -0.5097824 -0.5089854 -0.5081851 -0.5073816 [325] -0.5065748 -0.5057648 -0.5049516 -0.5041352 -0.5033158 -0.5024932 [331] -0.5016676 -0.5008389 -0.5000072 -0.4991725 -0.4983349 -0.4974944 [337] -0.4966510 -0.4958047 -0.4949556 -0.4941037 -0.4932490 -0.4923916 [343] -0.4915314 -0.4906686 -0.4898032 -0.4889351 -0.4880645 -0.4871914 [349] -0.4863157 -0.4854375 -0.4845569 -0.4836739 -0.4827885 -0.4819007 [355] -0.4810106 -0.4801183 -0.4792237 -0.4783269 -0.4774279 -0.4765267 [361] -0.4756235 -0.4747181 -0.4738108 -0.4729014 -0.4719900 -0.4710767 [367] -0.4701615 -0.4692444 -0.4683255 -0.4674048 -0.4664823 -0.4655581 [373] -0.4646322 -0.4637046 -0.4627754 -0.4618446 -0.4609123 -0.4599784 [379] -0.4590431 -0.4581063 -0.4571681 -0.4562285 -0.4552875 -0.4543453 [385] -0.4534017 -0.4524570 -0.4515110 -0.4505639 -0.4496156 -0.4486662 [391] -0.4477158 -0.4467643 -0.4458119 -0.4448584 -0.4439041 -0.4429489 [397] -0.4419928 -0.4410359 -0.4400782 -0.4391198 -0.4381606 > 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/1k81e1194302973.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/2rboj1194302973.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/312y41194302973.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/40qsl1194302973.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5t7gu1194302973.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > grid() > mtext('Transformed Data') > dev.off() null device 1 > 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/6ly821194302973.tab") > > system("convert tmp/1k81e1194302973.ps tmp/1k81e1194302973.png") > system("convert tmp/2rboj1194302973.ps tmp/2rboj1194302973.png") > system("convert tmp/312y41194302973.ps tmp/312y41194302973.png") > system("convert tmp/40qsl1194302973.ps tmp/40qsl1194302973.png") > system("convert tmp/5t7gu1194302973.ps tmp/5t7gu1194302973.png") > > > proc.time() user system elapsed 1.362 0.817 1.583