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(2490,3266,3475,3127,2955,3870,2852,3142,3029,3180,2560,2733,2452,2553,2777,2520,2318,2873,2311,2395,2099,2268,2316,2181,2175,2627,2578,3090,2634,3225,2938,3174,3350,2588,2061,2691,2061,2918,2223,2651,2379,3146,2883,2768,3258,2839,2470,5072,1463,1600,2203,2013,2169,2640,2411,2528,2292,1988,1774,2279) > #'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.4232274 -0.4233402 -0.4234510 -0.4235599 -0.4236669 -0.4237720 [7] -0.4238751 -0.4239763 -0.4240755 -0.4241728 -0.4242682 -0.4243615 [13] -0.4244529 -0.4245423 -0.4246297 -0.4247151 -0.4247985 -0.4248799 [19] -0.4249592 -0.4250366 -0.4251119 -0.4251851 -0.4252563 -0.4253255 [25] -0.4253926 -0.4254576 -0.4255205 -0.4255814 -0.4256401 -0.4256968 [31] -0.4257514 -0.4258038 -0.4258541 -0.4259023 -0.4259484 -0.4259923 [37] -0.4260341 -0.4260737 -0.4261112 -0.4261465 -0.4261796 -0.4262106 [43] -0.4262393 -0.4262659 -0.4262903 -0.4263124 -0.4263324 -0.4263501 [49] -0.4263656 -0.4263789 -0.4263899 -0.4263987 -0.4264052 -0.4264095 [55] -0.4264115 -0.4264113 -0.4264087 -0.4264039 -0.4263968 -0.4263874 [61] -0.4263757 -0.4263617 -0.4263453 -0.4263267 -0.4263057 -0.4262824 [67] -0.4262567 -0.4262287 -0.4261984 -0.4261657 -0.4261306 -0.4260932 [73] -0.4260534 -0.4260112 -0.4259666 -0.4259197 -0.4258703 -0.4258186 [79] -0.4257644 -0.4257078 -0.4256488 -0.4255874 -0.4255235 -0.4254572 [85] -0.4253885 -0.4253173 -0.4252437 -0.4251676 -0.4250890 -0.4250080 [91] -0.4249245 -0.4248385 -0.4247501 -0.4246591 -0.4245657 -0.4244697 [97] -0.4243713 -0.4242703 -0.4241669 -0.4240609 -0.4239523 -0.4238413 [103] -0.4237277 -0.4236116 -0.4234929 -0.4233717 -0.4232480 -0.4231216 [109] -0.4229927 -0.4228613 -0.4227273 -0.4225907 -0.4224515 -0.4223097 [115] -0.4221654 -0.4220184 -0.4218689 -0.4217167 -0.4215620 -0.4214046 [121] -0.4212446 -0.4210820 -0.4209168 -0.4207489 -0.4205784 -0.4204053 [127] -0.4202295 -0.4200511 -0.4198701 -0.4196864 -0.4195000 -0.4193110 [133] -0.4191193 -0.4189250 -0.4187280 -0.4185283 -0.4183259 -0.4181209 [139] -0.4179131 -0.4177027 -0.4174896 -0.4172738 -0.4170553 -0.4168341 [145] -0.4166102 -0.4163836 -0.4161543 -0.4159223 -0.4156876 -0.4154501 [151] -0.4152099 -0.4149670 -0.4147214 -0.4144730 -0.4142220 -0.4139681 [157] -0.4137116 -0.4134523 -0.4131902 -0.4129254 -0.4126579 -0.4123876 [163] -0.4121146 -0.4118388 -0.4115603 -0.4112790 -0.4109949 -0.4107081 [169] -0.4104185 -0.4101261 -0.4098310 -0.4095331 -0.4092325 -0.4089291 [175] -0.4086228 -0.4083139 -0.4080021 -0.4076876 -0.4073702 -0.4070501 [181] -0.4067273 -0.4064016 -0.4060731 -0.4057419 -0.4054079 -0.4050711 [187] -0.4047315 -0.4043891 -0.4040439 -0.4036959 -0.4033452 -0.4029916 [193] -0.4026353 -0.4022761 -0.4019142 -0.4015494 -0.4011819 -0.4008116 [199] -0.4004385 -0.4000626 -0.3996839 -0.3993024 -0.3989181 -0.3985310 [205] -0.3981411 -0.3977484 -0.3973530 -0.3969547 -0.3965536 -0.3961498 [211] -0.3957432 -0.3953337 -0.3949215 -0.3945065 -0.3940887 -0.3936681 [217] -0.3932448 -0.3928186 -0.3923897 -0.3919580 -0.3915235 -0.3910862 [223] -0.3906462 -0.3902033 -0.3897578 -0.3893094 -0.3888583 -0.3884043 [229] -0.3879477 -0.3874882 -0.3870261 -0.3865611 -0.3860934 -0.3856229 [235] -0.3851497 -0.3846738 -0.3841950 -0.3837136 -0.3832294 -0.3827425 [241] -0.3822528 -0.3817604 -0.3812653 -0.3807675 -0.3802669 -0.3797636 [247] -0.3792576 -0.3787489 -0.3782375 -0.3777234 -0.3772066 -0.3766870 [253] -0.3761648 -0.3756400 -0.3751124 -0.3745821 -0.3740492 -0.3735136 [259] -0.3729754 -0.3724345 -0.3718909 -0.3713447 -0.3707958 -0.3702443 [265] -0.3696902 -0.3691334 -0.3685740 -0.3680120 -0.3674474 -0.3668802 [271] -0.3663104 -0.3657380 -0.3651630 -0.3645854 -0.3640052 -0.3634225 [277] -0.3628372 -0.3622493 -0.3616589 -0.3610660 -0.3604705 -0.3598725 [283] -0.3592719 -0.3586689 -0.3580633 -0.3574552 -0.3568447 -0.3562316 [289] -0.3556161 -0.3549981 -0.3543776 -0.3537547 -0.3531293 -0.3525015 [295] -0.3518712 -0.3512386 -0.3506035 -0.3499660 -0.3493261 -0.3486838 [301] -0.3480392 -0.3473921 -0.3467427 -0.3460910 -0.3454369 -0.3447805 [307] -0.3441217 -0.3434606 -0.3427972 -0.3421316 -0.3414636 -0.3407933 [313] -0.3401208 -0.3394461 -0.3387690 -0.3380898 -0.3374083 -0.3367246 [319] -0.3360387 -0.3353506 -0.3346603 -0.3339678 -0.3332732 -0.3325764 [325] -0.3318775 -0.3311764 -0.3304733 -0.3297680 -0.3290606 -0.3283512 [331] -0.3276396 -0.3269260 -0.3262104 -0.3254927 -0.3247730 -0.3240513 [337] -0.3233276 -0.3226019 -0.3218742 -0.3211446 -0.3204130 -0.3196795 [343] -0.3189441 -0.3182067 -0.3174674 -0.3167263 -0.3159833 -0.3152384 [349] -0.3144917 -0.3137431 -0.3129928 -0.3122406 -0.3114866 -0.3107309 [355] -0.3099734 -0.3092141 -0.3084531 -0.3076904 -0.3069260 -0.3061599 [361] -0.3053921 -0.3046226 -0.3038515 -0.3030788 -0.3023044 -0.3015285 [367] -0.3007509 -0.2999718 -0.2991911 -0.2984088 -0.2976250 -0.2968397 [373] -0.2960530 -0.2952647 -0.2944749 -0.2936837 -0.2928911 -0.2920970 [379] -0.2913015 -0.2905047 -0.2897064 -0.2889068 -0.2881058 -0.2873036 [385] -0.2865000 -0.2856951 -0.2848889 -0.2840814 -0.2832728 -0.2824628 [391] -0.2816517 -0.2808393 -0.2800258 -0.2792111 -0.2783953 -0.2775783 [397] -0.2767602 -0.2759410 -0.2751207 -0.2742993 -0.2734769 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1af471229872815.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/2rau01229872815.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/3bggu1229872815.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/4q50g1229872815.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/55sy41229872815.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/6c3s31229872815.tab") > > system("convert tmp/1af471229872815.ps tmp/1af471229872815.png") > system("convert tmp/2rau01229872815.ps tmp/2rau01229872815.png") > system("convert tmp/3bggu1229872815.ps tmp/3bggu1229872815.png") > system("convert tmp/4q50g1229872815.ps tmp/4q50g1229872815.png") > system("convert tmp/55sy41229872815.ps tmp/55sy41229872815.png") > > > proc.time() user system elapsed 1.090 0.776 1.425