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(111.632,106.707,108.827,108.413,106.249,104.861,102.382,100.320,100.228,117.089,121.523,114.948,112.831,107.605,108.928,101.993,102.850,99.925,101.536,99.450,98.305,110.159,109.483,106.810,96.279,91.982,90.276,90.999,86.622,83.117,80.367,77.550,77.443,92.844,92.175,84.822,81.632,78.872,81.485,80.651,78.192,76.844,76.335,71.415,73.889,86.822,86.371,83.469,82.662,82.880,89.406,95.378,97.657,100.247,99.180,97.493,101.628,114.585,115.669,111.311) > #'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.3501455 -0.3502024 -0.3502591 -0.3503155 -0.3503719 -0.3504280 [7] -0.3504839 -0.3505396 -0.3505952 -0.3506505 -0.3507057 -0.3507607 [13] -0.3508155 -0.3508701 -0.3509245 -0.3509787 -0.3510328 -0.3510866 [19] -0.3511402 -0.3511937 -0.3512470 -0.3513000 -0.3513529 -0.3514056 [25] -0.3514581 -0.3515104 -0.3515625 -0.3516144 -0.3516661 -0.3517176 [31] -0.3517690 -0.3518201 -0.3518710 -0.3519218 -0.3519723 -0.3520227 [37] -0.3520728 -0.3521228 -0.3521725 -0.3522221 -0.3522715 -0.3523206 [43] -0.3523696 -0.3524184 -0.3524669 -0.3525153 -0.3525635 -0.3526115 [49] -0.3526593 -0.3527068 -0.3527542 -0.3528014 -0.3528484 -0.3528951 [55] -0.3529417 -0.3529881 -0.3530343 -0.3530803 -0.3531260 -0.3531716 [61] -0.3532170 -0.3532621 -0.3533071 -0.3533519 -0.3533964 -0.3534408 [67] -0.3534849 -0.3535289 -0.3535726 -0.3536161 -0.3536595 -0.3537026 [73] -0.3537455 -0.3537882 -0.3538308 -0.3538731 -0.3539152 -0.3539571 [79] -0.3539987 -0.3540402 -0.3540815 -0.3541226 -0.3541634 -0.3542041 [85] -0.3542445 -0.3542848 -0.3543248 -0.3543646 -0.3544042 -0.3544436 [91] -0.3544828 -0.3545218 -0.3545606 -0.3545991 -0.3546375 -0.3546756 [97] -0.3547136 -0.3547513 -0.3547888 -0.3548261 -0.3548632 -0.3549001 [103] -0.3549368 -0.3549732 -0.3550095 -0.3550455 -0.3550813 -0.3551169 [109] -0.3551523 -0.3551875 -0.3552225 -0.3552572 -0.3552917 -0.3553261 [115] -0.3553602 -0.3553941 -0.3554278 -0.3554612 -0.3554945 -0.3555275 [121] -0.3555604 -0.3555930 -0.3556253 -0.3556575 -0.3556895 -0.3557212 [127] -0.3557528 -0.3557841 -0.3558152 -0.3558460 -0.3558767 -0.3559071 [133] -0.3559374 -0.3559674 -0.3559972 -0.3560267 -0.3560561 -0.3560852 [139] -0.3561141 -0.3561428 -0.3561713 -0.3561996 -0.3562276 -0.3562554 [145] -0.3562830 -0.3563104 -0.3563376 -0.3563645 -0.3563912 -0.3564177 [151] -0.3564440 -0.3564700 -0.3564959 -0.3565215 -0.3565469 -0.3565720 [157] -0.3565970 -0.3566217 -0.3566462 -0.3566705 -0.3566946 -0.3567184 [163] -0.3567420 -0.3567654 -0.3567886 -0.3568115 -0.3568342 -0.3568567 [169] -0.3568790 -0.3569011 -0.3569229 -0.3569445 -0.3569659 -0.3569870 [175] -0.3570079 -0.3570286 -0.3570491 -0.3570694 -0.3570894 -0.3571092 [181] -0.3571288 -0.3571481 -0.3571673 -0.3571862 -0.3572048 -0.3572233 [187] -0.3572415 -0.3572595 -0.3572773 -0.3572948 -0.3573121 -0.3573292 [193] -0.3573461 -0.3573627 -0.3573791 -0.3573953 -0.3574112 -0.3574270 [199] -0.3574424 -0.3574577 -0.3574728 -0.3574876 -0.3575021 -0.3575165 [205] -0.3575306 -0.3575445 -0.3575582 -0.3575716 -0.3575848 -0.3575978 [211] -0.3576106 -0.3576231 -0.3576354 -0.3576474 -0.3576593 -0.3576709 [217] -0.3576822 -0.3576934 -0.3577043 -0.3577150 -0.3577254 -0.3577356 [223] -0.3577456 -0.3577554 -0.3577649 -0.3577742 -0.3577832 -0.3577921 [229] -0.3578007 -0.3578090 -0.3578172 -0.3578251 -0.3578328 -0.3578402 [235] -0.3578474 -0.3578544 -0.3578611 -0.3578677 -0.3578739 -0.3578800 [241] -0.3578858 -0.3578914 -0.3578968 -0.3579019 -0.3579068 -0.3579114 [247] -0.3579158 -0.3579200 -0.3579240 -0.3579277 -0.3579312 -0.3579345 [253] -0.3579375 -0.3579403 -0.3579428 -0.3579451 -0.3579472 -0.3579491 [259] -0.3579507 -0.3579521 -0.3579533 -0.3579542 -0.3579549 -0.3579553 [265] -0.3579555 -0.3579555 -0.3579553 -0.3579548 -0.3579541 -0.3579531 [271] -0.3579519 -0.3579505 -0.3579488 -0.3579470 -0.3579448 -0.3579425 [277] -0.3579399 -0.3579370 -0.3579340 -0.3579307 -0.3579271 -0.3579234 [283] -0.3579194 -0.3579151 -0.3579106 -0.3579059 -0.3579010 -0.3578958 [289] -0.3578904 -0.3578847 -0.3578789 -0.3578727 -0.3578664 -0.3578598 [295] -0.3578530 -0.3578459 -0.3578386 -0.3578311 -0.3578233 -0.3578153 [301] -0.3578070 -0.3577986 -0.3577899 -0.3577809 -0.3577717 -0.3577623 [307] -0.3577526 -0.3577428 -0.3577326 -0.3577223 -0.3577117 -0.3577008 [313] -0.3576898 -0.3576785 -0.3576669 -0.3576552 -0.3576431 -0.3576309 [319] -0.3576184 -0.3576057 -0.3575927 -0.3575795 -0.3575661 -0.3575525 [325] -0.3575386 -0.3575244 -0.3575101 -0.3574954 -0.3574806 -0.3574655 [331] -0.3574502 -0.3574347 -0.3574189 -0.3574029 -0.3573866 -0.3573701 [337] -0.3573534 -0.3573364 -0.3573192 -0.3573018 -0.3572841 -0.3572662 [343] -0.3572481 -0.3572297 -0.3572111 -0.3571923 -0.3571732 -0.3571539 [349] -0.3571343 -0.3571145 -0.3570945 -0.3570743 -0.3570538 -0.3570330 [355] -0.3570121 -0.3569909 -0.3569694 -0.3569478 -0.3569259 -0.3569037 [361] -0.3568814 -0.3568588 -0.3568359 -0.3568128 -0.3567895 -0.3567660 [367] -0.3567422 -0.3567182 -0.3566939 -0.3566695 -0.3566447 -0.3566198 [373] -0.3565946 -0.3565692 -0.3565435 -0.3565176 -0.3564915 -0.3564652 [379] -0.3564386 -0.3564118 -0.3563847 -0.3563574 -0.3563299 -0.3563021 [385] -0.3562741 -0.3562459 -0.3562174 -0.3561888 -0.3561598 -0.3561307 [391] -0.3561013 -0.3560717 -0.3560418 -0.3560117 -0.3559814 -0.3559508 [397] -0.3559201 -0.3558890 -0.3558578 -0.3558263 -0.3557946 > 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/1uipr1258137617.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/2rygq1258137617.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/39a5r1258137617.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/4440c1258137617.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/55rbt1258137617.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/6xhaf1258137617.tab") > > system("convert tmp/1uipr1258137617.ps tmp/1uipr1258137617.png") > system("convert tmp/2rygq1258137617.ps tmp/2rygq1258137617.png") > system("convert tmp/39a5r1258137617.ps tmp/39a5r1258137617.png") > system("convert tmp/4440c1258137617.ps tmp/4440c1258137617.png") > system("convert tmp/55rbt1258137617.ps tmp/55rbt1258137617.png") > > > proc.time() user system elapsed 1.085 0.792 1.318