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(562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141,593408,590072,579799,574205,572775,572942,619567,625809,619916,587625,565742,557274,560576,548854,531673,525919,511038,498662,555362,564591,541657,527070,509846,514258,516922,507561,492622,490243,469357,477580,528379,533590,517945,506174,501866,516141) > #'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.6227076 -0.6226756 -0.6226171 -0.6225584 -0.6225056 -0.6224590 [7] -0.6223996 -0.6223505 -0.6222854 -0.6222412 -0.6221917 -0.6221364 [13] -0.6220842 -0.6220339 -0.6219798 -0.6219320 -0.6218738 -0.6218201 [19] -0.6217659 -0.6217142 -0.6216593 -0.6216072 -0.6215530 -0.6214979 [25] -0.6214443 -0.6213887 -0.6213346 -0.6212800 -0.6212249 -0.6211690 [31] -0.6211140 -0.6210587 -0.6210026 -0.6209468 -0.6208913 -0.6208348 [37] -0.6207788 -0.6207224 -0.6206657 -0.6206089 -0.6205521 -0.6204951 [43] -0.6204379 -0.6203806 -0.6203233 -0.6202657 -0.6202079 -0.6201499 [49] -0.6200920 -0.6200337 -0.6199754 -0.6199169 -0.6198582 -0.6197995 [55] -0.6197405 -0.6196815 -0.6196222 -0.6195629 -0.6195033 -0.6194436 [61] -0.6193838 -0.6193238 -0.6192637 -0.6192035 -0.6191431 -0.6190825 [67] -0.6190218 -0.6189609 -0.6188999 -0.6188388 -0.6187775 -0.6187160 [73] -0.6186545 -0.6185927 -0.6185308 -0.6184688 -0.6184066 -0.6183443 [79] -0.6182819 -0.6182192 -0.6181565 -0.6180936 -0.6180305 -0.6179673 [85] -0.6179040 -0.6178405 -0.6177769 -0.6177131 -0.6176492 -0.6175851 [91] -0.6175209 -0.6174566 -0.6173921 -0.6173274 -0.6172626 -0.6171977 [97] -0.6171326 -0.6170674 -0.6170020 -0.6169365 -0.6168709 -0.6168051 [103] -0.6167391 -0.6166731 -0.6166068 -0.6165405 -0.6164739 -0.6164073 [109] -0.6163405 -0.6162735 -0.6162065 -0.6161392 -0.6160719 -0.6160043 [115] -0.6159367 -0.6158689 -0.6158009 -0.6157329 -0.6156646 -0.6155963 [121] -0.6155277 -0.6154591 -0.6153903 -0.6153214 -0.6152523 -0.6151831 [127] -0.6151137 -0.6150442 -0.6149746 -0.6149048 -0.6148348 -0.6147648 [133] -0.6146946 -0.6146242 -0.6145537 -0.6144831 -0.6144123 -0.6143414 [139] -0.6142704 -0.6141992 -0.6141279 -0.6140564 -0.6139848 -0.6139130 [145] -0.6138411 -0.6137691 -0.6136969 -0.6136246 -0.6135522 -0.6134796 [151] -0.6134069 -0.6133340 -0.6132610 -0.6131879 -0.6131146 -0.6130412 [157] -0.6129676 -0.6128939 -0.6128201 -0.6127461 -0.6126720 -0.6125978 [163] -0.6125234 -0.6124489 -0.6123742 -0.6122994 -0.6122245 -0.6121494 [169] -0.6120742 -0.6119989 -0.6119234 -0.6118478 -0.6117721 -0.6116962 [175] -0.6116201 -0.6115440 -0.6114677 -0.6113913 -0.6113147 -0.6112380 [181] -0.6111611 -0.6110842 -0.6110071 -0.6109298 -0.6108524 -0.6107749 [187] -0.6106973 -0.6106195 -0.6105416 -0.6104635 -0.6103853 -0.6103070 [193] -0.6102285 -0.6101499 -0.6100712 -0.6099924 -0.6099134 -0.6098342 [199] -0.6097550 -0.6096756 -0.6095960 -0.6095164 -0.6094366 -0.6093567 [205] -0.6092766 -0.6091964 -0.6091161 -0.6090356 -0.6089550 -0.6088743 [211] -0.6087934 -0.6087125 -0.6086313 -0.6085501 -0.6084687 -0.6083872 [217] -0.6083055 -0.6082238 -0.6081419 -0.6080598 -0.6079776 -0.6078953 [223] -0.6078129 -0.6077303 -0.6076477 -0.6075648 -0.6074819 -0.6073988 [229] -0.6073156 -0.6072322 -0.6071488 -0.6070651 -0.6069814 -0.6068975 [235] -0.6068136 -0.6067294 -0.6066452 -0.6065608 -0.6064763 -0.6063917 [241] -0.6063069 -0.6062220 -0.6061370 -0.6060518 -0.6059665 -0.6058811 [247] -0.6057956 -0.6057099 -0.6056241 -0.6055382 -0.6054522 -0.6053660 [253] -0.6052797 -0.6051933 -0.6051067 -0.6050200 -0.6049332 -0.6048463 [259] -0.6047592 -0.6046720 -0.6045847 -0.6044973 -0.6044097 -0.6043220 [265] -0.6042342 -0.6041463 -0.6040582 -0.6039700 -0.6038817 -0.6037932 [271] -0.6037047 -0.6036160 -0.6035272 -0.6034382 -0.6033492 -0.6032600 [277] -0.6031706 -0.6030812 -0.6029916 -0.6029020 -0.6028121 -0.6027222 [283] -0.6026322 -0.6025420 -0.6024517 -0.6023612 -0.6022707 -0.6021800 [289] -0.6020892 -0.6019983 -0.6019073 -0.6018161 -0.6017248 -0.6016334 [295] -0.6015419 -0.6014502 -0.6013585 -0.6012666 -0.6011746 -0.6010824 [301] -0.6009902 -0.6008978 -0.6008053 -0.6007127 -0.6006199 -0.6005271 [307] -0.6004341 -0.6003410 -0.6002478 -0.6001544 -0.6000610 -0.5999674 [313] -0.5998737 -0.5997799 -0.5996859 -0.5995919 -0.5994977 -0.5994034 [319] -0.5993090 -0.5992145 -0.5991198 -0.5990250 -0.5989301 -0.5988351 [325] -0.5987400 -0.5986448 -0.5985494 -0.5984539 -0.5983583 -0.5982626 [331] -0.5981668 -0.5980709 -0.5979748 -0.5978786 -0.5977823 -0.5976859 [337] -0.5975894 -0.5974927 -0.5973960 -0.5972991 -0.5972021 -0.5971050 [343] -0.5970078 -0.5969104 -0.5968130 -0.5967154 -0.5966177 -0.5965199 [349] -0.5964220 -0.5963240 -0.5962259 -0.5961276 -0.5960292 -0.5959307 [355] -0.5958321 -0.5957334 -0.5956346 -0.5955357 -0.5954366 -0.5953374 [361] -0.5952382 -0.5951388 -0.5950393 -0.5949397 -0.5948399 -0.5947401 [367] -0.5946401 -0.5945401 -0.5944399 -0.5943396 -0.5942392 -0.5941387 [373] -0.5940380 -0.5939373 -0.5938365 -0.5937355 -0.5936344 -0.5935333 [379] -0.5934320 -0.5933306 -0.5932291 -0.5931274 -0.5930257 -0.5929239 [385] -0.5928219 -0.5927198 -0.5926177 -0.5925154 -0.5924130 -0.5923105 [391] -0.5922079 -0.5921052 -0.5920024 -0.5918994 -0.5917964 -0.5916932 [397] -0.5915900 -0.5914866 -0.5913832 -0.5912796 -0.5911759 > 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/1ghlq1257418620.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/2qva61257418620.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/3iym61257418620.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/437zl1257418620.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/5g7bq1257418620.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/6b9l81257418620.tab") > > system("convert tmp/1ghlq1257418620.ps tmp/1ghlq1257418620.png") > system("convert tmp/2qva61257418620.ps tmp/2qva61257418620.png") > system("convert tmp/3iym61257418620.ps tmp/3iym61257418620.png") > system("convert tmp/437zl1257418620.ps tmp/437zl1257418620.png") > system("convert tmp/5g7bq1257418620.ps tmp/5g7bq1257418620.png") > > > proc.time() user system elapsed 1.088 0.781 1.441