R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(98.6,98,106.8,96.6,100.1,107.7,91.5,97.8,107.4,117.5,105.6,97.4,99.5,98,104.3,100.6,101.1,103.9,96.9,95.5,108.4,117,103.8,100.8,110.6,104,112.6,107.3,98.9,109.8,104.9,102.2,123.9,124.9,112.7,121.9,100.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5,115.7,113.6,129.7,112,116.8,127,112.1,114.2,121.1,131.6,125,120.4,117.7) > #'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.6530728 0.6530450 0.6530171 0.6529890 0.6529608 0.6529323 0.6529038 [8] 0.6528750 0.6528461 0.6528171 0.6527878 0.6527585 0.6527289 0.6526992 [15] 0.6526693 0.6526393 0.6526091 0.6525787 0.6525482 0.6525175 0.6524867 [22] 0.6524557 0.6524245 0.6523932 0.6523617 0.6523300 0.6522982 0.6522662 [29] 0.6522341 0.6522018 0.6521693 0.6521367 0.6521039 0.6520710 0.6520378 [36] 0.6520046 0.6519711 0.6519376 0.6519038 0.6518699 0.6518358 0.6518016 [43] 0.6517672 0.6517326 0.6516979 0.6516630 0.6516280 0.6515928 0.6515574 [50] 0.6515219 0.6514862 0.6514504 0.6514144 0.6513782 0.6513419 0.6513054 [57] 0.6512688 0.6512320 0.6511950 0.6511579 0.6511206 0.6510832 0.6510456 [64] 0.6510079 0.6509699 0.6509319 0.6508936 0.6508552 0.6508167 0.6507780 [71] 0.6507391 0.6507001 0.6506609 0.6506216 0.6505821 0.6505424 0.6505026 [78] 0.6504626 0.6504225 0.6503822 0.6503417 0.6503011 0.6502604 0.6502194 [85] 0.6501783 0.6501371 0.6500957 0.6500542 0.6500124 0.6499706 0.6499285 [92] 0.6498864 0.6498440 0.6498015 0.6497589 0.6497161 0.6496731 0.6496300 [99] 0.6495867 0.6495432 0.6494996 0.6494559 0.6494120 0.6493679 0.6493237 [106] 0.6492793 0.6492348 0.6491901 0.6491453 0.6491003 0.6490551 0.6490098 [113] 0.6489643 0.6489187 0.6488730 0.6488270 0.6487809 0.6487347 0.6486883 [120] 0.6486418 0.6485951 0.6485482 0.6485012 0.6484540 0.6484067 0.6483592 [127] 0.6483116 0.6482638 0.6482159 0.6481678 0.6481195 0.6480711 0.6480226 [134] 0.6479739 0.6479250 0.6478760 0.6478268 0.6477775 0.6477280 0.6476784 [141] 0.6476286 0.6475787 0.6475286 0.6474784 0.6474280 0.6473775 0.6473268 [148] 0.6472759 0.6472249 0.6471738 0.6471225 0.6470710 0.6470194 0.6469677 [155] 0.6469158 0.6468637 0.6468115 0.6467592 0.6467066 0.6466540 0.6466012 [162] 0.6465482 0.6464951 0.6464418 0.6463884 0.6463349 0.6462811 0.6462273 [169] 0.6461733 0.6461191 0.6460648 0.6460103 0.6459557 0.6459010 0.6458460 [176] 0.6457910 0.6457358 0.6456804 0.6456249 0.6455693 0.6455134 0.6454575 [183] 0.6454014 0.6453451 0.6452887 0.6452322 0.6451755 0.6451187 0.6450617 [190] 0.6450045 0.6449473 0.6448898 0.6448322 0.6447745 0.6447166 0.6446586 [197] 0.6446005 0.6445421 0.6444837 0.6444251 0.6443663 0.6443074 0.6442484 [204] 0.6441892 0.6441298 0.6440704 0.6440107 0.6439510 0.6438910 0.6438310 [211] 0.6437708 0.6437104 0.6436499 0.6435893 0.6435285 0.6434675 0.6434065 [218] 0.6433452 0.6432839 0.6432224 0.6431607 0.6430989 0.6430370 0.6429749 [225] 0.6429126 0.6428503 0.6427877 0.6427251 0.6426623 0.6425993 0.6425362 [232] 0.6424730 0.6424096 0.6423461 0.6422825 0.6422187 0.6421547 0.6420906 [239] 0.6420264 0.6419620 0.6418975 0.6418329 0.6417681 0.6417031 0.6416381 [246] 0.6415729 0.6415075 0.6414420 0.6413764 0.6413106 0.6412447 0.6411786 [253] 0.6411124 0.6410461 0.6409796 0.6409130 0.6408462 0.6407793 0.6407123 [260] 0.6406451 0.6405778 0.6405103 0.6404428 0.6403750 0.6403072 0.6402392 [267] 0.6401710 0.6401027 0.6400343 0.6399658 0.6398971 0.6398282 0.6397593 [274] 0.6396901 0.6396209 0.6395515 0.6394820 0.6394123 0.6393426 0.6392726 [281] 0.6392026 0.6391324 0.6390620 0.6389916 0.6389210 0.6388502 0.6387793 [288] 0.6387083 0.6386372 0.6385659 0.6384945 0.6384229 0.6383512 0.6382794 [295] 0.6382075 0.6381354 0.6380631 0.6379908 0.6379183 0.6378457 0.6377729 [302] 0.6377000 0.6376270 0.6375538 0.6374805 0.6374071 0.6373336 0.6372599 [309] 0.6371861 0.6371121 0.6370380 0.6369638 0.6368895 0.6368150 0.6367404 [316] 0.6366656 0.6365908 0.6365157 0.6364406 0.6363653 0.6362899 0.6362144 [323] 0.6361388 0.6360630 0.6359871 0.6359110 0.6358348 0.6357585 0.6356821 [330] 0.6356055 0.6355288 0.6354520 0.6353751 0.6352980 0.6352208 0.6351435 [337] 0.6350660 0.6349884 0.6349107 0.6348328 0.6347549 0.6346768 0.6345985 [344] 0.6345202 0.6344417 0.6343631 0.6342843 0.6342055 0.6341265 0.6340474 [351] 0.6339681 0.6338888 0.6338093 0.6337296 0.6336499 0.6335700 0.6334900 [358] 0.6334099 0.6333297 0.6332493 0.6331688 0.6330882 0.6330075 0.6329266 [365] 0.6328456 0.6327645 0.6326833 0.6326019 0.6325204 0.6324388 0.6323571 [372] 0.6322752 0.6321933 0.6321112 0.6320290 0.6319466 0.6318641 0.6317816 [379] 0.6316989 0.6316160 0.6315331 0.6314500 0.6313668 0.6312835 0.6312001 [386] 0.6311165 0.6310329 0.6309491 0.6308652 0.6307811 0.6306970 0.6306127 [393] 0.6305283 0.6304438 0.6303592 0.6302744 0.6301896 0.6301046 0.6300195 [400] 0.6299343 0.6298489 > mx [1] 0.6530728 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/19rcq1226436641.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/freestat/rcomp/tmp/2ve4o1226436641.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/freestat/rcomp/tmp/3lxdy1226436641.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/freestat/rcomp/tmp/4w6hx1226436641.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/freestat/rcomp/tmp/5hmvq1226436641.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/6f42o1226436641.tab") > > system("convert tmp/19rcq1226436641.ps tmp/19rcq1226436641.png") > system("convert tmp/2ve4o1226436641.ps tmp/2ve4o1226436641.png") > system("convert tmp/3lxdy1226436641.ps tmp/3lxdy1226436641.png") > system("convert tmp/4w6hx1226436641.ps tmp/4w6hx1226436641.png") > system("convert tmp/5hmvq1226436641.ps tmp/5hmvq1226436641.png") > > > proc.time() user system elapsed 1.738 1.286 3.590