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(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,104.5,139.8,136.5,112.1,118.5,94.4,102.3,111.4,99.2,87.8,115.8) > #'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.3048072 0.3047597 0.3047121 0.3046646 0.3046170 0.3045695 0.3045220 [8] 0.3044746 0.3044271 0.3043796 0.3043322 0.3042848 0.3042374 0.3041900 [15] 0.3041426 0.3040952 0.3040479 0.3040005 0.3039532 0.3039059 0.3038586 [22] 0.3038113 0.3037640 0.3037167 0.3036695 0.3036222 0.3035750 0.3035278 [29] 0.3034806 0.3034334 0.3033862 0.3033390 0.3032919 0.3032447 0.3031976 [36] 0.3031504 0.3031033 0.3030562 0.3030091 0.3029620 0.3029150 0.3028679 [43] 0.3028208 0.3027738 0.3027267 0.3026797 0.3026327 0.3025857 0.3025387 [50] 0.3024917 0.3024447 0.3023977 0.3023508 0.3023038 0.3022569 0.3022099 [57] 0.3021630 0.3021161 0.3020691 0.3020222 0.3019753 0.3019284 0.3018815 [64] 0.3018346 0.3017878 0.3017409 0.3016940 0.3016472 0.3016003 0.3015535 [71] 0.3015066 0.3014598 0.3014130 0.3013662 0.3013193 0.3012725 0.3012257 [78] 0.3011789 0.3011321 0.3010853 0.3010386 0.3009918 0.3009450 0.3008982 [85] 0.3008514 0.3008047 0.3007579 0.3007112 0.3006644 0.3006176 0.3005709 [92] 0.3005241 0.3004774 0.3004307 0.3003839 0.3003372 0.3002905 0.3002437 [99] 0.3001970 0.3001503 0.3001035 0.3000568 0.3000101 0.2999634 0.2999166 [106] 0.2998699 0.2998232 0.2997765 0.2997298 0.2996830 0.2996363 0.2995896 [113] 0.2995429 0.2994962 0.2994494 0.2994027 0.2993560 0.2993093 0.2992626 [120] 0.2992158 0.2991691 0.2991224 0.2990757 0.2990289 0.2989822 0.2989355 [127] 0.2988887 0.2988420 0.2987953 0.2987485 0.2987018 0.2986550 0.2986083 [134] 0.2985615 0.2985148 0.2984680 0.2984212 0.2983745 0.2983277 0.2982809 [141] 0.2982341 0.2981874 0.2981406 0.2980938 0.2980470 0.2980002 0.2979534 [148] 0.2979066 0.2978598 0.2978129 0.2977661 0.2977193 0.2976724 0.2976256 [155] 0.2975787 0.2975319 0.2974850 0.2974381 0.2973913 0.2973444 0.2972975 [162] 0.2972506 0.2972037 0.2971568 0.2971098 0.2970629 0.2970160 0.2969690 [169] 0.2969221 0.2968751 0.2968282 0.2967812 0.2967342 0.2966872 0.2966402 [176] 0.2965932 0.2965462 0.2964991 0.2964521 0.2964050 0.2963580 0.2963109 [183] 0.2962638 0.2962167 0.2961696 0.2961225 0.2960754 0.2960283 0.2959811 [190] 0.2959340 0.2958868 0.2958396 0.2957925 0.2957453 0.2956980 0.2956508 [197] 0.2956036 0.2955563 0.2955091 0.2954618 0.2954145 0.2953672 0.2953199 [204] 0.2952726 0.2952253 0.2951779 0.2951306 0.2950832 0.2950358 0.2949884 [211] 0.2949410 0.2948935 0.2948461 0.2947986 0.2947512 0.2947037 0.2946562 [218] 0.2946087 0.2945611 0.2945136 0.2944660 0.2944184 0.2943708 0.2943232 [225] 0.2942756 0.2942280 0.2941803 0.2941326 0.2940850 0.2940373 0.2939895 [232] 0.2939418 0.2938940 0.2938463 0.2937985 0.2937507 0.2937028 0.2936550 [239] 0.2936072 0.2935593 0.2935114 0.2934635 0.2934155 0.2933676 0.2933196 [246] 0.2932716 0.2932236 0.2931756 0.2931276 0.2930795 0.2930314 0.2929833 [253] 0.2929352 0.2928871 0.2928389 0.2927908 0.2927426 0.2926944 0.2926461 [260] 0.2925979 0.2925496 0.2925013 0.2924530 0.2924046 0.2923563 0.2923079 [267] 0.2922595 0.2922111 0.2921627 0.2921142 0.2920657 0.2920172 0.2919687 [274] 0.2919201 0.2918716 0.2918230 0.2917743 0.2917257 0.2916770 0.2916284 [281] 0.2915797 0.2915309 0.2914822 0.2914334 0.2913846 0.2913358 0.2912869 [288] 0.2912381 0.2911892 0.2911403 0.2910913 0.2910424 0.2909934 0.2909444 [295] 0.2908953 0.2908463 0.2907972 0.2907481 0.2906990 0.2906498 0.2906006 [302] 0.2905514 0.2905022 0.2904529 0.2904037 0.2903543 0.2903050 0.2902557 [309] 0.2902063 0.2901569 0.2901074 0.2900580 0.2900085 0.2899590 0.2899094 [316] 0.2898599 0.2898103 0.2897606 0.2897110 0.2896613 0.2896116 0.2895619 [323] 0.2895121 0.2894623 0.2894125 0.2893627 0.2893128 0.2892629 0.2892130 [330] 0.2891631 0.2891131 0.2890631 0.2890131 0.2889630 0.2889129 0.2888628 [337] 0.2888126 0.2887625 0.2887123 0.2886620 0.2886118 0.2885615 0.2885111 [344] 0.2884608 0.2884104 0.2883600 0.2883096 0.2882591 0.2882086 0.2881581 [351] 0.2881075 0.2880569 0.2880063 0.2879557 0.2879050 0.2878543 0.2878035 [358] 0.2877528 0.2877020 0.2876511 0.2876003 0.2875494 0.2874985 0.2874475 [365] 0.2873965 0.2873455 0.2872945 0.2872434 0.2871923 0.2871411 0.2870899 [372] 0.2870387 0.2869875 0.2869362 0.2868849 0.2868336 0.2867822 0.2867308 [379] 0.2866794 0.2866279 0.2865764 0.2865249 0.2864733 0.2864217 0.2863701 [386] 0.2863185 0.2862668 0.2862150 0.2861633 0.2861115 0.2860597 0.2860078 [393] 0.2859559 0.2859040 0.2858520 0.2858000 0.2857480 0.2856959 0.2856438 [400] 0.2855917 0.2855396 > mx [1] 0.3048072 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1tfst1257691030.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/26f0d1257691030.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/3bqv81257691030.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/4gjsw1257691030.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/5x8c51257691030.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/6xc9v1257691030.tab") > > system("convert tmp/1tfst1257691030.ps tmp/1tfst1257691030.png") > system("convert tmp/26f0d1257691030.ps tmp/26f0d1257691030.png") > system("convert tmp/3bqv81257691030.ps tmp/3bqv81257691030.png") > system("convert tmp/4gjsw1257691030.ps tmp/4gjsw1257691030.png") > system("convert tmp/5x8c51257691030.ps tmp/5x8c51257691030.png") > > > proc.time() user system elapsed 1.081 0.780 1.979