R version 2.7.2 (2008-08-25) 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(2173,2363,2126,1905,2121,1983,1734,2074,2049,2406,2558,2251,2059,2397,1747,1707,2319,1631,1627,1791,2034,1997,2169,2028,2253,2218,1855,2187,1852,1570,1851,1954,1828,2251,2277,2085,2282,2266,1878,2267,2069,1746,2299,2360,2214,2825,2355,2333,3016,2155,2172,2150,2533,2058,2160,2259,2498,2695,2799,2945,2930,2318,2540,2570,2669,2450,2842,3439,2677,2979,2257,2842,2546,2455,2293,2379,2478,2054,2272,2351,2271,2542,2304,2194,2722,2395,2146,1894,2548,2087,2063,2481,2476,2212,2834,2148,2598) > #'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.4154975 0.4155601 0.4156221 0.4156835 0.4157444 0.4158048 0.4158646 [8] 0.4159239 0.4159826 0.4160408 0.4160985 0.4161556 0.4162121 0.4162681 [15] 0.4163235 0.4163784 0.4164328 0.4164866 0.4165398 0.4165925 0.4166446 [22] 0.4166961 0.4167471 0.4167976 0.4168474 0.4168967 0.4169455 0.4169937 [29] 0.4170413 0.4170883 0.4171348 0.4171807 0.4172261 0.4172708 0.4173150 [36] 0.4173587 0.4174017 0.4174442 0.4174861 0.4175274 0.4175682 0.4176083 [43] 0.4176479 0.4176869 0.4177253 0.4177632 0.4178004 0.4178371 0.4178732 [50] 0.4179087 0.4179436 0.4179779 0.4180117 0.4180448 0.4180774 0.4181093 [57] 0.4181407 0.4181714 0.4182016 0.4182312 0.4182602 0.4182886 0.4183164 [64] 0.4183435 0.4183701 0.4183961 0.4184215 0.4184463 0.4184705 0.4184940 [71] 0.4185170 0.4185394 0.4185611 0.4185823 0.4186028 0.4186227 0.4186420 [78] 0.4186607 0.4186788 0.4186963 0.4187132 0.4187294 0.4187451 0.4187601 [85] 0.4187745 0.4187883 0.4188014 0.4188140 0.4188259 0.4188372 0.4188479 [92] 0.4188579 0.4188674 0.4188762 0.4188844 0.4188919 0.4188989 0.4189052 [99] 0.4189109 0.4189159 0.4189203 0.4189241 0.4189273 0.4189298 0.4189317 [106] 0.4189330 0.4189336 0.4189336 0.4189330 0.4189317 0.4189298 0.4189273 [113] 0.4189241 0.4189203 0.4189158 0.4189107 0.4189050 0.4188986 0.4188916 [120] 0.4188840 0.4188757 0.4188667 0.4188571 0.4188469 0.4188360 0.4188245 [127] 0.4188123 0.4187995 0.4187861 0.4187720 0.4187572 0.4187418 0.4187258 [134] 0.4187091 0.4186917 0.4186737 0.4186550 0.4186357 0.4186158 0.4185952 [141] 0.4185739 0.4185520 0.4185294 0.4185062 0.4184823 0.4184578 0.4184326 [148] 0.4184068 0.4183802 0.4183531 0.4183253 0.4182968 0.4182677 0.4182379 [155] 0.4182074 0.4181763 0.4181445 0.4181121 0.4180790 0.4180452 0.4180108 [162] 0.4179757 0.4179400 0.4179036 0.4178665 0.4178288 0.4177904 0.4177513 [169] 0.4177116 0.4176712 0.4176301 0.4175884 0.4175460 0.4175029 0.4174592 [176] 0.4174148 0.4173698 0.4173240 0.4172777 0.4172306 0.4171829 0.4171345 [183] 0.4170854 0.4170357 0.4169853 0.4169342 0.4168825 0.4168300 0.4167770 [190] 0.4167232 0.4166688 0.4166137 0.4165579 0.4165015 0.4164444 0.4163866 [197] 0.4163282 0.4162690 0.4162092 0.4161488 0.4160876 0.4160258 0.4159634 [204] 0.4159002 0.4158364 0.4157719 0.4157067 0.4156409 0.4155743 0.4155072 [211] 0.4154393 0.4153708 0.4153015 0.4152317 0.4151611 0.4150899 0.4150180 [218] 0.4149454 0.4148721 0.4147982 0.4147236 0.4146484 0.4145724 0.4144958 [225] 0.4144185 0.4143405 0.4142619 0.4141826 0.4141026 0.4140219 0.4139406 [232] 0.4138586 0.4137759 0.4136926 0.4136086 0.4135239 0.4134385 0.4133524 [239] 0.4132657 0.4131783 0.4130903 0.4130015 0.4129121 0.4128221 0.4127313 [246] 0.4126399 0.4125478 0.4124550 0.4123616 0.4122675 0.4121727 0.4120773 [253] 0.4119812 0.4118844 0.4117869 0.4116888 0.4115900 0.4114905 0.4113904 [260] 0.4112896 0.4111881 0.4110859 0.4109831 0.4108797 0.4107755 0.4106707 [267] 0.4105652 0.4104591 0.4103522 0.4102448 0.4101366 0.4100278 0.4099183 [274] 0.4098082 0.4096973 0.4095859 0.4094737 0.4093609 0.4092475 0.4091333 [281] 0.4090185 0.4089031 0.4087870 0.4086702 0.4085527 0.4084346 0.4083159 [288] 0.4081964 0.4080764 0.4079556 0.4078342 0.4077122 0.4075894 0.4074661 [295] 0.4073420 0.4072173 0.4070920 0.4069660 0.4068393 0.4067120 0.4065841 [302] 0.4064554 0.4063262 0.4061962 0.4060657 0.4059344 0.4058025 0.4056700 [309] 0.4055368 0.4054030 0.4052685 0.4051334 0.4049976 0.4048612 0.4047241 [316] 0.4045864 0.4044480 0.4043090 0.4041693 0.4040290 0.4038881 0.4037465 [323] 0.4036043 0.4034614 0.4033179 0.4031737 0.4030290 0.4028835 0.4027374 [330] 0.4025907 0.4024434 0.4022954 0.4021468 0.4019975 0.4018477 0.4016971 [337] 0.4015460 0.4013942 0.4012418 0.4010887 0.4009350 0.4007807 0.4006258 [344] 0.4004702 0.4003140 0.4001572 0.3999998 0.3998417 0.3996830 0.3995237 [351] 0.3993637 0.3992032 0.3990420 0.3988802 0.3987177 0.3985547 0.3983910 [358] 0.3982267 0.3980618 0.3978963 0.3977302 0.3975634 0.3973961 0.3972281 [365] 0.3970595 0.3968903 0.3967205 0.3965501 0.3963791 0.3962075 0.3960352 [372] 0.3958624 0.3956889 0.3955149 0.3953402 0.3951650 0.3949891 0.3948127 [379] 0.3946356 0.3944580 0.3942797 0.3941009 0.3939214 0.3937414 0.3935608 [386] 0.3933795 0.3931977 0.3930153 0.3928323 0.3926487 0.3924645 0.3922798 [393] 0.3920944 0.3919085 0.3917220 0.3915349 0.3913472 0.3911589 0.3909701 [400] 0.3907807 0.3905907 > mx [1] 0.4189336 > mxli [1] -0.93 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/12vw61226421235.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/2f0mi1226421235.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/37n651226421235.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/47sj41226421235.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/5qpkz1226421235.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/6z2fy1226421235.tab") > > system("convert tmp/12vw61226421235.ps tmp/12vw61226421235.png") > system("convert tmp/2f0mi1226421235.ps tmp/2f0mi1226421235.png") > system("convert tmp/37n651226421235.ps tmp/37n651226421235.png") > system("convert tmp/47sj41226421235.ps tmp/47sj41226421235.png") > system("convert tmp/5qpkz1226421235.ps tmp/5qpkz1226421235.png") > > > proc.time() user system elapsed 1.282 0.771 1.534