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(467037,460070,447988,442867,436087,431328,484015,509673,512927,502831,470984,471067,476049,474605,470439,461251,454724,455626,516847,525192,522975,518585,509239,512238,519164,517009,509933,509127,500857,506971,569323,579714,577992,565464,547344,554788,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) > #'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.8215277 0.8215714 0.8216110 0.8216410 0.8216853 0.8217201 0.8217573 [8] 0.8217943 0.8218329 0.8218669 0.8219029 0.8219395 0.8219761 0.8220116 [15] 0.8220483 0.8220818 0.8221169 0.8221526 0.8221871 0.8222214 0.8222548 [22] 0.8222890 0.8223224 0.8223557 0.8223891 0.8224219 0.8224541 0.8224867 [29] 0.8225188 0.8225508 0.8225824 0.8226136 0.8226450 0.8226758 0.8227067 [36] 0.8227370 0.8227672 0.8227972 0.8228270 0.8228564 0.8228858 0.8229148 [43] 0.8229435 0.8229721 0.8230004 0.8230285 0.8230563 0.8230839 0.8231113 [50] 0.8231384 0.8231653 0.8231919 0.8232183 0.8232445 0.8232704 0.8232960 [57] 0.8233215 0.8233467 0.8233716 0.8233964 0.8234208 0.8234451 0.8234691 [64] 0.8234928 0.8235164 0.8235396 0.8235627 0.8235855 0.8236080 0.8236304 [71] 0.8236524 0.8236743 0.8236959 0.8237172 0.8237384 0.8237592 0.8237799 [78] 0.8238003 0.8238204 0.8238403 0.8238600 0.8238794 0.8238986 0.8239176 [85] 0.8239363 0.8239548 0.8239730 0.8239910 0.8240087 0.8240262 0.8240435 [92] 0.8240605 0.8240773 0.8240939 0.8241102 0.8241262 0.8241420 0.8241576 [99] 0.8241730 0.8241881 0.8242029 0.8242175 0.8242319 0.8242460 0.8242599 [106] 0.8242736 0.8242870 0.8243002 0.8243131 0.8243258 0.8243382 0.8243504 [113] 0.8243624 0.8243741 0.8243856 0.8243968 0.8244078 0.8244186 0.8244291 [120] 0.8244394 0.8244494 0.8244592 0.8244687 0.8244780 0.8244871 0.8244959 [127] 0.8245045 0.8245129 0.8245210 0.8245288 0.8245364 0.8245438 0.8245509 [134] 0.8245578 0.8245645 0.8245709 0.8245771 0.8245830 0.8245887 0.8245941 [141] 0.8245993 0.8246043 0.8246090 0.8246135 0.8246177 0.8246217 0.8246255 [148] 0.8246290 0.8246323 0.8246353 0.8246381 0.8246407 0.8246430 0.8246451 [155] 0.8246469 0.8246485 0.8246498 0.8246509 0.8246518 0.8246524 0.8246528 [162] 0.8246529 0.8246528 0.8246525 0.8246519 0.8246511 0.8246500 0.8246487 [169] 0.8246472 0.8246454 0.8246434 0.8246411 0.8246386 0.8246359 0.8246329 [176] 0.8246297 0.8246262 0.8246225 0.8246185 0.8246144 0.8246099 0.8246053 [183] 0.8246003 0.8245952 0.8245898 0.8245842 0.8245783 0.8245722 0.8245659 [190] 0.8245593 0.8245524 0.8245454 0.8245381 0.8245305 0.8245227 0.8245147 [197] 0.8245064 0.8244979 0.8244892 0.8244802 0.8244710 0.8244615 0.8244518 [204] 0.8244419 0.8244317 0.8244213 0.8244106 0.8243997 0.8243886 0.8243772 [211] 0.8243656 0.8243538 0.8243417 0.8243293 0.8243168 0.8243040 0.8242909 [218] 0.8242776 0.8242641 0.8242504 0.8242364 0.8242221 0.8242077 0.8241929 [225] 0.8241780 0.8241628 0.8241474 0.8241317 0.8241158 0.8240997 0.8240833 [232] 0.8240667 0.8240499 0.8240328 0.8240155 0.8239979 0.8239801 0.8239621 [239] 0.8239438 0.8239253 0.8239065 0.8238876 0.8238684 0.8238489 0.8238292 [246] 0.8238093 0.8237891 0.8237687 0.8237481 0.8237272 0.8237061 0.8236848 [253] 0.8236632 0.8236414 0.8236194 0.8235971 0.8235746 0.8235518 0.8235288 [260] 0.8235056 0.8234821 0.8234585 0.8234345 0.8234104 0.8233860 0.8233613 [267] 0.8233365 0.8233114 0.8232861 0.8232605 0.8232347 0.8232087 0.8231824 [274] 0.8231559 0.8231292 0.8231022 0.8230750 0.8230476 0.8230199 0.8229920 [281] 0.8229639 0.8229355 0.8229069 0.8228781 0.8228490 0.8228197 0.8227902 [288] 0.8227604 0.8227305 0.8227002 0.8226698 0.8226391 0.8226082 0.8225770 [295] 0.8225456 0.8225140 0.8224822 0.8224501 0.8224178 0.8223853 0.8223525 [302] 0.8223195 0.8222863 0.8222529 0.8222192 0.8221853 0.8221511 0.8221167 [309] 0.8220821 0.8220473 0.8220122 0.8219770 0.8219414 0.8219057 0.8218697 [316] 0.8218335 0.8217971 0.8217604 0.8217235 0.8216864 0.8216490 0.8216115 [323] 0.8215737 0.8215356 0.8214974 0.8214589 0.8214202 0.8213812 0.8213421 [330] 0.8213027 0.8212631 0.8212232 0.8211831 0.8211428 0.8211023 0.8210616 [337] 0.8210206 0.8209794 0.8209380 0.8208963 0.8208544 0.8208123 0.8207700 [344] 0.8207274 0.8206847 0.8206417 0.8205984 0.8205550 0.8205113 0.8204674 [351] 0.8204233 0.8203790 0.8203344 0.8202896 0.8202446 0.8201993 0.8201539 [358] 0.8201082 0.8200623 0.8200162 0.8199698 0.8199232 0.8198764 0.8198294 [365] 0.8197822 0.8197347 0.8196870 0.8196391 0.8195910 0.8195427 0.8194941 [372] 0.8194453 0.8193963 0.8193471 0.8192976 0.8192480 0.8191981 0.8191480 [379] 0.8190977 0.8190471 0.8189964 0.8189454 0.8188942 0.8188428 0.8187911 [386] 0.8187393 0.8186872 0.8186349 0.8185824 0.8185297 0.8184767 0.8184236 [393] 0.8183702 0.8183166 0.8182628 0.8182087 0.8181545 0.8181000 0.8180454 [400] 0.8179905 0.8179354 > mx [1] 0.824653 > mxli [1] -0.39 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1a2ed1197361452.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/2e6w21197361452.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/3a7nm1197361452.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/4wvrz1197361452.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/5cnlq1197361452.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/6lb5w1197361452.tab") > > system("convert tmp/1a2ed1197361452.ps tmp/1a2ed1197361452.png") > system("convert tmp/2e6w21197361452.ps tmp/2e6w21197361452.png") > system("convert tmp/3a7nm1197361452.ps tmp/3a7nm1197361452.png") > system("convert tmp/4wvrz1197361452.ps tmp/4wvrz1197361452.png") > system("convert tmp/5cnlq1197361452.ps tmp/5cnlq1197361452.png") > > > proc.time() user system elapsed 1.421 0.825 1.943