R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(280,557,831,1081,1318,1578,1859,2141,2428,2715,3004,3309,269,537,813,1068,1411,1675,1958,2242,2524,2836,3143,3522,285,574,865,1147,1516,1789,2087,2372,2669,2966,3270,3652,329,658,988,1303,1603,1929,2235,2544,2872,3198,3544,3903,332,665,1001,1329,1639,1975,2304,2640,2992,3330,3690,4063) > #'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.2411294 0.2414195 0.2417127 0.2420089 0.2423081 0.2426104 0.2429158 [8] 0.2432242 0.2435358 0.2438505 0.2441684 0.2444894 0.2448136 0.2451409 [15] 0.2454715 0.2458052 0.2461422 0.2464825 0.2468259 0.2471727 0.2475227 [22] 0.2478760 0.2482326 0.2485925 0.2489558 0.2493223 0.2496922 0.2500655 [29] 0.2504421 0.2508221 0.2512055 0.2515923 0.2519825 0.2523761 0.2527731 [36] 0.2531735 0.2535773 0.2539846 0.2543953 0.2548095 0.2552272 0.2556482 [43] 0.2560728 0.2565008 0.2569323 0.2573672 0.2578056 0.2582475 0.2586929 [50] 0.2591418 0.2595941 0.2600499 0.2605091 0.2609719 0.2614381 0.2619078 [57] 0.2623809 0.2628575 0.2633375 0.2638210 0.2643080 0.2647984 0.2652921 [64] 0.2657894 0.2662900 0.2667940 0.2673014 0.2678122 0.2683264 0.2688439 [71] 0.2693648 0.2698889 0.2704164 0.2709472 0.2714813 0.2720186 0.2725592 [78] 0.2731030 0.2736500 0.2742002 0.2747535 0.2753100 0.2758697 0.2764324 [85] 0.2769981 0.2775670 0.2781388 0.2787137 0.2792915 0.2798722 0.2804559 [92] 0.2810424 0.2816318 0.2822240 0.2828190 0.2834167 0.2840171 0.2846202 [99] 0.2852260 0.2858343 0.2864453 0.2870587 0.2876746 0.2882930 0.2889138 [106] 0.2895370 0.2901624 0.2907902 0.2914202 0.2920524 0.2926867 0.2933231 [113] 0.2939616 0.2946020 0.2952444 0.2958888 0.2965349 0.2971829 0.2978326 [120] 0.2984840 0.2991371 0.2997917 0.3004479 0.3011056 0.3017647 0.3024252 [127] 0.3030869 0.3037500 0.3044142 0.3050796 0.3057460 0.3064135 0.3070820 [134] 0.3077513 0.3084215 0.3090925 0.3097642 0.3104365 0.3111095 0.3117830 [141] 0.3124570 0.3131314 0.3138061 0.3144812 0.3151564 0.3158319 0.3165074 [148] 0.3171830 0.3178585 0.3185340 0.3192093 0.3198844 0.3205592 0.3212337 [155] 0.3219077 0.3225813 0.3232544 0.3239269 0.3245987 0.3252699 0.3259402 [162] 0.3266097 0.3272783 0.3279460 0.3286126 0.3292782 0.3299426 0.3306058 [169] 0.3312678 0.3319285 0.3325877 0.3332456 0.3339020 0.3345568 0.3352101 [176] 0.3358616 0.3365115 0.3371597 0.3378060 0.3384504 0.3390930 0.3397336 [183] 0.3403721 0.3410086 0.3416430 0.3422753 0.3429053 0.3435331 0.3441586 [190] 0.3447817 0.3454025 0.3460208 0.3466367 0.3472501 0.3478609 0.3484692 [197] 0.3490748 0.3496777 0.3502780 0.3508755 0.3514703 0.3520623 0.3526514 [204] 0.3532377 0.3538211 0.3544016 0.3549791 0.3555537 0.3561252 0.3566938 [211] 0.3572593 0.3578217 0.3583810 0.3589372 0.3594902 0.3600401 0.3605869 [218] 0.3611304 0.3616707 0.3622078 0.3627417 0.3632723 0.3637996 0.3643236 [225] 0.3648444 0.3653619 0.3658760 0.3663868 0.3668943 0.3673985 0.3678993 [232] 0.3683968 0.3688910 0.3693817 0.3698692 0.3703532 0.3708339 0.3713113 [239] 0.3717853 0.3722559 0.3727232 0.3731871 0.3736476 0.3741048 0.3745587 [246] 0.3750092 0.3754564 0.3759003 0.3763408 0.3767781 0.3772120 0.3776426 [253] 0.3780700 0.3784940 0.3789148 0.3793323 0.3797466 0.3801577 0.3805655 [260] 0.3809701 0.3813715 0.3817697 0.3821648 0.3825567 0.3829454 0.3833310 [267] 0.3837135 0.3840929 0.3844692 0.3848425 0.3852127 0.3855799 0.3859440 [274] 0.3863051 0.3866633 0.3870185 0.3873707 0.3877200 0.3880664 0.3884099 [281] 0.3887506 0.3890883 0.3894233 0.3897554 0.3900847 0.3904112 0.3907350 [288] 0.3910560 0.3913743 0.3916899 0.3920028 0.3923131 0.3926207 0.3929257 [295] 0.3932281 0.3935279 0.3938251 0.3941198 0.3944119 0.3947016 0.3949888 [302] 0.3952735 0.3955558 0.3958356 0.3961130 0.3963881 0.3966608 0.3969311 [309] 0.3971992 0.3974649 0.3977283 0.3979895 0.3982484 0.3985051 0.3987596 [316] 0.3990119 0.3992620 0.3995100 0.3997559 0.3999996 0.4002413 0.4004809 [323] 0.4007184 0.4009539 0.4011874 0.4014188 0.4016483 0.4018759 0.4021015 [330] 0.4023252 0.4025469 0.4027668 0.4029848 0.4032010 0.4034153 0.4036278 [337] 0.4038385 0.4040474 0.4042545 0.4044599 0.4046635 0.4048655 0.4050657 [344] 0.4052643 0.4054611 0.4056564 0.4058499 0.4060419 0.4062323 0.4064210 [351] 0.4066082 0.4067938 0.4069779 0.4071605 0.4073415 0.4075210 0.4076991 [358] 0.4078757 0.4080508 0.4082244 0.4083967 0.4085675 0.4087369 0.4089049 [365] 0.4090716 0.4092369 0.4094008 0.4095634 0.4097247 0.4098846 0.4100433 [372] 0.4102007 0.4103568 0.4105116 0.4106652 0.4108176 0.4109687 0.4111186 [379] 0.4112673 0.4114148 0.4115612 0.4117063 0.4118503 0.4119932 0.4121349 [386] 0.4122755 0.4124150 0.4125534 0.4126907 0.4128269 0.4129620 0.4130961 [393] 0.4132291 0.4133610 0.4134920 0.4136219 0.4137508 0.4138786 0.4140055 [400] 0.4141314 0.4142563 > mx [1] 0.4142563 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/13ikt1258133428.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/2pku21258133428.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/3l3mn1258133428.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/4wmgl1258133428.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/5xe9v1258133428.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/6k8hr1258133429.tab") > > system("convert tmp/13ikt1258133428.ps tmp/13ikt1258133428.png") > system("convert tmp/2pku21258133428.ps tmp/2pku21258133428.png") > system("convert tmp/3l3mn1258133428.ps tmp/3l3mn1258133428.png") > system("convert tmp/4wmgl1258133428.ps tmp/4wmgl1258133428.png") > system("convert tmp/5xe9v1258133428.ps tmp/5xe9v1258133428.png") > > > proc.time() user system elapsed 1.089 0.794 1.299