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(119.5,125,145,105.3,116.9,120.1,88.9,78.4,114.6,113.3,117,99.6,99.4,101.9,115.2,108.5,113.8,121,92.2,90.2,101.5,126.6,93.9,89.8,93.4,101.5,110.4,105.9,108.4,113.9,86.1,69.4,101.2,100.5,98,106.6,90.1,96.9,125.9,112,100,123.9,79.8,83.4,113.6,112.9,104,109.9,99,106.3,128.9,111.1,102.9,130,87,87.5,117.6,103.4,110.8,112.6,102.5,112.4,135.6,105.1,127.7,137,91,90.5,122.4,123.3,124.3,120,118.1,119,142.7,123.6,129.6,151.6,110.4,99.2,130.5,136.2,129.7,128,121.6,135.8,143.8,147.5,136.2,156.6,123.3,100.4) > #'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.3089165 0.3091812 0.3094457 0.3097100 0.3099741 0.3102380 0.3105017 [8] 0.3107652 0.3110285 0.3112916 0.3115545 0.3118171 0.3120796 0.3123419 [15] 0.3126040 0.3128658 0.3131275 0.3133889 0.3136502 0.3139112 0.3141720 [22] 0.3144326 0.3146930 0.3149532 0.3152131 0.3154728 0.3157323 0.3159916 [29] 0.3162507 0.3165096 0.3167682 0.3170266 0.3172848 0.3175427 0.3178004 [36] 0.3180579 0.3183152 0.3185723 0.3188291 0.3190857 0.3193420 0.3195981 [43] 0.3198540 0.3201097 0.3203651 0.3206202 0.3208752 0.3211299 0.3213843 [50] 0.3216386 0.3218925 0.3221463 0.3223998 0.3226530 0.3229060 0.3231588 [57] 0.3234113 0.3236636 0.3239156 0.3241674 0.3244189 0.3246701 0.3249212 [64] 0.3251719 0.3254224 0.3256727 0.3259227 0.3261724 0.3264219 0.3266711 [71] 0.3269201 0.3271688 0.3274173 0.3276655 0.3279134 0.3281611 0.3284085 [78] 0.3286556 0.3289025 0.3291491 0.3293954 0.3296415 0.3298873 0.3301328 [85] 0.3303780 0.3306230 0.3308677 0.3311122 0.3313563 0.3316002 0.3318438 [92] 0.3320872 0.3323302 0.3325730 0.3328155 0.3330577 0.3332997 0.3335414 [99] 0.3337827 0.3340238 0.3342646 0.3345052 0.3347454 0.3349854 0.3352250 [106] 0.3354644 0.3357035 0.3359423 0.3361808 0.3364190 0.3366570 0.3368946 [113] 0.3371320 0.3373690 0.3376058 0.3378422 0.3380784 0.3383142 0.3385498 [120] 0.3387851 0.3390201 0.3392547 0.3394891 0.3397232 0.3399569 0.3401904 [127] 0.3404235 0.3406564 0.3408890 0.3411212 0.3413531 0.3415848 0.3418161 [134] 0.3420471 0.3422778 0.3425082 0.3427382 0.3429680 0.3431975 0.3434266 [141] 0.3436554 0.3438839 0.3441121 0.3443400 0.3445676 0.3447948 0.3450218 [148] 0.3452484 0.3454746 0.3457006 0.3459263 0.3461516 0.3463766 0.3466013 [155] 0.3468256 0.3470496 0.3472733 0.3474967 0.3477198 0.3479425 0.3481649 [162] 0.3483870 0.3486087 0.3488301 0.3490512 0.3492719 0.3494923 0.3497124 [169] 0.3499322 0.3501516 0.3503707 0.3505894 0.3508078 0.3510259 0.3512436 [176] 0.3514610 0.3516781 0.3518948 0.3521112 0.3523272 0.3525429 0.3527583 [183] 0.3529733 0.3531880 0.3534023 0.3536163 0.3538299 0.3540432 0.3542562 [190] 0.3544688 0.3546810 0.3548929 0.3551045 0.3553157 0.3555266 0.3557371 [197] 0.3559472 0.3561570 0.3563665 0.3565756 0.3567844 0.3569928 0.3572008 [204] 0.3574085 0.3576158 0.3578228 0.3580294 0.3582357 0.3584416 0.3586471 [211] 0.3588523 0.3590572 0.3592616 0.3594657 0.3596695 0.3598729 0.3600759 [218] 0.3602786 0.3604809 0.3606828 0.3608844 0.3610856 0.3612864 0.3614869 [225] 0.3616870 0.3618867 0.3620861 0.3622851 0.3624838 0.3626820 0.3628799 [232] 0.3630775 0.3632746 0.3634714 0.3636678 0.3638639 0.3640595 0.3642548 [239] 0.3644498 0.3646443 0.3648385 0.3650323 0.3652257 0.3654188 0.3656115 [246] 0.3658038 0.3659957 0.3661872 0.3663784 0.3665692 0.3667596 0.3669496 [253] 0.3671392 0.3673285 0.3675174 0.3677059 0.3678940 0.3680817 0.3682691 [260] 0.3684561 0.3686427 0.3688289 0.3690147 0.3692001 0.3693852 0.3695698 [267] 0.3697541 0.3699380 0.3701215 0.3703046 0.3704873 0.3706697 0.3708516 [274] 0.3710332 0.3712143 0.3713951 0.3715755 0.3717555 0.3719351 0.3721143 [281] 0.3722931 0.3724715 0.3726496 0.3728272 0.3730045 0.3731813 0.3733578 [288] 0.3735338 0.3737095 0.3738848 0.3740596 0.3742341 0.3744082 0.3745819 [295] 0.3747552 0.3749281 0.3751005 0.3752726 0.3754443 0.3756156 0.3757865 [302] 0.3759570 0.3761271 0.3762968 0.3764661 0.3766350 0.3768034 0.3769715 [309] 0.3771392 0.3773065 0.3774734 0.3776398 0.3778059 0.3779716 0.3781368 [316] 0.3783017 0.3784661 0.3786302 0.3787938 0.3789570 0.3791199 0.3792823 [323] 0.3794443 0.3796059 0.3797671 0.3799279 0.3800883 0.3802482 0.3804078 [330] 0.3805669 0.3807257 0.3808840 0.3810420 0.3811995 0.3813566 0.3815133 [337] 0.3816696 0.3818254 0.3819809 0.3821359 0.3822906 0.3824448 0.3825986 [344] 0.3827520 0.3829050 0.3830576 0.3832097 0.3833615 0.3835128 0.3836637 [351] 0.3838142 0.3839643 0.3841140 0.3842633 0.3844121 0.3845605 0.3847086 [358] 0.3848562 0.3850033 0.3851501 0.3852964 0.3854424 0.3855879 0.3857330 [365] 0.3858777 0.3860219 0.3861658 0.3863092 0.3864522 0.3865948 0.3867370 [372] 0.3868787 0.3870201 0.3871610 0.3873015 0.3874416 0.3875812 0.3877205 [379] 0.3878593 0.3879977 0.3881357 0.3882732 0.3884104 0.3885471 0.3886834 [386] 0.3888193 0.3889547 0.3890898 0.3892244 0.3893586 0.3894923 0.3896257 [393] 0.3897586 0.3898911 0.3900232 0.3901549 0.3902861 0.3904169 0.3905473 [400] 0.3906773 0.3908069 > mx [1] 0.3908069 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1rcpj1226508730.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/2dy211226508730.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/3cax01226508730.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/4li3f1226508730.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/5m03n1226508730.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/6qri61226508730.tab") > > system("convert tmp/1rcpj1226508730.ps tmp/1rcpj1226508730.png") > system("convert tmp/2dy211226508730.ps tmp/2dy211226508730.png") > system("convert tmp/3cax01226508730.ps tmp/3cax01226508730.png") > system("convert tmp/4li3f1226508730.ps tmp/4li3f1226508730.png") > system("convert tmp/5m03n1226508730.ps tmp/5m03n1226508730.png") > > > proc.time() user system elapsed 1.308 0.809 1.952