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(8,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.7,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.9,7.7,7.4,7.5,8,8.1) > #'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.3607648 -0.3607571 -0.3607493 -0.3607415 -0.3607335 -0.3607254 [7] -0.3607173 -0.3607090 -0.3607007 -0.3606922 -0.3606836 -0.3606750 [13] -0.3606662 -0.3606573 -0.3606484 -0.3606393 -0.3606302 -0.3606209 [19] -0.3606115 -0.3606021 -0.3605925 -0.3605828 -0.3605731 -0.3605632 [25] -0.3605533 -0.3605432 -0.3605330 -0.3605228 -0.3605124 -0.3605019 [31] -0.3604914 -0.3604807 -0.3604700 -0.3604591 -0.3604481 -0.3604371 [37] -0.3604259 -0.3604147 -0.3604033 -0.3603918 -0.3603803 -0.3603686 [43] -0.3603569 -0.3603450 -0.3603330 -0.3603210 -0.3603088 -0.3602966 [49] -0.3602842 -0.3602718 -0.3602592 -0.3602466 -0.3602338 -0.3602210 [55] -0.3602080 -0.3601950 -0.3601818 -0.3601686 -0.3601552 -0.3601418 [61] -0.3601282 -0.3601146 -0.3601008 -0.3600870 -0.3600730 -0.3600590 [67] -0.3600449 -0.3600306 -0.3600163 -0.3600019 -0.3599873 -0.3599727 [73] -0.3599580 -0.3599431 -0.3599282 -0.3599132 -0.3598980 -0.3598828 [79] -0.3598675 -0.3598521 -0.3598366 -0.3598209 -0.3598052 -0.3597894 [85] -0.3597735 -0.3597575 -0.3597414 -0.3597252 -0.3597089 -0.3596925 [91] -0.3596760 -0.3596594 -0.3596427 -0.3596259 -0.3596090 -0.3595920 [97] -0.3595749 -0.3595577 -0.3595404 -0.3595230 -0.3595055 -0.3594880 [103] -0.3594703 -0.3594525 -0.3594346 -0.3594167 -0.3593986 -0.3593804 [109] -0.3593622 -0.3593438 -0.3593254 -0.3593068 -0.3592882 -0.3592694 [115] -0.3592506 -0.3592316 -0.3592126 -0.3591935 -0.3591742 -0.3591549 [121] -0.3591355 -0.3591160 -0.3590963 -0.3590766 -0.3590568 -0.3590369 [127] -0.3590169 -0.3589968 -0.3589766 -0.3589563 -0.3589359 -0.3589154 [133] -0.3588948 -0.3588742 -0.3588534 -0.3588325 -0.3588115 -0.3587905 [139] -0.3587693 -0.3587481 -0.3587267 -0.3587053 -0.3586837 -0.3586621 [145] -0.3586403 -0.3586185 -0.3585966 -0.3585746 -0.3585524 -0.3585302 [151] -0.3585079 -0.3584855 -0.3584630 -0.3584404 -0.3584177 -0.3583950 [157] -0.3583721 -0.3583491 -0.3583260 -0.3583029 -0.3582796 -0.3582563 [163] -0.3582328 -0.3582093 -0.3581856 -0.3581619 -0.3581381 -0.3581141 [169] -0.3580901 -0.3580660 -0.3580418 -0.3580175 -0.3579931 -0.3579686 [175] -0.3579440 -0.3579194 -0.3578946 -0.3578697 -0.3578448 -0.3578197 [181] -0.3577946 -0.3577693 -0.3577440 -0.3577186 -0.3576931 -0.3576675 [187] -0.3576418 -0.3576160 -0.3575901 -0.3575641 -0.3575380 -0.3575118 [193] -0.3574856 -0.3574592 -0.3574328 -0.3574062 -0.3573796 -0.3573528 [199] -0.3573260 -0.3572991 -0.3572721 -0.3572450 -0.3572178 -0.3571905 [205] -0.3571632 -0.3571357 -0.3571081 -0.3570805 -0.3570527 -0.3570249 [211] -0.3569970 -0.3569689 -0.3569408 -0.3569126 -0.3568843 -0.3568560 [217] -0.3568275 -0.3567989 -0.3567702 -0.3567415 -0.3567127 -0.3566837 [223] -0.3566547 -0.3566256 -0.3565964 -0.3565671 -0.3565377 -0.3565082 [229] -0.3564786 -0.3564490 -0.3564192 -0.3563894 -0.3563594 -0.3563294 [235] -0.3562993 -0.3562691 -0.3562388 -0.3562084 -0.3561780 -0.3561474 [241] -0.3561167 -0.3560860 -0.3560552 -0.3560243 -0.3559932 -0.3559621 [247] -0.3559310 -0.3558997 -0.3558683 -0.3558369 -0.3558053 -0.3557737 [253] -0.3557419 -0.3557101 -0.3556782 -0.3556462 -0.3556142 -0.3555820 [259] -0.3555497 -0.3555174 -0.3554850 -0.3554524 -0.3554198 -0.3553871 [265] -0.3553543 -0.3553215 -0.3552885 -0.3552555 -0.3552223 -0.3551891 [271] -0.3551558 -0.3551224 -0.3550889 -0.3550553 -0.3550217 -0.3549879 [277] -0.3549541 -0.3549202 -0.3548861 -0.3548520 -0.3548179 -0.3547836 [283] -0.3547492 -0.3547148 -0.3546803 -0.3546456 -0.3546109 -0.3545761 [289] -0.3545413 -0.3545063 -0.3544713 -0.3544361 -0.3544009 -0.3543656 [295] -0.3543302 -0.3542947 -0.3542592 -0.3542235 -0.3541878 -0.3541520 [301] -0.3541161 -0.3540801 -0.3540440 -0.3540079 -0.3539716 -0.3539353 [307] -0.3538989 -0.3538624 -0.3538258 -0.3537891 -0.3537524 -0.3537155 [313] -0.3536786 -0.3536416 -0.3536045 -0.3535674 -0.3535301 -0.3534928 [319] -0.3534553 -0.3534178 -0.3533802 -0.3533426 -0.3533048 -0.3532670 [325] -0.3532290 -0.3531910 -0.3531529 -0.3531148 -0.3530765 -0.3530382 [331] -0.3529998 -0.3529613 -0.3529227 -0.3528840 -0.3528453 -0.3528064 [337] -0.3527675 -0.3527285 -0.3526894 -0.3526503 -0.3526110 -0.3525717 [343] -0.3525323 -0.3524928 -0.3524532 -0.3524136 -0.3523739 -0.3523340 [349] -0.3522942 -0.3522542 -0.3522141 -0.3521740 -0.3521338 -0.3520935 [355] -0.3520531 -0.3520126 -0.3519721 -0.3519315 -0.3518908 -0.3518500 [361] -0.3518091 -0.3517682 -0.3517272 -0.3516861 -0.3516449 -0.3516036 [367] -0.3515623 -0.3515209 -0.3514794 -0.3514378 -0.3513962 -0.3513544 [373] -0.3513126 -0.3512707 -0.3512287 -0.3511867 -0.3511446 -0.3511024 [379] -0.3510601 -0.3510177 -0.3509753 -0.3509328 -0.3508902 -0.3508475 [385] -0.3508047 -0.3507619 -0.3507190 -0.3506760 -0.3506329 -0.3505898 [391] -0.3505466 -0.3505033 -0.3504599 -0.3504165 -0.3503729 -0.3503293 [397] -0.3502857 -0.3502419 -0.3501981 -0.3501542 -0.3501102 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1dmro1257350022.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/2c96m1257350022.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/3rdz31257350022.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/4yzli1257350022.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/5rtll1257350022.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/62mis1257350022.tab") > > system("convert tmp/1dmro1257350022.ps tmp/1dmro1257350022.png") > system("convert tmp/2c96m1257350022.ps tmp/2c96m1257350022.png") > system("convert tmp/3rdz31257350022.ps tmp/3rdz31257350022.png") > system("convert tmp/4yzli1257350022.ps tmp/4yzli1257350022.png") > system("convert tmp/5rtll1257350022.ps tmp/5rtll1257350022.png") > > > proc.time() user system elapsed 1.120 0.814 2.516