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(440427,386715,291787,278253,300903,327695,471590,442850,387181,420099,289850,392468,549174,415506,356662,338612,359886,410547,495272,474588,442893,477793,336263,449838,451406,439690,401513,326472,369464,429525,464658,510691,513151,538609,398949,511635,554318,515879,488122,401716,453358,464884,571868,497485,538214,502396,349385,502427,514106,527537,495918,376847,420552,442679,478422,483796,529032,482991,354287,459146,473744,478642,426208,348908,321310) > #'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.3213277 0.3212770 0.3212135 0.3211583 0.3210998 0.3210466 0.3209896 [8] 0.3209318 0.3208732 0.3208163 0.3207608 0.3207039 0.3206468 0.3205885 [15] 0.3205314 0.3204737 0.3204152 0.3203573 0.3203001 0.3202411 0.3201843 [22] 0.3201251 0.3200675 0.3200082 0.3199504 0.3198913 0.3198328 0.3197738 [29] 0.3197148 0.3196558 0.3195967 0.3195374 0.3194780 0.3194185 0.3193588 [36] 0.3192993 0.3192394 0.3191795 0.3191195 0.3190594 0.3189992 0.3189388 [43] 0.3188784 0.3188179 0.3187573 0.3186965 0.3186357 0.3185747 0.3185137 [50] 0.3184525 0.3183912 0.3183299 0.3182684 0.3182068 0.3181451 0.3180834 [57] 0.3180215 0.3179595 0.3178974 0.3178351 0.3177728 0.3177104 0.3176479 [64] 0.3175852 0.3175225 0.3174597 0.3173967 0.3173337 0.3172705 0.3172072 [71] 0.3171438 0.3170804 0.3170168 0.3169531 0.3168893 0.3168254 0.3167614 [78] 0.3166972 0.3166330 0.3165687 0.3165042 0.3164397 0.3163750 0.3163103 [85] 0.3162454 0.3161804 0.3161153 0.3160502 0.3159849 0.3159195 0.3158540 [92] 0.3157883 0.3157226 0.3156568 0.3155908 0.3155248 0.3154586 0.3153924 [99] 0.3153260 0.3152595 0.3151930 0.3151263 0.3150595 0.3149926 0.3149255 [106] 0.3148584 0.3147912 0.3147239 0.3146564 0.3145889 0.3145212 0.3144534 [113] 0.3143856 0.3143176 0.3142495 0.3141813 0.3141130 0.3140445 0.3139760 [120] 0.3139074 0.3138386 0.3137698 0.3137008 0.3136318 0.3135626 0.3134933 [127] 0.3134239 0.3133544 0.3132848 0.3132151 0.3131453 0.3130753 0.3130053 [134] 0.3129351 0.3128649 0.3127945 0.3127240 0.3126534 0.3125827 0.3125119 [141] 0.3124410 0.3123700 0.3122988 0.3122276 0.3121562 0.3120848 0.3120132 [148] 0.3119415 0.3118698 0.3117979 0.3117259 0.3116537 0.3115815 0.3115092 [155] 0.3114367 0.3113642 0.3112915 0.3112188 0.3111459 0.3110729 0.3109998 [162] 0.3109266 0.3108533 0.3107798 0.3107063 0.3106327 0.3105589 0.3104851 [169] 0.3104111 0.3103370 0.3102628 0.3101885 0.3101141 0.3100396 0.3099649 [176] 0.3098902 0.3098154 0.3097404 0.3096653 0.3095902 0.3095149 0.3094395 [183] 0.3093640 0.3092884 0.3092126 0.3091368 0.3090609 0.3089848 0.3089086 [190] 0.3088324 0.3087560 0.3086795 0.3086029 0.3085262 0.3084494 0.3083724 [197] 0.3082954 0.3082182 0.3081410 0.3080636 0.3079861 0.3079085 0.3078308 [204] 0.3077530 0.3076751 0.3075971 0.3075190 0.3074407 0.3073624 0.3072839 [211] 0.3072053 0.3071266 0.3070478 0.3069689 0.3068899 0.3068108 0.3067316 [218] 0.3066522 0.3065728 0.3064932 0.3064136 0.3063338 0.3062539 0.3061739 [225] 0.3060938 0.3060136 0.3059332 0.3058528 0.3057723 0.3056916 0.3056108 [232] 0.3055300 0.3054490 0.3053679 0.3052867 0.3052054 0.3051240 0.3050424 [239] 0.3049608 0.3048790 0.3047972 0.3047152 0.3046331 0.3045510 0.3044687 [246] 0.3043863 0.3043038 0.3042211 0.3041384 0.3040556 0.3039726 0.3038896 [253] 0.3038064 0.3037231 0.3036397 0.3035562 0.3034726 0.3033889 0.3033051 [260] 0.3032212 0.3031372 0.3030530 0.3029688 0.3028844 0.3027999 0.3027153 [267] 0.3026307 0.3025459 0.3024610 0.3023759 0.3022908 0.3022056 0.3021203 [274] 0.3020348 0.3019493 0.3018636 0.3017778 0.3016919 0.3016060 0.3015199 [281] 0.3014337 0.3013473 0.3012609 0.3011744 0.3010878 0.3010010 0.3009142 [288] 0.3008272 0.3007401 0.3006530 0.3005657 0.3004783 0.3003908 0.3003032 [295] 0.3002155 0.3001277 0.3000397 0.2999517 0.2998636 0.2997753 0.2996870 [302] 0.2995985 0.2995099 0.2994213 0.2993325 0.2992436 0.2991546 0.2990655 [309] 0.2989763 0.2988870 0.2987975 0.2987080 0.2986184 0.2985286 0.2984388 [316] 0.2983488 0.2982588 0.2981686 0.2980783 0.2979879 0.2978974 0.2978069 [323] 0.2977162 0.2976254 0.2975344 0.2974434 0.2973523 0.2972611 0.2971697 [330] 0.2970783 0.2969868 0.2968951 0.2968033 0.2967115 0.2966195 0.2965275 [337] 0.2964353 0.2963430 0.2962506 0.2961581 0.2960655 0.2959728 0.2958800 [344] 0.2957871 0.2956941 0.2956010 0.2955077 0.2954144 0.2953210 0.2952274 [351] 0.2951338 0.2950401 0.2949462 0.2948523 0.2947582 0.2946640 0.2945698 [358] 0.2944754 0.2943809 0.2942864 0.2941917 0.2940969 0.2940020 0.2939070 [365] 0.2938120 0.2937168 0.2936215 0.2935261 0.2934306 0.2933350 0.2932393 [372] 0.2931434 0.2930475 0.2929515 0.2928554 0.2927592 0.2926629 0.2925664 [379] 0.2924699 0.2923733 0.2922766 0.2921797 0.2920828 0.2919858 0.2918886 [386] 0.2917914 0.2916941 0.2915966 0.2914991 0.2914015 0.2913037 0.2912059 [393] 0.2911079 0.2910099 0.2909117 0.2908135 0.2907152 0.2906167 0.2905182 [400] 0.2904195 0.2903208 > mx [1] 0.3213277 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1gq631226400533.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/2nluk1226400534.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/34s0y1226400534.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/4ntnp1226400534.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/5qcqj1226400534.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/6uste1226400534.tab") > > system("convert tmp/1gq631226400533.ps tmp/1gq631226400533.png") > system("convert tmp/2nluk1226400534.ps tmp/2nluk1226400534.png") > system("convert tmp/34s0y1226400534.ps tmp/34s0y1226400534.png") > system("convert tmp/4ntnp1226400534.ps tmp/4ntnp1226400534.png") > system("convert tmp/5qcqj1226400534.ps tmp/5qcqj1226400534.png") > > > proc.time() user system elapsed 1.288 0.774 1.509