R version 2.7.2 (2008-08-25) 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(156.4,143.1,148.9,134,118,125.3,138,114,109.9,151.5,129.1,121.7,126.1,114.3,124.7,111.9,120,119.5,137.8,105.4,135.4,182.5,129.6,147.5,128.9,119.7,149.4,136.6,118.6,121.4,138.9,109.5,131.7,160.3,138.1,136.7,126.6,138,152,137,134.9,154.4,145.2,133.1,169.6,159.3,124.9,138.1,162.5,136.6,148.1,142,137.9,152.5,182.8,135.3,141.8,151.7,140.6,128) > #'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.3080624 0.3080212 0.3079797 0.3079380 0.3078961 0.3078539 0.3078115 [8] 0.3077689 0.3077261 0.3076830 0.3076397 0.3075961 0.3075524 0.3075084 [15] 0.3074641 0.3074196 0.3073749 0.3073300 0.3072848 0.3072394 0.3071938 [22] 0.3071479 0.3071018 0.3070555 0.3070090 0.3069622 0.3069151 0.3068679 [29] 0.3068204 0.3067727 0.3067247 0.3066765 0.3066281 0.3065795 0.3065306 [36] 0.3064815 0.3064321 0.3063825 0.3063327 0.3062827 0.3062324 0.3061819 [43] 0.3061311 0.3060802 0.3060290 0.3059775 0.3059258 0.3058739 0.3058218 [50] 0.3057694 0.3057168 0.3056640 0.3056109 0.3055576 0.3055041 0.3054503 [57] 0.3053963 0.3053421 0.3052876 0.3052329 0.3051780 0.3051228 0.3050675 [64] 0.3050118 0.3049560 0.3048999 0.3048436 0.3047870 0.3047302 0.3046732 [71] 0.3046160 0.3045585 0.3045008 0.3044428 0.3043846 0.3043262 0.3042676 [78] 0.3042087 0.3041496 0.3040903 0.3040307 0.3039709 0.3039108 0.3038506 [85] 0.3037901 0.3037294 0.3036684 0.3036072 0.3035458 0.3034841 0.3034222 [92] 0.3033601 0.3032978 0.3032352 0.3031724 0.3031093 0.3030461 0.3029826 [99] 0.3029188 0.3028549 0.3027907 0.3027262 0.3026616 0.3025967 0.3025316 [106] 0.3024662 0.3024006 0.3023348 0.3022688 0.3022025 0.3021360 0.3020693 [113] 0.3020023 0.3019351 0.3018677 0.3018001 0.3017322 0.3016641 0.3015958 [120] 0.3015272 0.3014584 0.3013894 0.3013201 0.3012506 0.3011809 0.3011110 [127] 0.3010408 0.3009704 0.3008998 0.3008289 0.3007579 0.3006866 0.3006150 [134] 0.3005433 0.3004713 0.3003990 0.3003266 0.3002539 0.3001810 0.3001079 [141] 0.3000345 0.2999610 0.2998872 0.2998131 0.2997389 0.2996644 0.2995897 [148] 0.2995147 0.2994396 0.2993642 0.2992886 0.2992127 0.2991366 0.2990604 [155] 0.2989838 0.2989071 0.2988301 0.2987529 0.2986755 0.2985979 0.2985200 [162] 0.2984419 0.2983636 0.2982851 0.2982063 0.2981273 0.2980481 0.2979687 [169] 0.2978891 0.2978092 0.2977291 0.2976488 0.2975682 0.2974875 0.2974065 [176] 0.2973253 0.2972438 0.2971622 0.2970803 0.2969982 0.2969159 0.2968334 [183] 0.2967506 0.2966677 0.2965845 0.2965011 0.2964174 0.2963336 0.2962495 [190] 0.2961652 0.2960807 0.2959960 0.2959110 0.2958259 0.2957405 0.2956549 [197] 0.2955691 0.2954830 0.2953968 0.2953103 0.2952236 0.2951367 0.2950496 [204] 0.2949623 0.2948747 0.2947869 0.2946990 0.2946108 0.2945224 0.2944337 [211] 0.2943449 0.2942558 0.2941666 0.2940771 0.2939874 0.2938975 0.2938073 [218] 0.2937170 0.2936264 0.2935357 0.2934447 0.2933535 0.2932621 0.2931705 [225] 0.2930787 0.2929867 0.2928944 0.2928020 0.2927093 0.2926164 0.2925233 [232] 0.2924300 0.2923365 0.2922428 0.2921489 0.2920548 0.2919604 0.2918659 [239] 0.2917711 0.2916762 0.2915810 0.2914856 0.2913901 0.2912943 0.2911983 [246] 0.2911021 0.2910057 0.2909091 0.2908123 0.2907152 0.2906180 0.2905206 [253] 0.2904230 0.2903251 0.2902271 0.2901289 0.2900304 0.2899318 0.2898329 [260] 0.2897339 0.2896346 0.2895352 0.2894355 0.2893357 0.2892356 0.2891354 [267] 0.2890349 0.2889343 0.2888334 0.2887324 0.2886311 0.2885297 0.2884280 [274] 0.2883262 0.2882242 0.2881219 0.2880195 0.2879169 0.2878140 0.2877110 [281] 0.2876078 0.2875044 0.2874008 0.2872970 0.2871930 0.2870889 0.2869845 [288] 0.2868799 0.2867752 0.2866702 0.2865651 0.2864597 0.2863542 0.2862485 [295] 0.2861426 0.2860365 0.2859302 0.2858237 0.2857171 0.2856102 0.2855032 [302] 0.2853959 0.2852885 0.2851809 0.2850731 0.2849652 0.2848570 0.2847487 [309] 0.2846401 0.2845314 0.2844225 0.2843134 0.2842042 0.2840947 0.2839851 [316] 0.2838753 0.2837653 0.2836551 0.2835447 0.2834342 0.2833234 0.2832125 [323] 0.2831015 0.2829902 0.2828788 0.2827671 0.2826553 0.2825434 0.2824312 [330] 0.2823189 0.2822064 0.2820937 0.2819808 0.2818678 0.2817546 0.2816412 [337] 0.2815276 0.2814139 0.2813000 0.2811859 0.2810716 0.2809572 0.2808426 [344] 0.2807279 0.2806129 0.2804978 0.2803825 0.2802671 0.2801515 0.2800357 [351] 0.2799197 0.2798036 0.2796873 0.2795708 0.2794542 0.2793374 0.2792205 [358] 0.2791033 0.2789860 0.2788686 0.2787510 0.2786332 0.2785152 0.2783971 [365] 0.2782789 0.2781604 0.2780418 0.2779231 0.2778042 0.2776851 0.2775659 [372] 0.2774465 0.2773269 0.2772072 0.2770873 0.2769673 0.2768471 0.2767268 [379] 0.2766063 0.2764856 0.2763648 0.2762439 0.2761228 0.2760015 0.2758801 [386] 0.2757585 0.2756368 0.2755149 0.2753929 0.2752707 0.2751484 0.2750259 [393] 0.2749032 0.2747805 0.2746575 0.2745345 0.2744112 0.2742879 0.2741643 [400] 0.2740407 0.2739169 > mx [1] 0.3080624 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1jxf41226522294.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/25mi91226522294.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/3fx1v1226522294.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/4txou1226522294.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/5mbws1226522294.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/6h5ru1226522294.tab") > > system("convert tmp/1jxf41226522294.ps tmp/1jxf41226522294.png") > system("convert tmp/25mi91226522294.ps tmp/25mi91226522294.png") > system("convert tmp/3fx1v1226522294.ps tmp/3fx1v1226522294.png") > system("convert tmp/4txou1226522294.ps tmp/4txou1226522294.png") > system("convert tmp/5mbws1226522294.ps tmp/5mbws1226522294.png") > > > proc.time() user system elapsed 1.299 0.789 1.631