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(81.6,84.1,88.1,85.3,82.9,84.8,71.2,68.9,94.3,97.6,85.6,91.9,75.8,79.8,99,88.5,86.7,97.9,94.3,72.9,91.8,93.2,86.5,98.9,77.2,79.4,90.4,81.4,85.8,103.6,73.6,75.7,99.2,88.7,94.6,98.7,84.2,87.7,103.3,88.2,93.4,106.3,73.1,78.6,101.6,101.4,98.5,99,89.5,83.5,97.4,87.8,90.4,101.6,80,81.7,96.4,110.2,101.1,89.3) > #'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.3234169 0.3235066 0.3235964 0.3236860 0.3237757 0.3238653 0.3239549 [8] 0.3240444 0.3241339 0.3242234 0.3243128 0.3244022 0.3244915 0.3245808 [15] 0.3246701 0.3247593 0.3248485 0.3249376 0.3250267 0.3251158 0.3252048 [22] 0.3252938 0.3253827 0.3254716 0.3255605 0.3256493 0.3257381 0.3258268 [29] 0.3259155 0.3260041 0.3260927 0.3261813 0.3262698 0.3263583 0.3264467 [36] 0.3265351 0.3266234 0.3267117 0.3268000 0.3268882 0.3269763 0.3270644 [43] 0.3271525 0.3272405 0.3273285 0.3274164 0.3275043 0.3275922 0.3276800 [50] 0.3277677 0.3278554 0.3279431 0.3280307 0.3281183 0.3282058 0.3282932 [57] 0.3283807 0.3284680 0.3285554 0.3286426 0.3287299 0.3288170 0.3289042 [64] 0.3289913 0.3290783 0.3291653 0.3292522 0.3293391 0.3294259 0.3295127 [71] 0.3295994 0.3296861 0.3297728 0.3298593 0.3299459 0.3300324 0.3301188 [78] 0.3302052 0.3302915 0.3303778 0.3304640 0.3305502 0.3306363 0.3307224 [85] 0.3308084 0.3308943 0.3309802 0.3310661 0.3311519 0.3312377 0.3313234 [92] 0.3314090 0.3314946 0.3315801 0.3316656 0.3317510 0.3318364 0.3319217 [99] 0.3320070 0.3320922 0.3321773 0.3322624 0.3323475 0.3324325 0.3325174 [106] 0.3326023 0.3326871 0.3327718 0.3328565 0.3329412 0.3330258 0.3331103 [113] 0.3331948 0.3332792 0.3333636 0.3334479 0.3335321 0.3336163 0.3337004 [120] 0.3337845 0.3338685 0.3339524 0.3340363 0.3341202 0.3342039 0.3342877 [127] 0.3343713 0.3344549 0.3345384 0.3346219 0.3347053 0.3347887 0.3348720 [134] 0.3349552 0.3350384 0.3351215 0.3352046 0.3352876 0.3353705 0.3354533 [141] 0.3355362 0.3356189 0.3357016 0.3357842 0.3358668 0.3359492 0.3360317 [148] 0.3361140 0.3361964 0.3362786 0.3363608 0.3364429 0.3365249 0.3366069 [155] 0.3366889 0.3367707 0.3368525 0.3369342 0.3370159 0.3370975 0.3371790 [162] 0.3372605 0.3373419 0.3374233 0.3375045 0.3375858 0.3376669 0.3377480 [169] 0.3378290 0.3379099 0.3379908 0.3380716 0.3381524 0.3382331 0.3383137 [176] 0.3383942 0.3384747 0.3385551 0.3386354 0.3387157 0.3387959 0.3388761 [183] 0.3389561 0.3390362 0.3391161 0.3391960 0.3392758 0.3393555 0.3394351 [190] 0.3395147 0.3395943 0.3396737 0.3397531 0.3398324 0.3399117 0.3399908 [197] 0.3400699 0.3401490 0.3402279 0.3403068 0.3403857 0.3404644 0.3405431 [204] 0.3406217 0.3407002 0.3407787 0.3408571 0.3409354 0.3410137 0.3410919 [211] 0.3411700 0.3412480 0.3413260 0.3414039 0.3414817 0.3415594 0.3416371 [218] 0.3417147 0.3417922 0.3418697 0.3419471 0.3420244 0.3421016 0.3421788 [225] 0.3422559 0.3423329 0.3424098 0.3424867 0.3425635 0.3426402 0.3427169 [232] 0.3427934 0.3428699 0.3429463 0.3430227 0.3430989 0.3431751 0.3432513 [239] 0.3433273 0.3434033 0.3434792 0.3435550 0.3436307 0.3437064 0.3437820 [246] 0.3438575 0.3439329 0.3440083 0.3440835 0.3441587 0.3442339 0.3443089 [253] 0.3443839 0.3444588 0.3445336 0.3446083 0.3446830 0.3447576 0.3448321 [260] 0.3449065 0.3449809 0.3450551 0.3451293 0.3452034 0.3452775 0.3453514 [267] 0.3454253 0.3454991 0.3455728 0.3456465 0.3457200 0.3457935 0.3458669 [274] 0.3459402 0.3460135 0.3460866 0.3461597 0.3462327 0.3463056 0.3463785 [281] 0.3464512 0.3465239 0.3465965 0.3466690 0.3467415 0.3468138 0.3468861 [288] 0.3469583 0.3470304 0.3471025 0.3471744 0.3472463 0.3473181 0.3473898 [295] 0.3474614 0.3475329 0.3476044 0.3476758 0.3477471 0.3478183 0.3478894 [302] 0.3479605 0.3480314 0.3481023 0.3481731 0.3482438 0.3483145 0.3483850 [309] 0.3484555 0.3485259 0.3485962 0.3486664 0.3487365 0.3488065 0.3488765 [316] 0.3489464 0.3490162 0.3490859 0.3491555 0.3492251 0.3492945 0.3493639 [323] 0.3494332 0.3495024 0.3495715 0.3496406 0.3497095 0.3497784 0.3498471 [330] 0.3499158 0.3499844 0.3500530 0.3501214 0.3501898 0.3502580 0.3503262 [337] 0.3503943 0.3504623 0.3505302 0.3505981 0.3506658 0.3507335 0.3508011 [344] 0.3508685 0.3509359 0.3510033 0.3510705 0.3511376 0.3512047 0.3512717 [351] 0.3513385 0.3514053 0.3514720 0.3515387 0.3516052 0.3516716 0.3517380 [358] 0.3518043 0.3518704 0.3519365 0.3520025 0.3520685 0.3521343 0.3522000 [365] 0.3522657 0.3523313 0.3523967 0.3524621 0.3525274 0.3525926 0.3526577 [372] 0.3527228 0.3527877 0.3528526 0.3529173 0.3529820 0.3530466 0.3531111 [379] 0.3531755 0.3532398 0.3533041 0.3533682 0.3534323 0.3534962 0.3535601 [386] 0.3536239 0.3536876 0.3537512 0.3538147 0.3538781 0.3539414 0.3540047 [393] 0.3540678 0.3541309 0.3541938 0.3542567 0.3543195 0.3543822 0.3544448 [400] 0.3545073 0.3545697 > mx [1] 0.3545697 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1uphz1227446249.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/24y311227446249.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/3onae1227446249.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/4uvi61227446249.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/5zzh11227446249.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/6kvlo1227446249.tab") > > system("convert tmp/1uphz1227446249.ps tmp/1uphz1227446249.png") > system("convert tmp/24y311227446249.ps tmp/24y311227446249.png") > system("convert tmp/3onae1227446249.ps tmp/3onae1227446249.png") > system("convert tmp/4uvi61227446249.ps tmp/4uvi61227446249.png") > system("convert tmp/5zzh11227446249.ps tmp/5zzh11227446249.png") > > > proc.time() user system elapsed 1.066 0.770 1.262