R version 2.8.0 (2008-10-20) 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(72.5,72.0,98.8,75.2,81.2,88.0,54.6,68.6,101.5,93.4,84.5,91.4,64.5,64.5,117.3,73.5,79.7,102.6,57.9,73.1,102.4,82.3,89.1,84.7,81.4,67.5,113.9,83.8,73.9,103.9,67.9,62.5,125.4,79.1,106.3,96.2,94.3,85.6,117.4,88.5,124.2,119.3,76.8,70.6,122.1,109.5,119.9,102.3,79.6,78.2,103.6,77.8,99.1,105.7,84.1,88.7,108.0,98.1,101.0,82.0) > #'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.3526468 0.3526706 0.3526938 0.3527164 0.3527384 0.3527597 0.3527805 [8] 0.3528007 0.3528202 0.3528391 0.3528575 0.3528752 0.3528923 0.3529088 [15] 0.3529247 0.3529400 0.3529547 0.3529688 0.3529822 0.3529951 0.3530073 [22] 0.3530190 0.3530300 0.3530404 0.3530502 0.3530594 0.3530680 0.3530759 [29] 0.3530833 0.3530900 0.3530962 0.3531017 0.3531066 0.3531109 0.3531146 [36] 0.3531177 0.3531201 0.3531220 0.3531232 0.3531238 0.3531239 0.3531233 [43] 0.3531221 0.3531203 0.3531178 0.3531148 0.3531112 0.3531069 0.3531020 [50] 0.3530965 0.3530905 0.3530838 0.3530764 0.3530685 0.3530600 0.3530508 [57] 0.3530411 0.3530307 0.3530198 0.3530082 0.3529960 0.3529832 0.3529698 [64] 0.3529558 0.3529412 0.3529259 0.3529101 0.3528936 0.3528766 0.3528589 [71] 0.3528407 0.3528218 0.3528023 0.3527823 0.3527616 0.3527403 0.3527184 [78] 0.3526959 0.3526728 0.3526491 0.3526248 0.3525999 0.3525744 0.3525482 [85] 0.3525215 0.3524942 0.3524663 0.3524378 0.3524087 0.3523790 0.3523486 [92] 0.3523177 0.3522862 0.3522541 0.3522214 0.3521881 0.3521543 0.3521198 [99] 0.3520847 0.3520490 0.3520128 0.3519759 0.3519385 0.3519004 0.3518618 [106] 0.3518226 0.3517828 0.3517424 0.3517014 0.3516598 0.3516177 0.3515749 [113] 0.3515316 0.3514877 0.3514432 0.3513981 0.3513524 0.3513062 0.3512594 [120] 0.3512119 0.3511640 0.3511154 0.3510663 0.3510165 0.3509662 0.3509154 [127] 0.3508639 0.3508119 0.3507593 0.3507061 0.3506524 0.3505981 0.3505432 [134] 0.3504877 0.3504317 0.3503751 0.3503180 0.3502603 0.3502020 0.3501431 [141] 0.3500837 0.3500237 0.3499632 0.3499021 0.3498405 0.3497782 0.3497155 [148] 0.3496521 0.3495883 0.3495238 0.3494588 0.3493933 0.3493272 0.3492605 [155] 0.3491933 0.3491256 0.3490573 0.3489884 0.3489190 0.3488491 0.3487786 [162] 0.3487076 0.3486360 0.3485639 0.3484913 0.3484181 0.3483444 0.3482701 [169] 0.3481953 0.3481200 0.3480441 0.3479677 0.3478908 0.3478133 0.3477354 [176] 0.3476568 0.3475778 0.3474982 0.3474181 0.3473375 0.3472564 0.3471747 [183] 0.3470925 0.3470099 0.3469266 0.3468429 0.3467587 0.3466739 0.3465886 [190] 0.3465028 0.3464165 0.3463297 0.3462424 0.3461546 0.3460663 0.3459774 [197] 0.3458881 0.3457982 0.3457079 0.3456171 0.3455257 0.3454339 0.3453416 [204] 0.3452487 0.3451554 0.3450616 0.3449673 0.3448725 0.3447772 0.3446815 [211] 0.3445852 0.3444885 0.3443912 0.3442935 0.3441954 0.3440967 0.3439976 [218] 0.3438979 0.3437978 0.3436973 0.3435962 0.3434947 0.3433927 0.3432903 [225] 0.3431874 0.3430840 0.3429801 0.3428758 0.3427710 0.3426658 0.3425601 [232] 0.3424540 0.3423473 0.3422403 0.3421328 0.3420248 0.3419164 0.3418075 [239] 0.3416982 0.3415884 0.3414782 0.3413675 0.3412564 0.3411449 0.3410329 [246] 0.3409205 0.3408076 0.3406943 0.3405806 0.3404664 0.3403518 0.3402368 [253] 0.3401214 0.3400055 0.3398892 0.3397725 0.3396553 0.3395377 0.3394197 [260] 0.3393013 0.3391825 0.3390633 0.3389436 0.3388235 0.3387030 0.3385821 [267] 0.3384608 0.3383391 0.3382170 0.3380945 0.3379716 0.3378482 0.3377245 [274] 0.3376004 0.3374759 0.3373510 0.3372257 0.3371000 0.3369739 0.3368474 [281] 0.3367205 0.3365933 0.3364656 0.3363376 0.3362092 0.3360804 0.3359512 [288] 0.3358217 0.3356918 0.3355615 0.3354308 0.3352998 0.3351683 0.3350366 [295] 0.3349044 0.3347719 0.3346390 0.3345058 0.3343722 0.3342382 0.3341039 [302] 0.3339692 0.3338342 0.3336988 0.3335631 0.3334270 0.3332905 0.3331538 [309] 0.3330166 0.3328791 0.3327413 0.3326032 0.3324647 0.3323258 0.3321866 [316] 0.3320471 0.3319073 0.3317671 0.3316266 0.3314857 0.3313445 0.3312030 [323] 0.3310612 0.3309191 0.3307766 0.3306338 0.3304907 0.3303472 0.3302035 [330] 0.3300594 0.3299151 0.3297704 0.3296254 0.3294801 0.3293344 0.3291885 [337] 0.3290423 0.3288958 0.3287489 0.3286018 0.3284544 0.3283066 0.3281586 [344] 0.3280103 0.3278617 0.3277128 0.3275636 0.3274141 0.3272643 0.3271143 [351] 0.3269640 0.3268133 0.3266624 0.3265113 0.3263598 0.3262081 0.3260561 [358] 0.3259038 0.3257512 0.3255984 0.3254453 0.3252920 0.3251383 0.3249844 [365] 0.3248303 0.3246759 0.3245212 0.3243663 0.3242111 0.3240556 0.3238999 [372] 0.3237440 0.3235878 0.3234313 0.3232746 0.3231176 0.3229604 0.3228030 [379] 0.3226453 0.3224874 0.3223292 0.3221708 0.3220122 0.3218533 0.3216942 [386] 0.3215348 0.3213753 0.3212154 0.3210554 0.3208951 0.3207347 0.3205739 [393] 0.3204130 0.3202519 0.3200905 0.3199289 0.3197671 0.3196050 0.3194428 [400] 0.3192803 0.3191177 > mx [1] 0.3531239 > mxli [1] -1.6 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1aoeb1229086420.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/2gi1k1229086420.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/33pgm1229086420.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/4qr8w1229086420.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/5x5271229086420.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/69h5v1229086420.tab") > > system("convert tmp/1aoeb1229086420.ps tmp/1aoeb1229086420.png") > system("convert tmp/2gi1k1229086420.ps tmp/2gi1k1229086420.png") > system("convert tmp/33pgm1229086420.ps tmp/33pgm1229086420.png") > system("convert tmp/4qr8w1229086420.ps tmp/4qr8w1229086420.png") > system("convert tmp/5x5271229086420.ps tmp/5x5271229086420.png") > > > proc.time() user system elapsed 1.084 0.805 1.339