R version 2.10.0 (2009-10-26) 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(3016.70,3052.40,3099.60,3103.30,3119.80,3093.70,3164.90,3311.50,3410.60,3392.60,3338.20,3285.10,3294.80,3611.20,3611.30,3521.00,3519.30,3438.30,3534.90,3705.80,3807.60,3663.00,3604.50,3563.80,3511.40,3546.50,3525.40,3529.90,3591.60,3668.30,3728.80,3853.60,3897.70,3640.70,3495.50,3495.10,3268.00,3479.10,3417.80,3521.30,3487.10,3529.90,3544.30,3710.80,3641.90,3447.10,3386.80,3438.50,3364.30,3462.70,3291.90,3550.00,3611.00,3708.60,3771.10,4042.70,3988.40,3851.20,3876.70) > #'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.6936091 0.6935799 0.6935507 0.6935214 0.6934920 0.6934625 0.6934330 [8] 0.6934033 0.6933736 0.6933437 0.6933138 0.6932838 0.6932537 0.6932235 [15] 0.6931933 0.6931629 0.6931324 0.6931019 0.6930713 0.6930405 0.6930097 [22] 0.6929788 0.6929478 0.6929168 0.6928856 0.6928543 0.6928230 0.6927915 [29] 0.6927600 0.6927284 0.6926967 0.6926649 0.6926330 0.6926011 0.6925690 [36] 0.6925368 0.6925046 0.6924723 0.6924399 0.6924074 0.6923748 0.6923421 [43] 0.6923093 0.6922764 0.6922435 0.6922104 0.6921773 0.6921441 0.6921108 [50] 0.6920774 0.6920439 0.6920103 0.6919766 0.6919428 0.6919090 0.6918750 [57] 0.6918410 0.6918069 0.6917727 0.6917384 0.6917040 0.6916695 0.6916349 [64] 0.6916003 0.6915655 0.6915307 0.6914958 0.6914607 0.6914256 0.6913904 [71] 0.6913551 0.6913198 0.6912843 0.6912487 0.6912131 0.6911773 0.6911415 [78] 0.6911056 0.6910696 0.6910335 0.6909973 0.6909610 0.6909246 0.6908882 [85] 0.6908516 0.6908150 0.6907783 0.6907414 0.6907045 0.6906675 0.6906304 [92] 0.6905933 0.6905560 0.6905186 0.6904812 0.6904436 0.6904060 0.6903683 [99] 0.6903305 0.6902926 0.6902546 0.6902165 0.6901783 0.6901400 0.6901017 [106] 0.6900632 0.6900247 0.6899861 0.6899474 0.6899086 0.6898697 0.6898307 [113] 0.6897916 0.6897524 0.6897132 0.6896738 0.6896344 0.6895948 0.6895552 [120] 0.6895155 0.6894757 0.6894358 0.6893958 0.6893558 0.6893156 0.6892754 [127] 0.6892350 0.6891946 0.6891541 0.6891135 0.6890727 0.6890320 0.6889911 [134] 0.6889501 0.6889090 0.6888679 0.6888266 0.6887853 0.6887439 0.6887024 [141] 0.6886607 0.6886190 0.6885773 0.6885354 0.6884934 0.6884514 0.6884092 [148] 0.6883670 0.6883246 0.6882822 0.6882397 0.6881971 0.6881544 0.6881116 [155] 0.6880688 0.6880258 0.6879828 0.6879396 0.6878964 0.6878531 0.6878096 [162] 0.6877661 0.6877225 0.6876789 0.6876351 0.6875912 0.6875473 0.6875032 [169] 0.6874591 0.6874149 0.6873706 0.6873261 0.6872817 0.6872371 0.6871924 [176] 0.6871476 0.6871028 0.6870578 0.6870128 0.6869677 0.6869225 0.6868771 [183] 0.6868318 0.6867863 0.6867407 0.6866950 0.6866493 0.6866034 0.6865575 [190] 0.6865115 0.6864653 0.6864191 0.6863728 0.6863265 0.6862800 0.6862334 [197] 0.6861868 0.6861400 0.6860932 0.6860463 0.6859993 0.6859522 0.6859050 [204] 0.6858577 0.6858103 0.6857628 0.6857153 0.6856677 0.6856199 0.6855721 [211] 0.6855242 0.6854762 0.6854281 0.6853799 0.6853317 0.6852833 0.6852348 [218] 0.6851863 0.6851377 0.6850890 0.6850402 0.6849913 0.6849423 0.6848932 [225] 0.6848441 0.6847948 0.6847455 0.6846960 0.6846465 0.6845969 0.6845472 [232] 0.6844974 0.6844475 0.6843976 0.6843475 0.6842974 0.6842472 0.6841968 [239] 0.6841464 0.6840959 0.6840453 0.6839947 0.6839439 0.6838930 0.6838421 [246] 0.6837911 0.6837400 0.6836887 0.6836374 0.6835861 0.6835346 0.6834830 [253] 0.6834314 0.6833796 0.6833278 0.6832759 0.6832239 0.6831718 0.6831196 [260] 0.6830673 0.6830150 0.6829625 0.6829100 0.6828574 0.6828046 0.6827518 [267] 0.6826990 0.6826460 0.6825929 0.6825398 0.6824865 0.6824332 0.6823798 [274] 0.6823263 0.6822727 0.6822190 0.6821652 0.6821114 0.6820574 0.6820034 [281] 0.6819493 0.6818951 0.6818408 0.6817864 0.6817319 0.6816773 0.6816227 [288] 0.6815680 0.6815132 0.6814582 0.6814032 0.6813482 0.6812930 0.6812377 [295] 0.6811824 0.6811270 0.6810714 0.6810158 0.6809601 0.6809044 0.6808485 [302] 0.6807926 0.6807365 0.6806804 0.6806242 0.6805679 0.6805115 0.6804550 [309] 0.6803984 0.6803418 0.6802851 0.6802282 0.6801713 0.6801144 0.6800573 [316] 0.6800001 0.6799429 0.6798855 0.6798281 0.6797706 0.6797130 0.6796553 [323] 0.6795975 0.6795397 0.6794817 0.6794237 0.6793656 0.6793074 0.6792491 [330] 0.6791907 0.6791323 0.6790738 0.6790151 0.6789564 0.6788976 0.6788387 [337] 0.6787798 0.6787207 0.6786616 0.6786023 0.6785430 0.6784836 0.6784242 [344] 0.6783646 0.6783050 0.6782452 0.6781854 0.6781255 0.6780655 0.6780054 [351] 0.6779453 0.6778850 0.6778247 0.6777643 0.6777038 0.6776432 0.6775825 [358] 0.6775218 0.6774610 0.6774000 0.6773390 0.6772780 0.6772168 0.6771555 [365] 0.6770942 0.6770328 0.6769713 0.6769097 0.6768480 0.6767862 0.6767244 [372] 0.6766625 0.6766005 0.6765384 0.6764762 0.6764139 0.6763516 0.6762892 [379] 0.6762267 0.6761641 0.6761014 0.6760386 0.6759758 0.6759129 0.6758499 [386] 0.6757868 0.6757236 0.6756603 0.6755970 0.6755336 0.6754701 0.6754065 [393] 0.6753428 0.6752791 0.6752153 0.6751513 0.6750873 0.6750233 0.6749591 [400] 0.6748949 0.6748305 > mx [1] 0.693609 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/rcomp/tmp/151qm1258155711.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/rcomp/tmp/2i95e1258155711.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/rcomp/tmp/3o8021258155711.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/rcomp/tmp/4jo9x1258155711.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/rcomp/tmp/5ppfa1258155711.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/6t8qh1258155711.tab") > > system("convert tmp/151qm1258155711.ps tmp/151qm1258155711.png") > system("convert tmp/2i95e1258155711.ps tmp/2i95e1258155711.png") > system("convert tmp/3o8021258155711.ps tmp/3o8021258155711.png") > system("convert tmp/4jo9x1258155711.ps tmp/4jo9x1258155711.png") > system("convert tmp/5ppfa1258155711.ps tmp/5ppfa1258155711.png") > > > proc.time() user system elapsed 1.320 1.230 2.035