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(258778,252791,256389,258961,258647,256304,250498,247883,249552,262626,264416,273049,272441,267564,265952,263937,264765,263386,258985,257334,257477,271486,274488,281274,272674,269704,268227,276444,272247,268516,263406,263619,265905,281681,287413,289423,281242,273878,269022,272630,270287,260447,262248,252806,238663,258438,266719,263279,258064,248828,248284,253376,251846,239494,239709,228793,229521,249999,254016,251178) > #'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.3056645 -0.3055682 -0.3054723 -0.3053526 -0.3052555 -0.3051502 [7] -0.3050513 -0.3049515 -0.3048481 -0.3047429 -0.3046429 -0.3045387 [13] -0.3044373 -0.3043339 -0.3042305 -0.3041282 -0.3040266 -0.3039221 [19] -0.3038210 -0.3037173 -0.3036149 -0.3035116 -0.3034096 -0.3033057 [25] -0.3032023 -0.3030999 -0.3029959 -0.3028929 -0.3027897 -0.3026861 [31] -0.3025826 -0.3024793 -0.3023758 -0.3022723 -0.3021685 -0.3020649 [37] -0.3019613 -0.3018575 -0.3017536 -0.3016498 -0.3015460 -0.3014420 [43] -0.3013380 -0.3012339 -0.3011298 -0.3010257 -0.3009214 -0.3008173 [49] -0.3007129 -0.3006086 -0.3005042 -0.3003998 -0.3002953 -0.3001908 [55] -0.3000862 -0.2999816 -0.2998769 -0.2997722 -0.2996674 -0.2995626 [61] -0.2994577 -0.2993528 -0.2992479 -0.2991429 -0.2990378 -0.2989327 [67] -0.2988276 -0.2987224 -0.2986171 -0.2985119 -0.2984065 -0.2983012 [73] -0.2981957 -0.2980903 -0.2979847 -0.2978792 -0.2977736 -0.2976679 [79] -0.2975622 -0.2974565 -0.2973507 -0.2972448 -0.2971390 -0.2970330 [85] -0.2969271 -0.2968210 -0.2967150 -0.2966089 -0.2965027 -0.2963965 [91] -0.2962903 -0.2961840 -0.2960776 -0.2959713 -0.2958648 -0.2957584 [97] -0.2956519 -0.2955453 -0.2954387 -0.2953321 -0.2952254 -0.2951186 [103] -0.2950118 -0.2949050 -0.2947982 -0.2946912 -0.2945843 -0.2944773 [109] -0.2943702 -0.2942632 -0.2941560 -0.2940489 -0.2939416 -0.2938344 [115] -0.2937271 -0.2936197 -0.2935123 -0.2934049 -0.2932974 -0.2931899 [121] -0.2930824 -0.2929748 -0.2928671 -0.2927594 -0.2926517 -0.2925439 [127] -0.2924361 -0.2923282 -0.2922203 -0.2921124 -0.2920044 -0.2918964 [133] -0.2917883 -0.2916802 -0.2915720 -0.2914639 -0.2913556 -0.2912473 [139] -0.2911390 -0.2910307 -0.2909223 -0.2908138 -0.2907053 -0.2905968 [145] -0.2904882 -0.2903796 -0.2902710 -0.2901623 -0.2900536 -0.2899448 [151] -0.2898360 -0.2897271 -0.2896183 -0.2895093 -0.2894004 -0.2892913 [157] -0.2891823 -0.2890732 -0.2889641 -0.2888549 -0.2887457 -0.2886364 [163] -0.2885271 -0.2884178 -0.2883084 -0.2881990 -0.2880896 -0.2879801 [169] -0.2878706 -0.2877610 -0.2876514 -0.2875418 -0.2874321 -0.2873224 [175] -0.2872126 -0.2871028 -0.2869930 -0.2868831 -0.2867732 -0.2866632 [181] -0.2865532 -0.2864432 -0.2863331 -0.2862230 -0.2861129 -0.2860027 [187] -0.2858925 -0.2857822 -0.2856719 -0.2855616 -0.2854512 -0.2853408 [193] -0.2852304 -0.2851199 -0.2850094 -0.2848988 -0.2847883 -0.2846776 [199] -0.2845670 -0.2844563 -0.2843455 -0.2842347 -0.2841239 -0.2840131 [205] -0.2839022 -0.2837913 -0.2836803 -0.2835693 -0.2834583 -0.2833472 [211] -0.2832361 -0.2831250 -0.2830138 -0.2829026 -0.2827914 -0.2826801 [217] -0.2825688 -0.2824574 -0.2823460 -0.2822346 -0.2821231 -0.2820117 [223] -0.2819001 -0.2817886 -0.2816770 -0.2815653 -0.2814537 -0.2813420 [229] -0.2812302 -0.2811185 -0.2810067 -0.2808948 -0.2807830 -0.2806710 [235] -0.2805591 -0.2804471 -0.2803351 -0.2802231 -0.2801110 -0.2799989 [241] -0.2798868 -0.2797746 -0.2796624 -0.2795501 -0.2794378 -0.2793255 [247] -0.2792132 -0.2791008 -0.2789884 -0.2788760 -0.2787635 -0.2786510 [253] -0.2785384 -0.2784259 -0.2783133 -0.2782006 -0.2780879 -0.2779752 [259] -0.2778625 -0.2777497 -0.2776369 -0.2775241 -0.2774113 -0.2772984 [265] -0.2771854 -0.2770725 -0.2769595 -0.2768465 -0.2767334 -0.2766203 [271] -0.2765072 -0.2763941 -0.2762809 -0.2761677 -0.2760544 -0.2759412 [277] -0.2758279 -0.2757145 -0.2756012 -0.2754878 -0.2753744 -0.2752609 [283] -0.2751474 -0.2750339 -0.2749204 -0.2748068 -0.2746932 -0.2745796 [289] -0.2744659 -0.2743522 -0.2742385 -0.2741247 -0.2740109 -0.2738971 [295] -0.2737833 -0.2736694 -0.2735555 -0.2734416 -0.2733276 -0.2732136 [301] -0.2730996 -0.2729856 -0.2728715 -0.2727574 -0.2726433 -0.2725291 [307] -0.2724149 -0.2723007 -0.2721865 -0.2720722 -0.2719579 -0.2718436 [313] -0.2717292 -0.2716148 -0.2715004 -0.2713860 -0.2712715 -0.2711570 [319] -0.2710425 -0.2709279 -0.2708133 -0.2706987 -0.2705841 -0.2704695 [325] -0.2703548 -0.2702401 -0.2701253 -0.2700105 -0.2698958 -0.2697809 [331] -0.2696661 -0.2695512 -0.2694363 -0.2693214 -0.2692064 -0.2690915 [337] -0.2689765 -0.2688614 -0.2687464 -0.2686313 -0.2685162 -0.2684010 [343] -0.2682859 -0.2681707 -0.2680555 -0.2679403 -0.2678250 -0.2677097 [349] -0.2675944 -0.2674791 -0.2673637 -0.2672483 -0.2671329 -0.2670175 [355] -0.2669020 -0.2667865 -0.2666710 -0.2665555 -0.2664399 -0.2663243 [361] -0.2662087 -0.2660931 -0.2659774 -0.2658618 -0.2657461 -0.2656303 [367] -0.2655146 -0.2653988 -0.2652830 -0.2651672 -0.2650514 -0.2649355 [373] -0.2648196 -0.2647037 -0.2645877 -0.2644718 -0.2643558 -0.2642398 [379] -0.2641238 -0.2640077 -0.2638916 -0.2637755 -0.2636594 -0.2635433 [385] -0.2634271 -0.2633109 -0.2631947 -0.2630785 -0.2629622 -0.2628460 [391] -0.2627297 -0.2626134 -0.2624970 -0.2623807 -0.2622643 -0.2621479 [397] -0.2620314 -0.2619150 -0.2617985 -0.2616820 -0.2615655 > 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/1v0w41229271136.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/2olyx1229271136.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/3o2kl1229271136.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/4m0m41229271136.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/5tapu1229271136.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/697341229271136.tab") > > system("convert tmp/1v0w41229271136.ps tmp/1v0w41229271136.png") > system("convert tmp/2olyx1229271136.ps tmp/2olyx1229271136.png") > system("convert tmp/3o2kl1229271136.ps tmp/3o2kl1229271136.png") > system("convert tmp/4m0m41229271136.ps tmp/4m0m41229271136.png") > system("convert tmp/5tapu1229271136.ps tmp/5tapu1229271136.png") > > > proc.time() user system elapsed 1.108 0.808 2.558