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(109.20,88.60,94.30,98.30,86.40,80.60,104.10,108.20,93.40,71.90,94.10,94.90,96.40,91.10,84.40,86.40,88.00,75.10,109.70,103.00,82.10,68.00,96.40,94.30,90.00,88.00,76.10,82.50,81.40,66.50,97.20,94.10,80.70,70.50,87.80,89.50,99.60,84.20,75.10,92.00,80.80,73.10,99.80,90.00,83.10,72.40,78.80,87.30,91.00,80.10,73.60,86.40,74.50,71.20,92.40,81.50,85.30,69.90,84.20,90.70,100.30) > #'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.2904065 -0.2905449 -0.2906832 -0.2908214 -0.2909595 -0.2910976 [7] -0.2912356 -0.2913736 -0.2915115 -0.2916493 -0.2917871 -0.2919248 [13] -0.2920624 -0.2922000 -0.2923375 -0.2924749 -0.2926123 -0.2927496 [19] -0.2928868 -0.2930240 -0.2931611 -0.2932981 -0.2934351 -0.2935720 [25] -0.2937088 -0.2938456 -0.2939822 -0.2941189 -0.2942554 -0.2943919 [31] -0.2945283 -0.2946646 -0.2948009 -0.2949371 -0.2950732 -0.2952093 [37] -0.2953452 -0.2954811 -0.2956170 -0.2957527 -0.2958884 -0.2960240 [43] -0.2961595 -0.2962950 -0.2964304 -0.2965657 -0.2967009 -0.2968361 [49] -0.2969711 -0.2971061 -0.2972411 -0.2973759 -0.2975107 -0.2976454 [55] -0.2977800 -0.2979145 -0.2980490 -0.2981833 -0.2983176 -0.2984518 [61] -0.2985860 -0.2987200 -0.2988540 -0.2989879 -0.2991217 -0.2992554 [67] -0.2993891 -0.2995226 -0.2996561 -0.2997895 -0.2999228 -0.3000560 [73] -0.3001892 -0.3003222 -0.3004552 -0.3005881 -0.3007209 -0.3008536 [79] -0.3009862 -0.3011188 -0.3012512 -0.3013836 -0.3015159 -0.3016481 [85] -0.3017802 -0.3019122 -0.3020441 -0.3021760 -0.3023077 -0.3024394 [91] -0.3025710 -0.3027024 -0.3028338 -0.3029651 -0.3030964 -0.3032275 [97] -0.3033585 -0.3034894 -0.3036203 -0.3037510 -0.3038817 -0.3040122 [103] -0.3041427 -0.3042731 -0.3044034 -0.3045335 -0.3046636 -0.3047936 [109] -0.3049235 -0.3050533 -0.3051830 -0.3053127 -0.3054422 -0.3055716 [115] -0.3057009 -0.3058301 -0.3059593 -0.3060883 -0.3062172 -0.3063460 [121] -0.3064748 -0.3066034 -0.3067319 -0.3068604 -0.3069887 -0.3071169 [127] -0.3072450 -0.3073731 -0.3075010 -0.3076288 -0.3077565 -0.3078842 [133] -0.3080117 -0.3081391 -0.3082664 -0.3083936 -0.3085207 -0.3086477 [139] -0.3087746 -0.3089014 -0.3090280 -0.3091546 -0.3092811 -0.3094074 [145] -0.3095337 -0.3096598 -0.3097859 -0.3099118 -0.3100376 -0.3101634 [151] -0.3102890 -0.3104145 -0.3105399 -0.3106651 -0.3107903 -0.3109154 [157] -0.3110403 -0.3111652 -0.3112899 -0.3114145 -0.3115390 -0.3116634 [163] -0.3117877 -0.3119119 -0.3120359 -0.3121599 -0.3122837 -0.3124075 [169] -0.3125311 -0.3126546 -0.3127779 -0.3129012 -0.3130243 -0.3131474 [175] -0.3132703 -0.3133931 -0.3135158 -0.3136384 -0.3137608 -0.3138832 [181] -0.3140054 -0.3141275 -0.3142495 -0.3143713 -0.3144931 -0.3146147 [187] -0.3147362 -0.3148576 -0.3149789 -0.3151000 -0.3152211 -0.3153420 [193] -0.3154628 -0.3155834 -0.3157040 -0.3158244 -0.3159447 -0.3160649 [199] -0.3161850 -0.3163049 -0.3164247 -0.3165444 -0.3166640 -0.3167834 [205] -0.3169028 -0.3170220 -0.3171410 -0.3172600 -0.3173788 -0.3174975 [211] -0.3176161 -0.3177345 -0.3178529 -0.3179711 -0.3180891 -0.3182071 [217] -0.3183249 -0.3184426 -0.3185601 -0.3186776 -0.3187949 -0.3189120 [223] -0.3190291 -0.3191460 -0.3192628 -0.3193794 -0.3194960 -0.3196124 [229] -0.3197286 -0.3198448 -0.3199608 -0.3200767 -0.3201924 -0.3203080 [235] -0.3204235 -0.3205388 -0.3206541 -0.3207691 -0.3208841 -0.3209989 [241] -0.3211136 -0.3212281 -0.3213426 -0.3214568 -0.3215710 -0.3216850 [247] -0.3217989 -0.3219126 -0.3220262 -0.3221397 -0.3222530 -0.3223662 [253] -0.3224793 -0.3225922 -0.3227050 -0.3228177 -0.3229302 -0.3230426 [259] -0.3231548 -0.3232669 -0.3233789 -0.3234907 -0.3236024 -0.3237139 [265] -0.3238253 -0.3239366 -0.3240477 -0.3241587 -0.3242696 -0.3243803 [271] -0.3244908 -0.3246013 -0.3247115 -0.3248217 -0.3249317 -0.3250415 [277] -0.3251513 -0.3252608 -0.3253703 -0.3254796 -0.3255887 -0.3256977 [283] -0.3258066 -0.3259153 -0.3260239 -0.3261323 -0.3262406 -0.3263487 [289] -0.3264567 -0.3265646 -0.3266723 -0.3267798 -0.3268872 -0.3269945 [295] -0.3271016 -0.3272086 -0.3273154 -0.3274221 -0.3275286 -0.3276350 [301] -0.3277413 -0.3278474 -0.3279533 -0.3280591 -0.3281648 -0.3282703 [307] -0.3283756 -0.3284808 -0.3285859 -0.3286908 -0.3287955 -0.3289001 [313] -0.3290046 -0.3291089 -0.3292131 -0.3293171 -0.3294209 -0.3295246 [319] -0.3296282 -0.3297316 -0.3298348 -0.3299379 -0.3300409 -0.3301437 [325] -0.3302463 -0.3303488 -0.3304511 -0.3305533 -0.3306554 -0.3307572 [331] -0.3308590 -0.3309605 -0.3310620 -0.3311632 -0.3312643 -0.3313653 [337] -0.3314661 -0.3315668 -0.3316673 -0.3317676 -0.3318678 -0.3319678 [343] -0.3320677 -0.3321674 -0.3322670 -0.3323664 -0.3324656 -0.3325647 [349] -0.3326637 -0.3327624 -0.3328611 -0.3329595 -0.3330578 -0.3331560 [355] -0.3332540 -0.3333518 -0.3334495 -0.3335470 -0.3336444 -0.3337416 [361] -0.3338387 -0.3339356 -0.3340323 -0.3341289 -0.3342253 -0.3343215 [367] -0.3344176 -0.3345136 -0.3346093 -0.3347050 -0.3348004 -0.3348957 [373] -0.3349909 -0.3350858 -0.3351807 -0.3352753 -0.3353698 -0.3354641 [379] -0.3355583 -0.3356523 -0.3357462 -0.3358399 -0.3359334 -0.3360268 [385] -0.3361200 -0.3362130 -0.3363059 -0.3363986 -0.3364912 -0.3365836 [391] -0.3366758 -0.3367679 -0.3368598 -0.3369515 -0.3370431 -0.3371345 [397] -0.3372258 -0.3373169 -0.3374078 -0.3374986 -0.3375892 > 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/1nbo11257797198.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/2qs3q1257797198.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/32qx01257797198.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/4bg4d1257797198.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/5cj3t1257797198.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/6b7ga1257797198.tab") > > system("convert tmp/1nbo11257797198.ps tmp/1nbo11257797198.png") > system("convert tmp/2qs3q1257797198.ps tmp/2qs3q1257797198.png") > system("convert tmp/32qx01257797198.ps tmp/32qx01257797198.png") > system("convert tmp/4bg4d1257797198.ps tmp/4bg4d1257797198.png") > system("convert tmp/5cj3t1257797198.ps tmp/5cj3t1257797198.png") > > > proc.time() user system elapsed 1.101 0.803 2.340