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(2.97,3.04,3.12,3.21,3.34,3.45,3.74,4.02,4.24,4.87,5.62,6.02,5.98,5.89,5.76,5.58,5.39,5.19,5.16,5.2,5.25,5.26,5.21,5.18,5.13,5.03,5.01,4.87,4.86,4.82,4.69,4.65,4.61,4.47,4.37,4.29,4.2,4.19,4.09,3.88,3.87,3.74,3.61,3.43,3.29,3.18,3.07,3.02,2.97,2.98,3.01,3.06,3.12,3.16,3.19,3.21,3.27,3.36,3.45,3.52,3.58,3.62,3.5,3.43,3.41,3.48,3.63,3.76,3.8,3.72,3.67,3.58,3.47,3.43,3.55,3.65,3.7,3.7,3.93,4.15,4.24) > #'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.2375778 -0.2380133 -0.2384487 -0.2388839 -0.2393189 -0.2397538 [7] -0.2401885 -0.2406231 -0.2410575 -0.2414917 -0.2419257 -0.2423596 [13] -0.2427933 -0.2432268 -0.2436602 -0.2440933 -0.2445263 -0.2449591 [19] -0.2453917 -0.2458241 -0.2462563 -0.2466883 -0.2471201 -0.2475518 [25] -0.2479832 -0.2484144 -0.2488454 -0.2492762 -0.2497068 -0.2501372 [31] -0.2505673 -0.2509973 -0.2514270 -0.2518565 -0.2522858 -0.2527149 [37] -0.2531437 -0.2535723 -0.2540007 -0.2544288 -0.2548567 -0.2552844 [43] -0.2557118 -0.2561390 -0.2565659 -0.2569926 -0.2574190 -0.2578452 [49] -0.2582712 -0.2586968 -0.2591223 -0.2595474 -0.2599723 -0.2603970 [55] -0.2608213 -0.2612454 -0.2616693 -0.2620928 -0.2625161 -0.2629391 [61] -0.2633618 -0.2637843 -0.2642064 -0.2646283 -0.2650499 -0.2654712 [67] -0.2658922 -0.2663129 -0.2667333 -0.2671535 -0.2675733 -0.2679928 [73] -0.2684120 -0.2688309 -0.2692495 -0.2696678 -0.2700858 -0.2705034 [79] -0.2709208 -0.2713378 -0.2717545 -0.2721709 -0.2725869 -0.2730026 [85] -0.2734180 -0.2738331 -0.2742478 -0.2746622 -0.2750763 -0.2754900 [91] -0.2759033 -0.2763164 -0.2767290 -0.2771414 -0.2775533 -0.2779650 [97] -0.2783762 -0.2787871 -0.2791977 -0.2796079 -0.2800177 -0.2804272 [103] -0.2808363 -0.2812450 -0.2816533 -0.2820613 -0.2824689 -0.2828761 [109] -0.2832830 -0.2836895 -0.2840955 -0.2845012 -0.2849065 -0.2853114 [115] -0.2857160 -0.2861201 -0.2865238 -0.2869272 -0.2873301 -0.2877326 [121] -0.2881347 -0.2885365 -0.2889378 -0.2893387 -0.2897392 -0.2901392 [127] -0.2905389 -0.2909381 -0.2913370 -0.2917354 -0.2921333 -0.2925309 [133] -0.2929280 -0.2933247 -0.2937209 -0.2941168 -0.2945122 -0.2949071 [139] -0.2953016 -0.2956957 -0.2960893 -0.2964825 -0.2968752 -0.2972675 [145] -0.2976593 -0.2980507 -0.2984416 -0.2988321 -0.2992221 -0.2996116 [151] -0.3000007 -0.3003893 -0.3007774 -0.3011651 -0.3015523 -0.3019391 [157] -0.3023253 -0.3027111 -0.3030964 -0.3034812 -0.3038656 -0.3042494 [163] -0.3046328 -0.3050157 -0.3053981 -0.3057800 -0.3061614 -0.3065423 [169] -0.3069227 -0.3073027 -0.3076821 -0.3080610 -0.3084394 -0.3088173 [175] -0.3091947 -0.3095716 -0.3099480 -0.3103239 -0.3106992 -0.3110741 [181] -0.3114484 -0.3118222 -0.3121955 -0.3125682 -0.3129405 -0.3133122 [187] -0.3136833 -0.3140540 -0.3144241 -0.3147937 -0.3151627 -0.3155312 [193] -0.3158992 -0.3162666 -0.3166335 -0.3169998 -0.3173656 -0.3177309 [199] -0.3180956 -0.3184597 -0.3188233 -0.3191864 -0.3195488 -0.3199108 [205] -0.3202721 -0.3206330 -0.3209932 -0.3213529 -0.3217120 -0.3220706 [211] -0.3224285 -0.3227859 -0.3231428 -0.3234991 -0.3238547 -0.3242099 [217] -0.3245644 -0.3249184 -0.3252717 -0.3256245 -0.3259767 -0.3263284 [223] -0.3266794 -0.3270298 -0.3273797 -0.3277290 -0.3280776 -0.3284257 [229] -0.3287732 -0.3291201 -0.3294664 -0.3298121 -0.3301571 -0.3305016 [235] -0.3308455 -0.3311888 -0.3315314 -0.3318735 -0.3322149 -0.3325557 [241] -0.3328959 -0.3332355 -0.3335745 -0.3339129 -0.3342506 -0.3345878 [247] -0.3349243 -0.3352601 -0.3355954 -0.3359300 -0.3362640 -0.3365974 [253] -0.3369301 -0.3372623 -0.3375937 -0.3379246 -0.3382548 -0.3385844 [259] -0.3389133 -0.3392416 -0.3395692 -0.3398963 -0.3402226 -0.3405484 [265] -0.3408734 -0.3411979 -0.3415217 -0.3418448 -0.3421673 -0.3424891 [271] -0.3428103 -0.3431308 -0.3434507 -0.3437699 -0.3440885 -0.3444064 [277] -0.3447236 -0.3450402 -0.3453561 -0.3456714 -0.3459860 -0.3462999 [283] -0.3466132 -0.3469257 -0.3472377 -0.3475489 -0.3478595 -0.3481694 [289] -0.3484786 -0.3487872 -0.3490951 -0.3494023 -0.3497088 -0.3500147 [295] -0.3503199 -0.3506244 -0.3509282 -0.3512313 -0.3515337 -0.3518355 [301] -0.3521366 -0.3524370 -0.3527367 -0.3530357 -0.3533340 -0.3536317 [307] -0.3539286 -0.3542249 -0.3545204 -0.3548153 -0.3551094 -0.3554029 [313] -0.3556957 -0.3559878 -0.3562792 -0.3565698 -0.3568598 -0.3571491 [319] -0.3574377 -0.3577256 -0.3580127 -0.3582992 -0.3585850 -0.3588700 [325] -0.3591544 -0.3594380 -0.3597209 -0.3600032 -0.3602847 -0.3605655 [331] -0.3608456 -0.3611249 -0.3614036 -0.3616816 -0.3619588 -0.3622353 [337] -0.3625111 -0.3627862 -0.3630606 -0.3633343 -0.3636072 -0.3638794 [343] -0.3641509 -0.3644217 -0.3646917 -0.3649611 -0.3652297 -0.3654976 [349] -0.3657647 -0.3660312 -0.3662969 -0.3665619 -0.3668261 -0.3670897 [355] -0.3673525 -0.3676146 -0.3678759 -0.3681365 -0.3683964 -0.3686556 [361] -0.3689140 -0.3691717 -0.3694287 -0.3696849 -0.3699404 -0.3701952 [367] -0.3704492 -0.3707025 -0.3709551 -0.3712069 -0.3714580 -0.3717084 [373] -0.3719580 -0.3722069 -0.3724550 -0.3727025 -0.3729491 -0.3731951 [379] -0.3734403 -0.3736847 -0.3739284 -0.3741714 -0.3744137 -0.3746551 [385] -0.3748959 -0.3751359 -0.3753752 -0.3756137 -0.3758515 -0.3760885 [391] -0.3763248 -0.3765604 -0.3767952 -0.3770293 -0.3772626 -0.3774952 [397] -0.3777270 -0.3779581 -0.3781885 -0.3784181 -0.3786469 > 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/1hvtx1258036129.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/2aihl1258036129.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/3aor71258036129.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/4iohy1258036129.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/5wfxo1258036129.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/6amwt1258036129.tab") > > system("convert tmp/1hvtx1258036129.ps tmp/1hvtx1258036129.png") > system("convert tmp/2aihl1258036129.ps tmp/2aihl1258036129.png") > system("convert tmp/3aor71258036129.ps tmp/3aor71258036129.png") > system("convert tmp/4iohy1258036129.ps tmp/4iohy1258036129.png") > system("convert tmp/5wfxo1258036129.ps tmp/5wfxo1258036129.png") > > > proc.time() user system elapsed 1.085 0.782 1.314