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(5014,6153,6441,5584,6427,6062,5589,6216,5809,4989,6706,7174,6122,8075,6292,6337,8576,6077,5931,6288,7167,6054,6468,6401,6927,7914,7728,8699,8522,6481,7502,7778,7424,6941,8574,9169,7701,9035,7158,8195,8124,7073,7017,7390,7776,6197,6889,7087,6485,7654,6501,6313,7826,6589,6729,5684,8105,6391,5901,6758) > #'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.3659586 0.3657670 0.3655750 0.3653827 0.3651901 0.3649971 0.3648038 [8] 0.3646102 0.3644163 0.3642220 0.3640273 0.3638324 0.3636371 0.3634415 [15] 0.3632455 0.3630493 0.3628527 0.3626558 0.3624585 0.3622609 0.3620631 [22] 0.3618649 0.3616663 0.3614675 0.3612683 0.3610688 0.3608691 0.3606689 [29] 0.3604685 0.3602678 0.3600667 0.3598654 0.3596637 0.3594617 0.3592594 [36] 0.3590568 0.3588539 0.3586507 0.3584472 0.3582434 0.3580393 0.3578349 [43] 0.3576302 0.3574251 0.3572198 0.3570142 0.3568083 0.3566021 0.3563956 [50] 0.3561888 0.3559817 0.3557743 0.3555667 0.3553587 0.3551505 0.3549419 [57] 0.3547331 0.3545240 0.3543146 0.3541049 0.3538950 0.3536847 0.3534742 [64] 0.3532634 0.3530523 0.3528410 0.3526294 0.3524175 0.3522053 0.3519928 [71] 0.3517801 0.3515671 0.3513538 0.3511403 0.3509265 0.3507124 0.3504981 [78] 0.3502835 0.3500686 0.3498535 0.3496381 0.3494224 0.3492065 0.3489904 [85] 0.3487739 0.3485572 0.3483403 0.3481231 0.3479057 0.3476880 0.3474700 [92] 0.3472518 0.3470333 0.3468146 0.3465957 0.3463765 0.3461571 0.3459374 [99] 0.3457174 0.3454973 0.3452769 0.3450562 0.3448353 0.3446142 0.3443928 [106] 0.3441712 0.3439494 0.3437273 0.3435050 0.3432825 0.3430597 0.3428367 [113] 0.3426135 0.3423901 0.3421664 0.3419425 0.3417184 0.3414940 0.3412694 [120] 0.3410447 0.3408196 0.3405944 0.3403690 0.3401433 0.3399174 0.3396913 [127] 0.3394650 0.3392385 0.3390118 0.3387848 0.3385577 0.3383303 0.3381028 [134] 0.3378750 0.3376470 0.3374188 0.3371905 0.3369619 0.3367331 0.3365041 [141] 0.3362749 0.3360456 0.3358160 0.3355862 0.3353562 0.3351261 0.3348957 [148] 0.3346652 0.3344345 0.3342036 0.3339724 0.3337412 0.3335097 0.3332780 [155] 0.3330462 0.3328141 0.3325819 0.3323495 0.3321170 0.3318842 0.3316513 [162] 0.3314182 0.3311849 0.3309515 0.3307178 0.3304840 0.3302501 0.3300159 [169] 0.3297816 0.3295472 0.3293125 0.3290777 0.3288427 0.3286076 0.3283723 [176] 0.3281369 0.3279013 0.3276655 0.3274295 0.3271935 0.3269572 0.3267208 [183] 0.3264843 0.3262476 0.3260107 0.3257737 0.3255365 0.3252992 0.3250618 [190] 0.3248242 0.3245864 0.3243485 0.3241105 0.3238723 0.3236340 0.3233956 [197] 0.3231570 0.3229182 0.3226794 0.3224404 0.3222012 0.3219619 0.3217225 [204] 0.3214830 0.3212433 0.3210035 0.3207636 0.3205235 0.3202834 0.3200431 [211] 0.3198026 0.3195621 0.3193214 0.3190806 0.3188397 0.3185986 0.3183575 [218] 0.3181162 0.3178748 0.3176333 0.3173917 0.3171499 0.3169081 0.3166661 [225] 0.3164241 0.3161819 0.3159396 0.3156972 0.3154547 0.3152121 0.3149694 [232] 0.3147266 0.3144837 0.3142407 0.3139976 0.3137544 0.3135111 0.3132676 [239] 0.3130241 0.3127805 0.3125369 0.3122931 0.3120492 0.3118052 0.3115612 [246] 0.3113170 0.3110728 0.3108285 0.3105841 0.3103396 0.3100950 0.3098503 [253] 0.3096056 0.3093608 0.3091159 0.3088709 0.3086258 0.3083807 0.3081355 [260] 0.3078902 0.3076448 0.3073994 0.3071539 0.3069083 0.3066626 0.3064169 [267] 0.3061711 0.3059253 0.3056793 0.3054334 0.3051873 0.3049412 0.3046950 [274] 0.3044488 0.3042025 0.3039561 0.3037097 0.3034632 0.3032167 0.3029701 [281] 0.3027234 0.3024767 0.3022300 0.3019832 0.3017363 0.3014894 0.3012424 [288] 0.3009954 0.3007484 0.3005013 0.3002541 0.3000069 0.2997597 0.2995124 [295] 0.2992651 0.2990177 0.2987703 0.2985229 0.2982754 0.2980279 0.2977803 [302] 0.2975327 0.2972851 0.2970374 0.2967897 0.2965420 0.2962942 0.2960464 [309] 0.2957986 0.2955508 0.2953029 0.2950550 0.2948071 0.2945591 0.2943111 [316] 0.2940631 0.2938151 0.2935671 0.2933190 0.2930709 0.2928228 0.2925747 [323] 0.2923265 0.2920784 0.2918302 0.2915820 0.2913338 0.2910856 0.2908374 [330] 0.2905891 0.2903409 0.2900926 0.2898444 0.2895961 0.2893478 0.2890995 [337] 0.2888512 0.2886029 0.2883546 0.2881063 0.2878580 0.2876097 0.2873614 [344] 0.2871131 0.2868648 0.2866165 0.2863682 0.2861199 0.2858716 0.2856233 [351] 0.2853750 0.2851268 0.2848785 0.2846302 0.2843820 0.2841338 0.2838855 [358] 0.2836373 0.2833891 0.2831409 0.2828928 0.2826446 0.2823965 0.2821483 [365] 0.2819002 0.2816521 0.2814041 0.2811560 0.2809080 0.2806600 0.2804120 [372] 0.2801640 0.2799161 0.2796681 0.2794202 0.2791724 0.2789245 0.2786767 [379] 0.2784289 0.2781812 0.2779335 0.2776858 0.2774381 0.2771905 0.2769429 [386] 0.2766953 0.2764478 0.2762003 0.2759528 0.2757054 0.2754580 0.2752106 [393] 0.2749633 0.2747161 0.2744688 0.2742216 0.2739745 0.2737274 0.2734803 [400] 0.2732333 0.2729863 > mx [1] 0.3659586 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1wsh91227560122.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/2xl9x1227560122.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/39kxt1227560122.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/48z471227560122.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/5tq3d1227560122.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/60cvh1227560122.tab") > > system("convert tmp/1wsh91227560122.ps tmp/1wsh91227560122.png") > system("convert tmp/2xl9x1227560122.ps tmp/2xl9x1227560122.png") > system("convert tmp/39kxt1227560122.ps tmp/39kxt1227560122.png") > system("convert tmp/48z471227560122.ps tmp/48z471227560122.png") > system("convert tmp/5tq3d1227560122.ps tmp/5tq3d1227560122.png") > > > proc.time() user system elapsed 1.082 0.780 1.307