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(7.8,7.6,7.5,7.6,7.5,7.3,7.6,7.5,7.6,7.9,7.9,8.1,8.2,8.0,7.5,6.8,6.5,6.6,7.6,8.0,8.0,7.7,7.5,7.6,7.7,7.9,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.1,7.9,7.3,6.9,6.6,6.7,6.9,7.0,7.1,7.2,7.1,6.9,7.0,6.8,6.4,6.7,6.7,6.4,6.3,6.2,6.5,6.8,6.8,6.5,6.3,5.9,5.9,6.4,6.4) > #'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.6936921 -0.6936499 -0.6936075 -0.6935649 -0.6935221 -0.6934791 [7] -0.6934360 -0.6933926 -0.6933490 -0.6933053 -0.6932613 -0.6932172 [13] -0.6931728 -0.6931283 -0.6930836 -0.6930387 -0.6929935 -0.6929482 [19] -0.6929027 -0.6928571 -0.6928112 -0.6927651 -0.6927189 -0.6926724 [25] -0.6926258 -0.6925789 -0.6925319 -0.6924847 -0.6924373 -0.6923896 [31] -0.6923419 -0.6922939 -0.6922457 -0.6921973 -0.6921488 -0.6921000 [37] -0.6920511 -0.6920020 -0.6919526 -0.6919031 -0.6918534 -0.6918035 [43] -0.6917535 -0.6917032 -0.6916527 -0.6916021 -0.6915512 -0.6915002 [49] -0.6914490 -0.6913976 -0.6913460 -0.6912942 -0.6912422 -0.6911901 [55] -0.6911377 -0.6910852 -0.6910325 -0.6909795 -0.6909264 -0.6908731 [61] -0.6908197 -0.6907660 -0.6907121 -0.6906581 -0.6906039 -0.6905495 [67] -0.6904949 -0.6904401 -0.6903851 -0.6903299 -0.6902746 -0.6902190 [73] -0.6901633 -0.6901074 -0.6900513 -0.6899950 -0.6899385 -0.6898819 [79] -0.6898250 -0.6897680 -0.6897108 -0.6896534 -0.6895958 -0.6895381 [85] -0.6894801 -0.6894220 -0.6893636 -0.6893051 -0.6892464 -0.6891876 [91] -0.6891285 -0.6890692 -0.6890098 -0.6889502 -0.6888904 -0.6888304 [97] -0.6887703 -0.6887099 -0.6886494 -0.6885887 -0.6885278 -0.6884667 [103] -0.6884054 -0.6883440 -0.6882823 -0.6882205 -0.6881585 -0.6880963 [109] -0.6880340 -0.6879714 -0.6879087 -0.6878458 -0.6877827 -0.6877194 [115] -0.6876560 -0.6875924 -0.6875285 -0.6874645 -0.6874004 -0.6873360 [121] -0.6872715 -0.6872068 -0.6871419 -0.6870768 -0.6870115 -0.6869461 [127] -0.6868805 -0.6868147 -0.6867487 -0.6866825 -0.6866162 -0.6865497 [133] -0.6864830 -0.6864161 -0.6863491 -0.6862818 -0.6862144 -0.6861468 [139] -0.6860790 -0.6860111 -0.6859430 -0.6858747 -0.6858062 -0.6857375 [145] -0.6856687 -0.6855997 -0.6855305 -0.6854611 -0.6853916 -0.6853219 [151] -0.6852520 -0.6851819 -0.6851116 -0.6850412 -0.6849706 -0.6848998 [157] -0.6848289 -0.6847577 -0.6846864 -0.6846149 -0.6845433 -0.6844715 [163] -0.6843994 -0.6843273 -0.6842549 -0.6841824 -0.6841097 -0.6840368 [169] -0.6839637 -0.6838905 -0.6838171 -0.6837435 -0.6836697 -0.6835958 [175] -0.6835217 -0.6834474 -0.6833730 -0.6832984 -0.6832236 -0.6831486 [181] -0.6830735 -0.6829982 -0.6829227 -0.6828470 -0.6827712 -0.6826952 [187] -0.6826190 -0.6825427 -0.6824662 -0.6823895 -0.6823126 -0.6822356 [193] -0.6821584 -0.6820810 -0.6820035 -0.6819258 -0.6818479 -0.6817698 [199] -0.6816916 -0.6816132 -0.6815346 -0.6814559 -0.6813770 -0.6812979 [205] -0.6812187 -0.6811393 -0.6810597 -0.6809800 -0.6809000 -0.6808199 [211] -0.6807397 -0.6806593 -0.6805787 -0.6804979 -0.6804170 -0.6803359 [217] -0.6802546 -0.6801732 -0.6800916 -0.6800098 -0.6799279 -0.6798458 [223] -0.6797636 -0.6796811 -0.6795985 -0.6795158 -0.6794328 -0.6793497 [229] -0.6792665 -0.6791830 -0.6790995 -0.6790157 -0.6789318 -0.6788477 [235] -0.6787634 -0.6786790 -0.6785944 -0.6785097 -0.6784248 -0.6783397 [241] -0.6782545 -0.6781691 -0.6780835 -0.6779978 -0.6779119 -0.6778258 [247] -0.6777396 -0.6776532 -0.6775667 -0.6774799 -0.6773931 -0.6773060 [253] -0.6772188 -0.6771315 -0.6770440 -0.6769563 -0.6768684 -0.6767804 [259] -0.6766923 -0.6766039 -0.6765154 -0.6764268 -0.6763380 -0.6762490 [265] -0.6761599 -0.6760706 -0.6759811 -0.6758915 -0.6758018 -0.6757118 [271] -0.6756217 -0.6755315 -0.6754411 -0.6753505 -0.6752598 -0.6751689 [277] -0.6750779 -0.6749866 -0.6748953 -0.6748038 -0.6747121 -0.6746203 [283] -0.6745283 -0.6744361 -0.6743438 -0.6742513 -0.6741587 -0.6740659 [289] -0.6739730 -0.6738799 -0.6737867 -0.6736933 -0.6735997 -0.6735060 [295] -0.6734121 -0.6733181 -0.6732239 -0.6731296 -0.6730351 -0.6729404 [301] -0.6728456 -0.6727507 -0.6726555 -0.6725603 -0.6724649 -0.6723693 [307] -0.6722736 -0.6721777 -0.6720816 -0.6719854 -0.6718891 -0.6717926 [313] -0.6716960 -0.6715992 -0.6715022 -0.6714051 -0.6713078 -0.6712104 [319] -0.6711129 -0.6710151 -0.6709173 -0.6708193 -0.6707211 -0.6706228 [325] -0.6705243 -0.6704257 -0.6703269 -0.6702280 -0.6701289 -0.6700297 [331] -0.6699303 -0.6698308 -0.6697311 -0.6696313 -0.6695313 -0.6694312 [337] -0.6693309 -0.6692305 -0.6691299 -0.6690292 -0.6689283 -0.6688273 [343] -0.6687261 -0.6686248 -0.6685234 -0.6684218 -0.6683200 -0.6682181 [349] -0.6681161 -0.6680139 -0.6679115 -0.6678090 -0.6677064 -0.6676036 [355] -0.6675007 -0.6673976 -0.6672944 -0.6671910 -0.6670875 -0.6669838 [361] -0.6668800 -0.6667761 -0.6666720 -0.6665678 -0.6664634 -0.6663589 [367] -0.6662542 -0.6661494 -0.6660444 -0.6659393 -0.6658341 -0.6657287 [373] -0.6656231 -0.6655175 -0.6654116 -0.6653057 -0.6651996 -0.6650933 [379] -0.6649869 -0.6648804 -0.6647737 -0.6646669 -0.6645600 -0.6644529 [385] -0.6643456 -0.6642382 -0.6641307 -0.6640231 -0.6639153 -0.6638073 [391] -0.6636992 -0.6635910 -0.6634826 -0.6633741 -0.6632655 -0.6631567 [397] -0.6630478 -0.6629387 -0.6628295 -0.6627202 -0.6626107 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/104tc1226430602.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/freestat/rcomp/tmp/2bvmx1226430602.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/freestat/rcomp/tmp/3i2rd1226430602.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/freestat/rcomp/tmp/4c6cg1226430602.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/freestat/rcomp/tmp/5qz8p1226430602.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/6xz391226430602.tab") > > system("convert tmp/104tc1226430602.ps tmp/104tc1226430602.png") > system("convert tmp/2bvmx1226430602.ps tmp/2bvmx1226430602.png") > system("convert tmp/3i2rd1226430602.ps tmp/3i2rd1226430602.png") > system("convert tmp/4c6cg1226430602.ps tmp/4c6cg1226430602.png") > system("convert tmp/5qz8p1226430602.ps tmp/5qz8p1226430602.png") > > > proc.time() user system elapsed 1.744 1.300 2.938