R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(126.51,131.02,136.51,138.04,132.92,129.61,122.96,124.04,121.29,124.56,118.53,113.14,114.15,122.17,129.23,131.19,129.12,128.28,126.83,138.13,140.52,146.83,135.14,131.84,125.7,128.98,133.25,136.76,133.24,128.54,121.08,120.23,119.08,125.75,126.89,126.6,121.89,123.44,126.46,129.49,127.78,125.29,119.02,119.96,122.86,131.89,132.73,135.01,136.71,142.73,144.43,144.93,138.75,130.22,122.19,128.4,140.43,153.5,149.33,142.97) > #'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.3443166 0.3444113 0.3445060 0.3446007 0.3446954 0.3447900 0.3448847 [8] 0.3449793 0.3450739 0.3451685 0.3452631 0.3453577 0.3454523 0.3455469 [15] 0.3456414 0.3457359 0.3458305 0.3459250 0.3460195 0.3461139 0.3462084 [22] 0.3463029 0.3463973 0.3464917 0.3465861 0.3466805 0.3467749 0.3468693 [29] 0.3469636 0.3470580 0.3471523 0.3472466 0.3473409 0.3474352 0.3475295 [36] 0.3476237 0.3477180 0.3478122 0.3479064 0.3480006 0.3480948 0.3481889 [43] 0.3482831 0.3483772 0.3484713 0.3485654 0.3486595 0.3487536 0.3488477 [50] 0.3489417 0.3490357 0.3491297 0.3492237 0.3493177 0.3494117 0.3495056 [57] 0.3495995 0.3496934 0.3497873 0.3498812 0.3499751 0.3500689 0.3501627 [64] 0.3502565 0.3503503 0.3504441 0.3505378 0.3506316 0.3507253 0.3508190 [71] 0.3509127 0.3510064 0.3511000 0.3511936 0.3512873 0.3513809 0.3514744 [78] 0.3515680 0.3516615 0.3517550 0.3518486 0.3519420 0.3520355 0.3521289 [85] 0.3522224 0.3523158 0.3524092 0.3525025 0.3525959 0.3526892 0.3527825 [92] 0.3528758 0.3529691 0.3530624 0.3531556 0.3532488 0.3533420 0.3534352 [99] 0.3535283 0.3536215 0.3537146 0.3538077 0.3539007 0.3539938 0.3540868 [106] 0.3541798 0.3542728 0.3543658 0.3544587 0.3545517 0.3546446 0.3547374 [113] 0.3548303 0.3549231 0.3550160 0.3551088 0.3552015 0.3552943 0.3553870 [120] 0.3554797 0.3555724 0.3556651 0.3557577 0.3558503 0.3559429 0.3560355 [127] 0.3561281 0.3562206 0.3563131 0.3564056 0.3564980 0.3565905 0.3566829 [134] 0.3567753 0.3568677 0.3569600 0.3570523 0.3571446 0.3572369 0.3573292 [141] 0.3574214 0.3575136 0.3576058 0.3576979 0.3577900 0.3578822 0.3579742 [148] 0.3580663 0.3581583 0.3582503 0.3583423 0.3584343 0.3585262 0.3586181 [155] 0.3587100 0.3588019 0.3588937 0.3589855 0.3590773 0.3591690 0.3592608 [162] 0.3593525 0.3594442 0.3595358 0.3596274 0.3597191 0.3598106 0.3599022 [169] 0.3599937 0.3600852 0.3601767 0.3602681 0.3603595 0.3604509 0.3605423 [176] 0.3606336 0.3607249 0.3608162 0.3609075 0.3609987 0.3610899 0.3611811 [183] 0.3612722 0.3613634 0.3614544 0.3615455 0.3616365 0.3617276 0.3618185 [190] 0.3619095 0.3620004 0.3620913 0.3621822 0.3622730 0.3623638 0.3624546 [197] 0.3625454 0.3626361 0.3627268 0.3628174 0.3629081 0.3629987 0.3630893 [204] 0.3631798 0.3632703 0.3633608 0.3634513 0.3635417 0.3636321 0.3637225 [211] 0.3638128 0.3639031 0.3639934 0.3640837 0.3641739 0.3642641 0.3643543 [218] 0.3644444 0.3645345 0.3646246 0.3647146 0.3648046 0.3648946 0.3649845 [225] 0.3650744 0.3651643 0.3652542 0.3653440 0.3654338 0.3655235 0.3656133 [232] 0.3657030 0.3657926 0.3658822 0.3659718 0.3660614 0.3661509 0.3662404 [239] 0.3663299 0.3664193 0.3665088 0.3665981 0.3666875 0.3667768 0.3668660 [246] 0.3669553 0.3670445 0.3671337 0.3672228 0.3673119 0.3674010 0.3674900 [253] 0.3675790 0.3676680 0.3677569 0.3678459 0.3679347 0.3680236 0.3681124 [260] 0.3682011 0.3682899 0.3683786 0.3684672 0.3685559 0.3686445 0.3687330 [267] 0.3688216 0.3689101 0.3689985 0.3690869 0.3691753 0.3692637 0.3693520 [274] 0.3694403 0.3695285 0.3696167 0.3697049 0.3697931 0.3698812 0.3699692 [281] 0.3700573 0.3701453 0.3702332 0.3703212 0.3704090 0.3704969 0.3705847 [288] 0.3706725 0.3707602 0.3708479 0.3709356 0.3710232 0.3711108 0.3711984 [295] 0.3712859 0.3713734 0.3714608 0.3715483 0.3716356 0.3717230 0.3718103 [302] 0.3718975 0.3719847 0.3720719 0.3721591 0.3722462 0.3723332 0.3724203 [309] 0.3725073 0.3725942 0.3726811 0.3727680 0.3728549 0.3729417 0.3730284 [316] 0.3731151 0.3732018 0.3732885 0.3733751 0.3734616 0.3735482 0.3736346 [323] 0.3737211 0.3738075 0.3738939 0.3739802 0.3740665 0.3741527 0.3742389 [330] 0.3743251 0.3744112 0.3744973 0.3745834 0.3746694 0.3747554 0.3748413 [337] 0.3749272 0.3750130 0.3750988 0.3751846 0.3752703 0.3753560 0.3754416 [344] 0.3755272 0.3756128 0.3756983 0.3757838 0.3758692 0.3759546 0.3760400 [351] 0.3761253 0.3762105 0.3762958 0.3763810 0.3764661 0.3765512 0.3766362 [358] 0.3767213 0.3768062 0.3768912 0.3769761 0.3770609 0.3771457 0.3772305 [365] 0.3773152 0.3773998 0.3774845 0.3775691 0.3776536 0.3777381 0.3778226 [372] 0.3779070 0.3779913 0.3780757 0.3781599 0.3782442 0.3783284 0.3784125 [379] 0.3784966 0.3785807 0.3786647 0.3787487 0.3788326 0.3789165 0.3790003 [386] 0.3790841 0.3791679 0.3792516 0.3793353 0.3794189 0.3795024 0.3795860 [393] 0.3796695 0.3797529 0.3798363 0.3799196 0.3800029 0.3800862 0.3801694 [400] 0.3802525 0.3803357 > mx [1] 0.3803357 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/13dgn1258143518.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/2enar1258143518.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/3d1mm1258143518.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/4n0zl1258143518.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/5ih6m1258143518.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/6kh0e1258143519.tab") > > system("convert tmp/13dgn1258143518.ps tmp/13dgn1258143518.png") > system("convert tmp/2enar1258143518.ps tmp/2enar1258143518.png") > system("convert tmp/3d1mm1258143518.ps tmp/3d1mm1258143518.png") > system("convert tmp/4n0zl1258143518.ps tmp/4n0zl1258143518.png") > system("convert tmp/5ih6m1258143518.ps tmp/5ih6m1258143518.png") > > > proc.time() user system elapsed 1.061 0.761 1.456