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,106,101,104,97,93,99,116,104,99,109,93,91,111,105,114,103,105,106,125,103,114,123,102,101,121,120,119,102,118,114,130,113,119,129,116,110,124,133,129,105,127,127,128,133,122,141,127,110,136,132,110,97,96,98,106,98,94,107,98) > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = '' > par2 = '' > par1 = '' > ylab = '' > xlab = '' > main = '' > #'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.3043416 0.3042854 0.3042292 0.3041732 0.3041171 0.3040611 0.3040052 [8] 0.3039494 0.3038936 0.3038379 0.3037822 0.3037266 0.3036710 0.3036155 [15] 0.3035601 0.3035048 0.3034495 0.3033942 0.3033391 0.3032840 0.3032289 [22] 0.3031739 0.3031190 0.3030642 0.3030094 0.3029547 0.3029000 0.3028455 [29] 0.3027910 0.3027365 0.3026821 0.3026278 0.3025736 0.3025194 0.3024653 [36] 0.3024113 0.3023573 0.3023034 0.3022496 0.3021959 0.3021422 0.3020886 [43] 0.3020351 0.3019816 0.3019282 0.3018749 0.3018217 0.3017685 0.3017154 [50] 0.3016624 0.3016095 0.3015566 0.3015038 0.3014511 0.3013984 0.3013459 [57] 0.3012934 0.3012410 0.3011886 0.3011364 0.3010842 0.3010321 0.3009800 [64] 0.3009281 0.3008762 0.3008244 0.3007727 0.3007211 0.3006695 0.3006181 [71] 0.3005667 0.3005154 0.3004641 0.3004130 0.3003619 0.3003109 0.3002600 [78] 0.3002092 0.3001585 0.3001078 0.3000572 0.3000067 0.2999563 0.2999060 [85] 0.2998557 0.2998056 0.2997555 0.2997055 0.2996556 0.2996058 0.2995561 [92] 0.2995064 0.2994568 0.2994074 0.2993580 0.2993087 0.2992594 0.2992103 [99] 0.2991613 0.2991123 0.2990634 0.2990146 0.2989660 0.2989173 0.2988688 [106] 0.2988204 0.2987720 0.2987238 0.2986756 0.2986275 0.2985796 0.2985317 [113] 0.2984838 0.2984361 0.2983885 0.2983410 0.2982935 0.2982461 0.2981989 [120] 0.2981517 0.2981046 0.2980576 0.2980107 0.2979639 0.2979172 0.2978706 [127] 0.2978240 0.2977776 0.2977312 0.2976850 0.2976388 0.2975927 0.2975467 [134] 0.2975008 0.2974550 0.2974093 0.2973637 0.2973182 0.2972728 0.2972275 [141] 0.2971822 0.2971371 0.2970921 0.2970471 0.2970023 0.2969575 0.2969128 [148] 0.2968683 0.2968238 0.2967794 0.2967351 0.2966909 0.2966468 0.2966028 [155] 0.2965589 0.2965151 0.2964714 0.2964278 0.2963843 0.2963408 0.2962975 [162] 0.2962543 0.2962112 0.2961681 0.2961252 0.2960823 0.2960396 0.2959969 [169] 0.2959544 0.2959119 0.2958696 0.2958273 0.2957851 0.2957431 0.2957011 [176] 0.2956592 0.2956175 0.2955758 0.2955342 0.2954927 0.2954513 0.2954101 [183] 0.2953689 0.2953278 0.2952868 0.2952459 0.2952051 0.2951644 0.2951238 [190] 0.2950833 0.2950429 0.2950026 0.2949624 0.2949223 0.2948823 0.2948424 [197] 0.2948026 0.2947629 0.2947233 0.2946837 0.2946443 0.2946050 0.2945658 [204] 0.2945267 0.2944877 0.2944487 0.2944099 0.2943712 0.2943326 0.2942941 [211] 0.2942556 0.2942173 0.2941791 0.2941409 0.2941029 0.2940650 0.2940272 [218] 0.2939894 0.2939518 0.2939143 0.2938768 0.2938395 0.2938023 0.2937651 [225] 0.2937281 0.2936911 0.2936543 0.2936176 0.2935809 0.2935444 0.2935079 [232] 0.2934716 0.2934353 0.2933992 0.2933631 0.2933272 0.2932913 0.2932556 [239] 0.2932199 0.2931844 0.2931489 0.2931136 0.2930783 0.2930431 0.2930081 [246] 0.2929731 0.2929382 0.2929035 0.2928688 0.2928342 0.2927998 0.2927654 [253] 0.2927311 0.2926969 0.2926629 0.2926289 0.2925950 0.2925612 0.2925275 [260] 0.2924939 0.2924604 0.2924271 0.2923938 0.2923606 0.2923275 0.2922945 [267] 0.2922615 0.2922287 0.2921960 0.2921634 0.2921309 0.2920985 0.2920661 [274] 0.2920339 0.2920018 0.2919698 0.2919378 0.2919060 0.2918742 0.2918426 [281] 0.2918110 0.2917796 0.2917482 0.2917170 0.2916858 0.2916547 0.2916237 [288] 0.2915929 0.2915621 0.2915314 0.2915008 0.2914703 0.2914399 0.2914096 [295] 0.2913794 0.2913492 0.2913192 0.2912893 0.2912595 0.2912297 0.2912001 [302] 0.2911705 0.2911411 0.2911117 0.2910824 0.2910532 0.2910242 0.2909952 [309] 0.2909663 0.2909375 0.2909088 0.2908801 0.2908516 0.2908232 0.2907949 [316] 0.2907666 0.2907385 0.2907104 0.2906824 0.2906545 0.2906268 0.2905991 [323] 0.2905715 0.2905440 0.2905165 0.2904892 0.2904620 0.2904348 0.2904078 [330] 0.2903808 0.2903539 0.2903272 0.2903005 0.2902739 0.2902473 0.2902209 [337] 0.2901946 0.2901683 0.2901422 0.2901161 0.2900902 0.2900643 0.2900385 [344] 0.2900128 0.2899871 0.2899616 0.2899362 0.2899108 0.2898855 0.2898604 [351] 0.2898353 0.2898103 0.2897853 0.2897605 0.2897358 0.2897111 0.2896865 [358] 0.2896620 0.2896376 0.2896133 0.2895891 0.2895650 0.2895409 0.2895169 [365] 0.2894930 0.2894692 0.2894455 0.2894219 0.2893984 0.2893749 0.2893515 [372] 0.2893282 0.2893050 0.2892819 0.2892588 0.2892359 0.2892130 0.2891902 [379] 0.2891675 0.2891449 0.2891223 0.2890999 0.2890775 0.2890552 0.2890330 [386] 0.2890108 0.2889888 0.2889668 0.2889449 0.2889231 0.2889014 0.2888797 [393] 0.2888582 0.2888367 0.2888152 0.2887939 0.2887727 0.2887515 0.2887304 [400] 0.2887094 0.2886884 > mx [1] 0.3043416 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1e7bz1260468444.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/2z4jg1260468444.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/3o0ic1260468444.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/4jhir1260468444.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/5x0x61260468444.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/6wez91260468445.tab") > > system("convert tmp/1e7bz1260468444.ps tmp/1e7bz1260468444.png") > system("convert tmp/2z4jg1260468444.ps tmp/2z4jg1260468444.png") > system("convert tmp/3o0ic1260468444.ps tmp/3o0ic1260468444.png") > system("convert tmp/4jhir1260468444.ps tmp/4jhir1260468444.png") > system("convert tmp/5x0x61260468444.ps tmp/5x0x61260468444.png") > > > proc.time() user system elapsed 1.096 0.785 1.309