R version 2.7.2 (2008-08-25) 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(97.4,97,105.4,102.7,98.1,104.5,87.4,89.9,109.8,111.7,98.6,96.9,95.1,97,112.7,102.9,97.4,111.4,87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,97.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.3137968 0.3139177 0.3140384 0.3141590 0.3142795 0.3143998 0.3145200 [8] 0.3146401 0.3147600 0.3148798 0.3149995 0.3151190 0.3152384 0.3153576 [15] 0.3154768 0.3155957 0.3157146 0.3158333 0.3159519 0.3160703 0.3161886 [22] 0.3163068 0.3164249 0.3165428 0.3166605 0.3167782 0.3168957 0.3170130 [29] 0.3171303 0.3172474 0.3173643 0.3174811 0.3175978 0.3177144 0.3178308 [36] 0.3179470 0.3180632 0.3181792 0.3182950 0.3184108 0.3185264 0.3186418 [43] 0.3187571 0.3188723 0.3189874 0.3191023 0.3192170 0.3193317 0.3194462 [50] 0.3195605 0.3196747 0.3197888 0.3199028 0.3200166 0.3201302 0.3202438 [57] 0.3203572 0.3204704 0.3205835 0.3206965 0.3208094 0.3209221 0.3210346 [64] 0.3211471 0.3212594 0.3213715 0.3214835 0.3215954 0.3217071 0.3218187 [71] 0.3219302 0.3220415 0.3221527 0.3222638 0.3223747 0.3224854 0.3225961 [78] 0.3227066 0.3228169 0.3229271 0.3230372 0.3231471 0.3232569 0.3233666 [85] 0.3234761 0.3235855 0.3236947 0.3238038 0.3239128 0.3240216 0.3241303 [92] 0.3242389 0.3243473 0.3244555 0.3245637 0.3246717 0.3247795 0.3248872 [99] 0.3249948 0.3251022 0.3252095 0.3253167 0.3254237 0.3255305 0.3256373 [106] 0.3257439 0.3258503 0.3259566 0.3260628 0.3261689 0.3262747 0.3263805 [113] 0.3264861 0.3265916 0.3266969 0.3268021 0.3269072 0.3270121 0.3271169 [120] 0.3272215 0.3273260 0.3274304 0.3275346 0.3276387 0.3277426 0.3278464 [127] 0.3279500 0.3280536 0.3281569 0.3282602 0.3283633 0.3284662 0.3285690 [134] 0.3286717 0.3287743 0.3288766 0.3289789 0.3290810 0.3291830 0.3292848 [141] 0.3293865 0.3294881 0.3295895 0.3296908 0.3297919 0.3298929 0.3299937 [148] 0.3300945 0.3301950 0.3302955 0.3303958 0.3304959 0.3305959 0.3306958 [155] 0.3307955 0.3308951 0.3309946 0.3310939 0.3311930 0.3312921 0.3313910 [162] 0.3314897 0.3315883 0.3316868 0.3317851 0.3318833 0.3319814 0.3320793 [169] 0.3321770 0.3322747 0.3323722 0.3324695 0.3325667 0.3326638 0.3327607 [176] 0.3328575 0.3329542 0.3330507 0.3331470 0.3332433 0.3333393 0.3334353 [183] 0.3335311 0.3336268 0.3337223 0.3338177 0.3339129 0.3340080 0.3341030 [190] 0.3341978 0.3342925 0.3343871 0.3344815 0.3345758 0.3346699 0.3347639 [197] 0.3348577 0.3349514 0.3350450 0.3351384 0.3352317 0.3353249 0.3354179 [204] 0.3355108 0.3356035 0.3356961 0.3357886 0.3358809 0.3359730 0.3360651 [211] 0.3361570 0.3362487 0.3363404 0.3364318 0.3365232 0.3366144 0.3367054 [218] 0.3367964 0.3368871 0.3369778 0.3370683 0.3371587 0.3372489 0.3373390 [225] 0.3374289 0.3375187 0.3376084 0.3376979 0.3377873 0.3378766 0.3379657 [232] 0.3380547 0.3381435 0.3382322 0.3383208 0.3384092 0.3384975 0.3385856 [239] 0.3386736 0.3387615 0.3388492 0.3389368 0.3390243 0.3391116 0.3391988 [246] 0.3392858 0.3393727 0.3394595 0.3395461 0.3396326 0.3397189 0.3398052 [253] 0.3398912 0.3399772 0.3400630 0.3401486 0.3402342 0.3403195 0.3404048 [260] 0.3404899 0.3405749 0.3406597 0.3407444 0.3408290 0.3409134 0.3409977 [267] 0.3410818 0.3411658 0.3412497 0.3413335 0.3414171 0.3415005 0.3415839 [274] 0.3416670 0.3417501 0.3418330 0.3419158 0.3419984 0.3420810 0.3421633 [281] 0.3422456 0.3423277 0.3424096 0.3424915 0.3425731 0.3426547 0.3427361 [288] 0.3428174 0.3428985 0.3429796 0.3430604 0.3431412 0.3432218 0.3433022 [295] 0.3433826 0.3434628 0.3435428 0.3436228 0.3437025 0.3437822 0.3438617 [302] 0.3439411 0.3440204 0.3440995 0.3441784 0.3442573 0.3443360 0.3444146 [309] 0.3444930 0.3445713 0.3446495 0.3447275 0.3448054 0.3448832 0.3449608 [316] 0.3450383 0.3451157 0.3451929 0.3452700 0.3453470 0.3454238 0.3455005 [323] 0.3455771 0.3456535 0.3457298 0.3458060 0.3458820 0.3459579 0.3460336 [330] 0.3461093 0.3461847 0.3462601 0.3463353 0.3464104 0.3464854 0.3465602 [337] 0.3466349 0.3467095 0.3467839 0.3468582 0.3469324 0.3470064 0.3470803 [344] 0.3471541 0.3472277 0.3473012 0.3473746 0.3474478 0.3475209 0.3475939 [351] 0.3476667 0.3477394 0.3478120 0.3478845 0.3479568 0.3480290 0.3481010 [358] 0.3481730 0.3482447 0.3483164 0.3483879 0.3484593 0.3485306 0.3486017 [365] 0.3486727 0.3487436 0.3488144 0.3488850 0.3489555 0.3490258 0.3490960 [372] 0.3491661 0.3492361 0.3493059 0.3493756 0.3494452 0.3495147 0.3495840 [379] 0.3496532 0.3497222 0.3497911 0.3498599 0.3499286 0.3499971 0.3500655 [386] 0.3501338 0.3502020 0.3502700 0.3503379 0.3504056 0.3504733 0.3505408 [393] 0.3506082 0.3506754 0.3507425 0.3508095 0.3508764 0.3509431 0.3510098 [400] 0.3510762 0.3511426 > mx [1] 0.3511426 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1ls4n1226604328.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/27lmy1226604328.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/3o5j41226604328.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/4h59m1226604328.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/5xoo31226604328.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/62t411226604328.tab") > > system("convert tmp/1ls4n1226604328.ps tmp/1ls4n1226604328.png") > system("convert tmp/27lmy1226604328.ps tmp/27lmy1226604328.png") > system("convert tmp/3o5j41226604328.ps tmp/3o5j41226604328.png") > system("convert tmp/4h59m1226604328.ps tmp/4h59m1226604328.png") > system("convert tmp/5xoo31226604328.ps tmp/5xoo31226604328.png") > > > proc.time() user system elapsed 1.297 0.764 1.639