R version 2.7.0 (2008-04-22) 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(70.1,86.7,86.4,89.9,88.1,78.8,81.1,85.4,82.6,80.3,81.2,68,67.4,91.3,94.9,82.8,88.6,73.1,76.7,93.2,84.9,83.8,93.5,91.9,69.6,87,90.2,82.7,91.4,74.6,76.1,87.1,78.4,81.3,99.3,71,73.2,95.6,84,90.8,93.6,80.9,84.4,97.3,83.5,88.8,100.7,69.4,74.6,96.6,96.6,93.1,91.8,85.7,79.1,91.3,84.2,85.8,94.6,77.1,76.5,89.7,103.6,100,96.6) > #'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.2950077 0.2951178 0.2952279 0.2953380 0.2954482 0.2955584 0.2956686 [8] 0.2957789 0.2958893 0.2959996 0.2961101 0.2962205 0.2963310 0.2964415 [15] 0.2965521 0.2966627 0.2967734 0.2968841 0.2969948 0.2971056 0.2972164 [22] 0.2973272 0.2974381 0.2975490 0.2976600 0.2977710 0.2978820 0.2979931 [29] 0.2981042 0.2982153 0.2983265 0.2984377 0.2985490 0.2986602 0.2987716 [36] 0.2988829 0.2989943 0.2991057 0.2992172 0.2993287 0.2994402 0.2995518 [43] 0.2996634 0.2997750 0.2998866 0.2999983 0.3001101 0.3002218 0.3003336 [50] 0.3004454 0.3005573 0.3006692 0.3007811 0.3008931 0.3010050 0.3011171 [57] 0.3012291 0.3013412 0.3014533 0.3015654 0.3016776 0.3017898 0.3019020 [64] 0.3020143 0.3021266 0.3022389 0.3023512 0.3024636 0.3025760 0.3026884 [71] 0.3028009 0.3029134 0.3030259 0.3031384 0.3032510 0.3033636 0.3034762 [78] 0.3035888 0.3037015 0.3038142 0.3039269 0.3040397 0.3041525 0.3042653 [85] 0.3043781 0.3044909 0.3046038 0.3047167 0.3048296 0.3049426 0.3050556 [92] 0.3051686 0.3052816 0.3053946 0.3055077 0.3056208 0.3057339 0.3058470 [99] 0.3059602 0.3060734 0.3061866 0.3062998 0.3064130 0.3065263 0.3066396 [106] 0.3067529 0.3068662 0.3069796 0.3070929 0.3072063 0.3073197 0.3074331 [113] 0.3075466 0.3076601 0.3077735 0.3078870 0.3080006 0.3081141 0.3082276 [120] 0.3083412 0.3084548 0.3085684 0.3086820 0.3087957 0.3089093 0.3090230 [127] 0.3091367 0.3092504 0.3093641 0.3094779 0.3095916 0.3097054 0.3098192 [134] 0.3099330 0.3100468 0.3101606 0.3102744 0.3103883 0.3105022 0.3106160 [141] 0.3107299 0.3108438 0.3109578 0.3110717 0.3111856 0.3112996 0.3114136 [148] 0.3115275 0.3116415 0.3117555 0.3118696 0.3119836 0.3120976 0.3122117 [155] 0.3123257 0.3124398 0.3125539 0.3126679 0.3127820 0.3128961 0.3130102 [162] 0.3131244 0.3132385 0.3133526 0.3134668 0.3135809 0.3136951 0.3138092 [169] 0.3139234 0.3140376 0.3141518 0.3142660 0.3143802 0.3144944 0.3146086 [176] 0.3147228 0.3148370 0.3149513 0.3150655 0.3151797 0.3152940 0.3154082 [183] 0.3155225 0.3156367 0.3157510 0.3158652 0.3159795 0.3160937 0.3162080 [190] 0.3163223 0.3164366 0.3165508 0.3166651 0.3167794 0.3168937 0.3170079 [197] 0.3171222 0.3172365 0.3173508 0.3174651 0.3175793 0.3176936 0.3178079 [204] 0.3179222 0.3180365 0.3181507 0.3182650 0.3183793 0.3184936 0.3186078 [211] 0.3187221 0.3188364 0.3189506 0.3190649 0.3191792 0.3192934 0.3194077 [218] 0.3195219 0.3196361 0.3197504 0.3198646 0.3199789 0.3200931 0.3202073 [225] 0.3203215 0.3204357 0.3205499 0.3206641 0.3207783 0.3208925 0.3210067 [232] 0.3211208 0.3212350 0.3213492 0.3214633 0.3215775 0.3216916 0.3218057 [239] 0.3219198 0.3220339 0.3221480 0.3222621 0.3223762 0.3224903 0.3226043 [246] 0.3227184 0.3228324 0.3229465 0.3230605 0.3231745 0.3232885 0.3234025 [253] 0.3235164 0.3236304 0.3237444 0.3238583 0.3239722 0.3240861 0.3242000 [260] 0.3243139 0.3244278 0.3245417 0.3246555 0.3247694 0.3248832 0.3249970 [267] 0.3251108 0.3252246 0.3253383 0.3254521 0.3255658 0.3256795 0.3257932 [274] 0.3259069 0.3260206 0.3261342 0.3262478 0.3263615 0.3264751 0.3265886 [281] 0.3267022 0.3268158 0.3269293 0.3270428 0.3271563 0.3272698 0.3273832 [288] 0.3274967 0.3276101 0.3277235 0.3278368 0.3279502 0.3280635 0.3281768 [295] 0.3282901 0.3284034 0.3285167 0.3286299 0.3287431 0.3288563 0.3289695 [302] 0.3290826 0.3291957 0.3293088 0.3294219 0.3295350 0.3296480 0.3297610 [309] 0.3298740 0.3299870 0.3300999 0.3302128 0.3303257 0.3304385 0.3305514 [316] 0.3306642 0.3307770 0.3308897 0.3310025 0.3311152 0.3312279 0.3313405 [323] 0.3314532 0.3315658 0.3316783 0.3317909 0.3319034 0.3320159 0.3321284 [330] 0.3322408 0.3323532 0.3324656 0.3325779 0.3326903 0.3328026 0.3329148 [337] 0.3330271 0.3331393 0.3332514 0.3333636 0.3334757 0.3335878 0.3336998 [344] 0.3338119 0.3339238 0.3340358 0.3341477 0.3342596 0.3343715 0.3344833 [351] 0.3345951 0.3347069 0.3348186 0.3349303 0.3350420 0.3351536 0.3352652 [358] 0.3353768 0.3354883 0.3355998 0.3357113 0.3358227 0.3359341 0.3360454 [365] 0.3361568 0.3362681 0.3363793 0.3364905 0.3366017 0.3367128 0.3368239 [372] 0.3369350 0.3370460 0.3371570 0.3372680 0.3373789 0.3374898 0.3376006 [379] 0.3377114 0.3378222 0.3379329 0.3380436 0.3381543 0.3382649 0.3383754 [386] 0.3384860 0.3385965 0.3387069 0.3388173 0.3389277 0.3390380 0.3391483 [393] 0.3392586 0.3393688 0.3394789 0.3395890 0.3396991 0.3398092 0.3399192 [400] 0.3400291 0.3401390 > mx [1] 0.340139 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/189pz1226517025.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/2vjwy1226517026.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/3074t1226517026.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/4ifn71226517026.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/5y0cc1226517026.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/612no1226517026.tab") > > system("convert tmp/189pz1226517025.ps tmp/189pz1226517025.png") > system("convert tmp/2vjwy1226517026.ps tmp/2vjwy1226517026.png") > system("convert tmp/3074t1226517026.ps tmp/3074t1226517026.png") > system("convert tmp/4ifn71226517026.ps tmp/4ifn71226517026.png") > system("convert tmp/5y0cc1226517026.ps tmp/5y0cc1226517026.png") > > > proc.time() user system elapsed 2.390 1.311 2.573