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(128.7,136.9,156.9,109.1,122.3,123.9,90.9,77.9,120.3,118.9,125.5,98.9,102.9,105.9,117.6,113.6,115.9,118.9,77.6,81.2,123.1,136.6,112.1,95.1,96.3,105.7,115.8,105.7,105.7,111.1,82.4,60,107.3,99.3,113.5,108.9,100.2,103.9,138.7,120.2,100.2,143.2,70.9,85.2,133,136.6,117.9,106.3,122.3,125.5,148.4,126.3,99.6,140.4,80.3,92.6,138.5,110.9,119.6,105) > #'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.03532982 -0.03536611 -0.03540237 -0.03543859 -0.03547476 -0.03551089 [7] -0.03554698 -0.03558303 -0.03561904 -0.03565500 -0.03569092 -0.03572679 [13] -0.03576263 -0.03579841 -0.03583416 -0.03586985 -0.03590551 -0.03594111 [19] -0.03597667 -0.03601219 -0.03604765 -0.03608307 -0.03611845 -0.03615377 [25] -0.03618905 -0.03622428 -0.03625946 -0.03629459 -0.03632967 -0.03636470 [31] -0.03639968 -0.03643461 -0.03646949 -0.03650432 -0.03653910 -0.03657383 [37] -0.03660850 -0.03664312 -0.03667769 -0.03671221 -0.03674667 -0.03678108 [43] -0.03681544 -0.03684974 -0.03688399 -0.03691818 -0.03695232 -0.03698640 [49] -0.03702043 -0.03705440 -0.03708832 -0.03712218 -0.03715598 -0.03718973 [55] -0.03722342 -0.03725705 -0.03729062 -0.03732414 -0.03735759 -0.03739099 [61] -0.03742433 -0.03745761 -0.03749083 -0.03752400 -0.03755710 -0.03759014 [67] -0.03762312 -0.03765604 -0.03768891 -0.03772170 -0.03775444 -0.03778712 [73] -0.03781973 -0.03785229 -0.03788478 -0.03791721 -0.03794957 -0.03798188 [79] -0.03801412 -0.03804629 -0.03807841 -0.03811046 -0.03814244 -0.03817436 [85] -0.03820622 -0.03823801 -0.03826974 -0.03830140 -0.03833300 -0.03836453 [91] -0.03839600 -0.03842740 -0.03845874 -0.03849000 -0.03852121 -0.03855234 [97] -0.03858341 -0.03861442 -0.03864535 -0.03867622 -0.03870702 -0.03873776 [103] -0.03876842 -0.03879902 -0.03882955 -0.03886002 -0.03889041 -0.03892074 [109] -0.03895100 -0.03898119 -0.03901131 -0.03904136 -0.03907134 -0.03910125 [115] -0.03913110 -0.03916087 -0.03919057 -0.03922021 -0.03924978 -0.03927927 [121] -0.03930870 -0.03933805 -0.03936734 -0.03939655 -0.03942569 -0.03945477 [127] -0.03948377 -0.03951270 -0.03954156 -0.03957035 -0.03959907 -0.03962772 [133] -0.03965630 -0.03968480 -0.03971324 -0.03974160 -0.03976989 -0.03979811 [139] -0.03982626 -0.03985434 -0.03988234 -0.03991027 -0.03993813 -0.03996592 [145] -0.03999364 -0.04002129 -0.04004886 -0.04007636 -0.04010379 -0.04013114 [151] -0.04015843 -0.04018564 -0.04021278 -0.04023985 -0.04026684 -0.04029377 [157] -0.04032062 -0.04034740 -0.04037410 -0.04040073 -0.04042730 -0.04045378 [163] -0.04048020 -0.04050654 -0.04053282 -0.04055901 -0.04058514 -0.04061120 [169] -0.04063718 -0.04066309 -0.04068892 -0.04071469 -0.04074038 -0.04076600 [175] -0.04079155 -0.04081702 -0.04084243 -0.04086776 -0.04089302 -0.04091821 [181] -0.04094332 -0.04096837 -0.04099334 -0.04101824 -0.04104307 -0.04106782 [187] -0.04109251 -0.04111712 -0.04114166 -0.04116613 -0.04119053 -0.04121486 [193] -0.04123911 -0.04126330 -0.04128741 -0.04131145 -0.04133542 -0.04135932 [199] -0.04138315 -0.04140691 -0.04143060 -0.04145422 -0.04147777 -0.04150125 [205] -0.04152465 -0.04154799 -0.04157126 -0.04159446 -0.04161759 -0.04164064 [211] -0.04166363 -0.04168655 -0.04170940 -0.04173218 -0.04175490 -0.04177754 [217] -0.04180011 -0.04182262 -0.04184506 -0.04186743 -0.04188973 -0.04191196 [223] -0.04193413 -0.04195623 -0.04197826 -0.04200022 -0.04202211 -0.04204394 [229] -0.04206570 -0.04208740 -0.04210903 -0.04213059 -0.04215208 -0.04217351 [235] -0.04219488 -0.04221617 -0.04223741 -0.04225857 -0.04227967 -0.04230071 [241] -0.04232168 -0.04234259 -0.04236343 -0.04238421 -0.04240492 -0.04242557 [247] -0.04244616 -0.04246669 -0.04248715 -0.04250754 -0.04252788 -0.04254815 [253] -0.04256836 -0.04258850 -0.04260859 -0.04262861 -0.04264857 -0.04266848 [259] -0.04268831 -0.04270809 -0.04272781 -0.04274747 -0.04276707 -0.04278660 [265] -0.04280608 -0.04282550 -0.04284486 -0.04286416 -0.04288340 -0.04290258 [271] -0.04292171 -0.04294077 -0.04295978 -0.04297873 -0.04299763 -0.04301646 [277] -0.04303524 -0.04305397 -0.04307264 -0.04309125 -0.04310980 -0.04312830 [283] -0.04314675 -0.04316514 -0.04318348 -0.04320176 -0.04321999 -0.04323816 [289] -0.04325628 -0.04327435 -0.04329236 -0.04331032 -0.04332823 -0.04334609 [295] -0.04336389 -0.04338165 -0.04339935 -0.04341700 -0.04343460 -0.04345215 [301] -0.04346965 -0.04348710 -0.04350450 -0.04352186 -0.04353916 -0.04355642 [307] -0.04357362 -0.04359078 -0.04360789 -0.04362495 -0.04364197 -0.04365894 [313] -0.04367587 -0.04369274 -0.04370957 -0.04372636 -0.04374310 -0.04375980 [319] -0.04377645 -0.04379306 -0.04380962 -0.04382614 -0.04384262 -0.04385905 [325] -0.04387545 -0.04389180 -0.04390810 -0.04392437 -0.04394060 -0.04395678 [331] -0.04397292 -0.04398903 -0.04400509 -0.04402112 -0.04403710 -0.04405305 [337] -0.04406895 -0.04408482 -0.04410066 -0.04411645 -0.04413221 -0.04414793 [343] -0.04416361 -0.04417926 -0.04419487 -0.04421045 -0.04422599 -0.04424150 [349] -0.04425697 -0.04427241 -0.04428782 -0.04430319 -0.04431853 -0.04433383 [355] -0.04434911 -0.04436435 -0.04437956 -0.04439474 -0.04440989 -0.04442501 [361] -0.04444010 -0.04445516 -0.04447019 -0.04448519 -0.04450016 -0.04451511 [367] -0.04453002 -0.04454491 -0.04455978 -0.04457461 -0.04458942 -0.04460420 [373] -0.04461896 -0.04463369 -0.04464840 -0.04466308 -0.04467774 -0.04469238 [379] -0.04470699 -0.04472158 -0.04473615 -0.04475069 -0.04476521 -0.04477971 [385] -0.04479419 -0.04480865 -0.04482309 -0.04483751 -0.04485191 -0.04486629 [391] -0.04488065 -0.04489499 -0.04490932 -0.04492363 -0.04493792 -0.04495219 [397] -0.04496645 -0.04498069 -0.04499491 -0.04500912 -0.04502331 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1t95y1257955544.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/2kaq41257955544.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/3y7he1257955544.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/4hp151257955544.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/5cooz1257955544.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/649lj1257955544.tab") > system("convert tmp/1t95y1257955544.ps tmp/1t95y1257955544.png") > system("convert tmp/2kaq41257955544.ps tmp/2kaq41257955544.png") > system("convert tmp/3y7he1257955544.ps tmp/3y7he1257955544.png") > system("convert tmp/4hp151257955544.ps tmp/4hp151257955544.png") > system("convert tmp/5cooz1257955544.ps tmp/5cooz1257955544.png") > > > proc.time() user system elapsed 1.741 1.300 2.085