R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(655362,873127,1107897,1555964,1671159,1493308,2957796,2638691,1305669,1280496,921900,867888,652586,913831,1108544,1555827,1699283,1509458,3268975,2425016,1312703,1365498,934453,775019,651142,843192,1146766,1652601,1465906,1652734,2922334,2702805,1458956,1410363,1019279,936574,708917,885295,1099663,1576220,1487870,1488635,2882530,2677026,1404398,1344370,936865,872705,628151,953712,1160384,1400618,1661511,1495347,2918786,2775677,1407026,1370199,964526,850851,683118,847224,1073256,1514326,1503734,1507712,2865698,2788128,1391596,1366378,946295,859626) > #'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.07643290 0.07627596 0.07611562 0.07596016 0.07579755 0.07564042 [7] 0.07546430 0.07531519 0.07514468 0.07498940 0.07482159 0.07466076 [13] 0.07449498 0.07433763 0.07416952 0.07400920 0.07384325 0.07368132 [19] 0.07351870 0.07335236 0.07318847 0.07302443 0.07286011 0.07269427 [25] 0.07253037 0.07236377 0.07219855 0.07203297 0.07186781 0.07170202 [31] 0.07153594 0.07136961 0.07120374 0.07103706 0.07087033 0.07070338 [37] 0.07053674 0.07036969 0.07020258 0.07003540 0.06986807 0.06970045 [43] 0.06953276 0.06936499 0.06919707 0.06902903 0.06886095 0.06869261 [49] 0.06852425 0.06835577 0.06818718 0.06801848 0.06784970 0.06768081 [55] 0.06751183 0.06734275 0.06717358 0.06700432 0.06683499 0.06666556 [61] 0.06649606 0.06632649 0.06615684 0.06598712 0.06581733 0.06564748 [67] 0.06547758 0.06530760 0.06513758 0.06496750 0.06479738 0.06462720 [73] 0.06445698 0.06428673 0.06411643 0.06394610 0.06377574 0.06360536 [79] 0.06343494 0.06326451 0.06309405 0.06292359 0.06275311 0.06258261 [85] 0.06241212 0.06224162 0.06207112 0.06190063 0.06173014 0.06155967 [91] 0.06138920 0.06121876 0.06104833 0.06087793 0.06070756 0.06053721 [97] 0.06036691 0.06019663 0.06002640 0.05985621 0.05968607 0.05951599 [103] 0.05934595 0.05917598 0.05900606 0.05883621 0.05866643 0.05849672 [109] 0.05832709 0.05815753 0.05798806 0.05781868 0.05764938 0.05748018 [115] 0.05731107 0.05714207 0.05697317 0.05680437 0.05663569 0.05646712 [121] 0.05629868 0.05613035 0.05596215 0.05579408 0.05562614 0.05545834 [127] 0.05529068 0.05512317 0.05495580 0.05478858 0.05462152 0.05445462 [133] 0.05428788 0.05412131 0.05395490 0.05378867 0.05362262 0.05345675 [139] 0.05329106 0.05312557 0.05296026 0.05279515 0.05263024 0.05246553 [145] 0.05230103 0.05213674 0.05197267 0.05180881 0.05164517 0.05148176 [151] 0.05131858 0.05115563 0.05099292 0.05083045 0.05066822 0.05050624 [157] 0.05034451 0.05018303 0.05002181 0.04986085 0.04970016 0.04953974 [163] 0.04937959 0.04921971 0.04906012 0.04890081 0.04874178 0.04858304 [169] 0.04842460 0.04826646 0.04810861 0.04795107 0.04779384 0.04763691 [175] 0.04748031 0.04732402 0.04716804 0.04701240 0.04685708 0.04670209 [181] 0.04654744 0.04639312 0.04623915 0.04608552 0.04593223 0.04577930 [187] 0.04562672 0.04547450 0.04532263 0.04517113 0.04502000 0.04486923 [193] 0.04471884 0.04456882 0.04441918 0.04426992 0.04412104 0.04397255 [199] 0.04382445 0.04367674 0.04352943 0.04338252 0.04323600 0.04308989 [205] 0.04294419 0.04279889 0.04265401 0.04250954 0.04236549 0.04222185 [211] 0.04207864 0.04193585 0.04179349 0.04165156 0.04151005 0.04136899 [217] 0.04122835 0.04108816 0.04094841 0.04080910 0.04067023 0.04053181 [223] 0.04039384 0.04025632 0.04011925 0.03998264 0.03984649 0.03971079 [229] 0.03957556 0.03944078 0.03930647 0.03917263 0.03903926 0.03890635 [235] 0.03877392 0.03864195 0.03851047 0.03837945 0.03824892 0.03811886 [241] 0.03798928 0.03786019 0.03773157 0.03760345 0.03747580 0.03734864 [247] 0.03722197 0.03709579 0.03697010 0.03684489 0.03672018 0.03659596 [253] 0.03647224 0.03634901 0.03622627 0.03610403 0.03598229 0.03586104 [259] 0.03574029 0.03562004 0.03550029 0.03538104 0.03526229 0.03514403 [265] 0.03502628 0.03490903 0.03479229 0.03467604 0.03456029 0.03444505 [271] 0.03433031 0.03421608 0.03410234 0.03398911 0.03387638 0.03376415 [277] 0.03365243 0.03354121 0.03343049 0.03332027 0.03321055 0.03310134 [283] 0.03299262 0.03288441 0.03277670 0.03266948 0.03256277 0.03245656 [289] 0.03235084 0.03224562 0.03214090 0.03203668 0.03193295 0.03182972 [295] 0.03172698 0.03162473 0.03152298 0.03142172 0.03132095 0.03122067 [301] 0.03112088 0.03102158 0.03092276 0.03082444 0.03072659 0.03062923 [307] 0.03053235 0.03043596 0.03034004 0.03024460 0.03014964 0.03005516 [313] 0.02996115 0.02986762 0.02977456 0.02968196 0.02958984 0.02949819 [319] 0.02940700 0.02931627 0.02922601 0.02913621 0.02904688 0.02895799 [325] 0.02886957 0.02878160 0.02869408 0.02860702 0.02852040 0.02843424 [331] 0.02834852 0.02826324 0.02817841 0.02809401 0.02801006 0.02792654 [337] 0.02784345 0.02776080 0.02767858 0.02759679 0.02751542 0.02743448 [343] 0.02735396 0.02727386 0.02719418 0.02711492 0.02703607 0.02695763 [349] 0.02687961 0.02680199 0.02672477 0.02664796 0.02657155 0.02649554 [355] 0.02641992 0.02634470 0.02626987 0.02619543 0.02612138 0.02604771 [361] 0.02597442 0.02590152 0.02582899 0.02575684 0.02568506 0.02561366 [367] 0.02554262 0.02547194 0.02540163 0.02533169 0.02526210 0.02519286 [373] 0.02512398 0.02505545 0.02498727 0.02491944 0.02485195 0.02478481 [379] 0.02471800 0.02465152 0.02458539 0.02451958 0.02445410 0.02438895 [385] 0.02432412 0.02425962 0.02419543 0.02413156 0.02406801 0.02400476 [391] 0.02394183 0.02387920 0.02381687 0.02375485 0.02369312 0.02363169 [397] 0.02357055 0.02350971 0.02344915 0.02338888 0.02332890 > mx [1] 0.0764329 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/wessaorg/rcomp/tmp/1zz6e1323011776.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/26u671323011776.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/3z3o41323011776.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/4ouj41323011776.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/5bck41323011776.ps",horizontal=F,onefile=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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/66feg1323011776.tab") > > try(system("convert tmp/1zz6e1323011776.ps tmp/1zz6e1323011776.png",intern=TRUE)) character(0) > try(system("convert tmp/26u671323011776.ps tmp/26u671323011776.png",intern=TRUE)) character(0) > try(system("convert tmp/3z3o41323011776.ps tmp/3z3o41323011776.png",intern=TRUE)) character(0) > try(system("convert tmp/4ouj41323011776.ps tmp/4ouj41323011776.png",intern=TRUE)) character(0) > try(system("convert tmp/5bck41323011776.ps tmp/5bck41323011776.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.416 0.280 1.696