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(4.8,4.8,4.7,4.7,4.7,4.6,5.0,5.4,5.5,5.6,5.6,5.8,6.0,6.1,6.1,6.0,6.0,6.1,6.5,7.1,7.4,7.4,7.5,7.6,7.8,7.8,7.7,7.6,7.5,7.3,7.6,8.0,8.8,7.9,7.8,7.7,7.8,7.7,7.5,7.3,7.1,7.0,7.3,7.8,7.9,7.9,7.8,7.8,7.9,7.8,7.6,7.4,7.2,6.9,7.1,7.5,7.6,7.4,7.3,7.2,7.3,7.2,7.1,7.0,6.9,6.8,7.2,7.6,7.7,7.6,7.5,7.5,7.6,7.6,7.6,7.5,7.3,7.2,7.4,8.0,8.2,8.0,7.7,7.7,7.8,7.8,7.7,7.5,7.3,7.1,7.1,7.2,6.8,6.6,6.4,6.4,6.5,6.3,5.9,5.5,5.2,4.9,5.4,5.8,5.7,5.6,5.5,5.4,5.4,5.4,5.5,5.8,5.7,5.4,5.6,5.8,6.2,6.8,6.7,6.7,6.4,6.3,6.3,6.4,6.3,6.0,6.3,6.3,6.6,7.5,7.8,7.9,7.8,7.6,7.5,7.6,7.5,7.3,7.6,7.5,7.6,7.9,7.9,8.1,8.2,8.0,7.5,6.8,6.5,6.6,7.6,8.0,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7.0,7.1) > #'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.3696813 0.3695308 0.3693801 0.3692293 0.3690783 0.3689272 0.3687759 [8] 0.3686245 0.3684730 0.3683213 0.3681695 0.3680175 0.3678654 0.3677132 [15] 0.3675608 0.3674083 0.3672557 0.3671029 0.3669500 0.3667969 0.3666437 [22] 0.3664904 0.3663369 0.3661833 0.3660296 0.3658758 0.3657218 0.3655677 [29] 0.3654134 0.3652591 0.3651046 0.3649499 0.3647952 0.3646403 0.3644853 [36] 0.3643302 0.3641749 0.3640195 0.3638640 0.3637084 0.3635527 0.3633968 [43] 0.3632408 0.3630847 0.3629285 0.3627722 0.3626157 0.3624591 0.3623024 [50] 0.3621456 0.3619887 0.3618317 0.3616745 0.3615173 0.3613599 0.3612024 [57] 0.3610448 0.3608871 0.3607293 0.3605713 0.3604133 0.3602552 0.3600969 [64] 0.3599386 0.3597801 0.3596215 0.3594629 0.3593041 0.3591452 0.3589862 [71] 0.3588271 0.3586680 0.3585087 0.3583493 0.3581898 0.3580302 0.3578705 [78] 0.3577108 0.3575509 0.3573909 0.3572308 0.3570707 0.3569104 0.3567501 [85] 0.3565896 0.3564291 0.3562685 0.3561078 0.3559470 0.3557861 0.3556251 [92] 0.3554640 0.3553029 0.3551416 0.3549803 0.3548189 0.3546574 0.3544958 [99] 0.3543341 0.3541724 0.3540105 0.3538486 0.3536866 0.3535246 0.3533624 [106] 0.3532002 0.3530379 0.3528755 0.3527130 0.3525505 0.3523878 0.3522251 [113] 0.3520624 0.3518995 0.3517366 0.3515736 0.3514106 0.3512475 0.3510843 [120] 0.3509210 0.3507576 0.3505942 0.3504308 0.3502672 0.3501036 0.3499399 [127] 0.3497762 0.3496124 0.3494485 0.3492846 0.3491206 0.3489566 0.3487924 [134] 0.3486283 0.3484640 0.3482997 0.3481354 0.3479710 0.3478065 0.3476420 [141] 0.3474774 0.3473127 0.3471480 0.3469833 0.3468185 0.3466536 0.3464887 [148] 0.3463238 0.3461587 0.3459937 0.3458286 0.3456634 0.3454982 0.3453329 [155] 0.3451676 0.3450023 0.3448369 0.3446715 0.3445060 0.3443404 0.3441749 [162] 0.3440092 0.3438436 0.3436779 0.3435121 0.3433463 0.3431805 0.3430147 [169] 0.3428488 0.3426828 0.3425168 0.3423508 0.3421848 0.3420187 0.3418526 [176] 0.3416864 0.3415202 0.3413540 0.3411877 0.3410215 0.3408551 0.3406888 [183] 0.3405224 0.3403560 0.3401896 0.3400231 0.3398566 0.3396901 0.3395235 [190] 0.3393570 0.3391904 0.3390237 0.3388571 0.3386904 0.3385237 0.3383570 [197] 0.3381903 0.3380235 0.3378567 0.3376899 0.3375231 0.3373563 0.3371894 [204] 0.3370226 0.3368557 0.3366888 0.3365218 0.3363549 0.3361879 0.3360210 [211] 0.3358540 0.3356870 0.3355200 0.3353530 0.3351860 0.3350189 0.3348519 [218] 0.3346848 0.3345177 0.3343507 0.3341836 0.3340165 0.3338494 0.3336823 [225] 0.3335152 0.3333480 0.3331809 0.3330138 0.3328467 0.3326795 0.3325124 [232] 0.3323452 0.3321781 0.3320110 0.3318438 0.3316767 0.3315096 0.3313424 [239] 0.3311753 0.3310081 0.3308410 0.3306739 0.3305068 0.3303396 0.3301725 [246] 0.3300054 0.3298383 0.3296712 0.3295041 0.3293371 0.3291700 0.3290029 [253] 0.3288359 0.3286688 0.3285018 0.3283348 0.3281678 0.3280008 0.3278338 [260] 0.3276668 0.3274998 0.3273329 0.3271660 0.3269990 0.3268321 0.3266653 [267] 0.3264984 0.3263315 0.3261647 0.3259979 0.3258311 0.3256643 0.3254975 [274] 0.3253308 0.3251641 0.3249974 0.3248307 0.3246640 0.3244974 0.3243308 [281] 0.3241642 0.3239976 0.3238311 0.3236646 0.3234981 0.3233316 0.3231652 [288] 0.3229987 0.3228324 0.3226660 0.3224997 0.3223334 0.3221671 0.3220008 [295] 0.3218346 0.3216684 0.3215023 0.3213361 0.3211700 0.3210040 0.3208380 [302] 0.3206720 0.3205060 0.3203401 0.3201742 0.3200083 0.3198425 0.3196767 [309] 0.3195109 0.3193452 0.3191795 0.3190139 0.3188483 0.3186827 0.3185172 [316] 0.3183517 0.3181862 0.3180208 0.3178554 0.3176901 0.3175248 0.3173596 [323] 0.3171944 0.3170292 0.3168641 0.3166990 0.3165339 0.3163690 0.3162040 [330] 0.3160391 0.3158742 0.3157094 0.3155446 0.3153799 0.3152152 0.3150506 [337] 0.3148860 0.3147215 0.3145570 0.3143926 0.3142282 0.3140638 0.3138995 [344] 0.3137353 0.3135711 0.3134070 0.3132429 0.3130788 0.3129149 0.3127509 [351] 0.3125870 0.3124232 0.3122594 0.3120957 0.3119320 0.3117684 0.3116049 [358] 0.3114414 0.3112779 0.3111145 0.3109512 0.3107879 0.3106247 0.3104615 [365] 0.3102984 0.3101353 0.3099724 0.3098094 0.3096465 0.3094837 0.3093210 [372] 0.3091583 0.3089956 0.3088330 0.3086705 0.3085081 0.3083457 0.3081833 [379] 0.3080211 0.3078589 0.3076967 0.3075346 0.3073726 0.3072106 0.3070488 [386] 0.3068869 0.3067252 0.3065635 0.3064018 0.3062403 0.3060788 0.3059173 [393] 0.3057559 0.3055946 0.3054334 0.3052722 0.3051111 0.3049501 0.3047891 [400] 0.3046282 0.3044674 > mx [1] 0.3696813 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/14zb61257799436.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/27n911257799436.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/3skew1257799436.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/4onyn1257799436.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/552km1257799436.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/6wado1257799436.tab") > system("convert tmp/14zb61257799436.ps tmp/14zb61257799436.png") > system("convert tmp/27n911257799436.ps tmp/27n911257799436.png") > system("convert tmp/3skew1257799436.ps tmp/3skew1257799436.png") > system("convert tmp/4onyn1257799436.ps tmp/4onyn1257799436.png") > system("convert tmp/552km1257799436.ps tmp/552km1257799436.png") > > > proc.time() user system elapsed 1.134 0.797 1.956