R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(101.30,102.00,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,79.40,84.80,92.90,81.60,76.00,98.70,89.10,88.70,67.10,93.60,97.00,100.80,80.10,80.70,89.60,81.30,71.30) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Normality Plot (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxnorm.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.2929028 -0.2930491 -0.2931953 -0.2933415 -0.2934877 -0.2936337 [7] -0.2937798 -0.2939257 -0.2940716 -0.2942175 -0.2943633 -0.2945090 [13] -0.2946547 -0.2948003 -0.2949459 -0.2950914 -0.2952368 -0.2953822 [19] -0.2955276 -0.2956728 -0.2958180 -0.2959632 -0.2961083 -0.2962533 [25] -0.2963982 -0.2965431 -0.2966880 -0.2968327 -0.2969774 -0.2971221 [31] -0.2972666 -0.2974112 -0.2975556 -0.2977000 -0.2978443 -0.2979885 [37] -0.2981327 -0.2982768 -0.2984209 -0.2985649 -0.2987088 -0.2988526 [43] -0.2989964 -0.2991401 -0.2992838 -0.2994273 -0.2995708 -0.2997143 [49] -0.2998576 -0.3000009 -0.3001441 -0.3002873 -0.3004303 -0.3005733 [55] -0.3007163 -0.3008591 -0.3010019 -0.3011446 -0.3012872 -0.3014298 [61] -0.3015723 -0.3017147 -0.3018570 -0.3019993 -0.3021415 -0.3022836 [67] -0.3024256 -0.3025676 -0.3027094 -0.3028512 -0.3029929 -0.3031346 [73] -0.3032761 -0.3034176 -0.3035590 -0.3037004 -0.3038416 -0.3039828 [79] -0.3041238 -0.3042648 -0.3044058 -0.3045466 -0.3046874 -0.3048280 [85] -0.3049686 -0.3051091 -0.3052495 -0.3053899 -0.3055301 -0.3056703 [91] -0.3058104 -0.3059504 -0.3060903 -0.3062301 -0.3063699 -0.3065095 [97] -0.3066491 -0.3067886 -0.3069280 -0.3070673 -0.3072065 -0.3073456 [103] -0.3074847 -0.3076236 -0.3077625 -0.3079013 -0.3080399 -0.3081785 [109] -0.3083170 -0.3084554 -0.3085938 -0.3087320 -0.3088701 -0.3090082 [115] -0.3091461 -0.3092840 -0.3094217 -0.3095594 -0.3096970 -0.3098344 [121] -0.3099718 -0.3101091 -0.3102463 -0.3103834 -0.3105204 -0.3106573 [127] -0.3107941 -0.3109308 -0.3110674 -0.3112039 -0.3113404 -0.3114767 [133] -0.3116129 -0.3117490 -0.3118850 -0.3120210 -0.3121568 -0.3122925 [139] -0.3124281 -0.3125636 -0.3126991 -0.3128344 -0.3129696 -0.3131047 [145] -0.3132397 -0.3133746 -0.3135094 -0.3136441 -0.3137787 -0.3139132 [151] -0.3140476 -0.3141819 -0.3143160 -0.3144501 -0.3145841 -0.3147179 [157] -0.3148517 -0.3149853 -0.3151188 -0.3152523 -0.3153856 -0.3155188 [163] -0.3156519 -0.3157849 -0.3159178 -0.3160506 -0.3161832 -0.3163158 [169] -0.3164483 -0.3165806 -0.3167128 -0.3168449 -0.3169769 -0.3171088 [175] -0.3172406 -0.3173723 -0.3175038 -0.3176353 -0.3177666 -0.3178978 [181] -0.3180289 -0.3181599 -0.3182908 -0.3184215 -0.3185522 -0.3186827 [187] -0.3188131 -0.3189434 -0.3190736 -0.3192036 -0.3193336 -0.3194634 [193] -0.3195931 -0.3197227 -0.3198522 -0.3199815 -0.3201108 -0.3202399 [199] -0.3203689 -0.3204978 -0.3206265 -0.3207552 -0.3208837 -0.3210121 [205] -0.3211404 -0.3212685 -0.3213965 -0.3215245 -0.3216522 -0.3217799 [211] -0.3219074 -0.3220349 -0.3221622 -0.3222893 -0.3224164 -0.3225433 [217] -0.3226701 -0.3227968 -0.3229233 -0.3230498 -0.3231761 -0.3233022 [223] -0.3234283 -0.3235542 -0.3236800 -0.3238056 -0.3239312 -0.3240566 [229] -0.3241819 -0.3243070 -0.3244321 -0.3245569 -0.3246817 -0.3248064 [235] -0.3249309 -0.3250552 -0.3251795 -0.3253036 -0.3254276 -0.3255514 [241] -0.3256752 -0.3257988 -0.3259222 -0.3260456 -0.3261687 -0.3262918 [247] -0.3264147 -0.3265375 -0.3266602 -0.3267827 -0.3269051 -0.3270274 [253] -0.3271495 -0.3272715 -0.3273934 -0.3275151 -0.3276367 -0.3277581 [259] -0.3278794 -0.3280006 -0.3281217 -0.3282426 -0.3283633 -0.3284840 [265] -0.3286045 -0.3287248 -0.3288450 -0.3289651 -0.3290851 -0.3292049 [271] -0.3293245 -0.3294440 -0.3295634 -0.3296827 -0.3298018 -0.3299207 [277] -0.3300396 -0.3301582 -0.3302768 -0.3303952 -0.3305134 -0.3306316 [283] -0.3307495 -0.3308674 -0.3309850 -0.3311026 -0.3312200 -0.3313373 [289] -0.3314544 -0.3315713 -0.3316882 -0.3318049 -0.3319214 -0.3320378 [295] -0.3321540 -0.3322701 -0.3323861 -0.3325019 -0.3326176 -0.3327331 [301] -0.3328485 -0.3329637 -0.3330788 -0.3331937 -0.3333085 -0.3334231 [307] -0.3335376 -0.3336520 -0.3337662 -0.3338802 -0.3339941 -0.3341079 [313] -0.3342215 -0.3343349 -0.3344482 -0.3345614 -0.3346744 -0.3347872 [319] -0.3348999 -0.3350125 -0.3351249 -0.3352371 -0.3353492 -0.3354612 [325] -0.3355730 -0.3356846 -0.3357961 -0.3359074 -0.3360186 -0.3361297 [331] -0.3362405 -0.3363513 -0.3364618 -0.3365723 -0.3366825 -0.3367926 [337] -0.3369026 -0.3370124 -0.3371221 -0.3372316 -0.3373409 -0.3374501 [343] -0.3375591 -0.3376680 -0.3377767 -0.3378853 -0.3379937 -0.3381019 [349] -0.3382100 -0.3383180 -0.3384257 -0.3385334 -0.3386408 -0.3387481 [355] -0.3388553 -0.3389623 -0.3390691 -0.3391758 -0.3392823 -0.3393887 [361] -0.3394949 -0.3396009 -0.3397068 -0.3398125 -0.3399181 -0.3400235 [367] -0.3401287 -0.3402338 -0.3403387 -0.3404435 -0.3405481 -0.3406525 [373] -0.3407568 -0.3408609 -0.3409649 -0.3410687 -0.3411723 -0.3412758 [379] -0.3413791 -0.3414823 -0.3415853 -0.3416881 -0.3417908 -0.3418933 [385] -0.3419956 -0.3420978 -0.3421998 -0.3423016 -0.3424033 -0.3425048 [391] -0.3426062 -0.3427074 -0.3428084 -0.3429093 -0.3430100 -0.3431105 [397] -0.3432109 -0.3433111 -0.3434111 -0.3435110 -0.3436107 > 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/1atu71194256000.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/2w1pk1194256000.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/36dxn1194256001.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/4wi3c1194256001.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/50uru1194256001.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > grid() > mtext('Transformed Data') > dev.off() null device 1 > 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/6fh0q1194256001.tab") > > system("convert tmp/1atu71194256000.ps tmp/1atu71194256000.png") > system("convert tmp/2w1pk1194256000.ps tmp/2w1pk1194256000.png") > system("convert tmp/36dxn1194256001.ps tmp/36dxn1194256001.png") > system("convert tmp/4wi3c1194256001.ps tmp/4wi3c1194256001.png") > system("convert tmp/50uru1194256001.ps tmp/50uru1194256001.png") > > > proc.time() user system elapsed 1.355 0.806 1.577