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(15916.4,16535.9,15796,14418.6,15044.5,14944.2,16754.8,14254,15454.9,15644.8,14568.3,12520.2,14803,15873.2,14755.3,12875.1,14291.1,14205.3,15859.4,15258.9,15498.6,15106.5,15023.6,12083,15761.3,16943,15070.3,13659.6,14768.9,14725.1,15998.1,15370.6,14956.9,15469.7,15101.8,11703.7,16283.6,16726.5,14968.9,14861,14583.3,15305.8,17903.9,16379.4,15420.3,17870.5,15912.8,13866.5,17823.2,17872,17420.4,16704.4,15991.2,16583.6,19123.5,17838.7,17209.4,18586.5,16258.1,15141.6,19202.1,17746.5,19090.1,18040.3,17515.5,17751.8,21072.4,17170,19439.5,19795.4,17574.9,16165.4,19464.6,19932.1,19961.2,17343.4,18924.2,18574.1,21350.6,18594.6,19823.1,20844.4,19640.2,17735.4,19813.6,22238.5,20682.2,17818.6,21872.1,22117,21865.9,23451.3,20953.7,22497.3) > #'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.7076352 0.7080279 0.7084197 0.7088106 0.7092007 0.7095899 0.7099782 [8] 0.7103657 0.7107523 0.7111381 0.7115229 0.7119070 0.7122901 0.7126724 [15] 0.7130538 0.7134343 0.7138140 0.7141927 0.7145706 0.7149477 0.7153238 [22] 0.7156991 0.7160735 0.7164470 0.7168196 0.7171913 0.7175622 0.7179321 [29] 0.7183012 0.7186694 0.7190367 0.7194031 0.7197687 0.7201333 0.7204970 [36] 0.7208599 0.7212218 0.7215829 0.7219430 0.7223023 0.7226606 0.7230181 [43] 0.7233747 0.7237303 0.7240851 0.7244390 0.7247919 0.7251440 0.7254951 [50] 0.7258453 0.7261947 0.7265431 0.7268906 0.7272372 0.7275829 0.7279277 [57] 0.7282716 0.7286146 0.7289566 0.7292977 0.7296380 0.7299773 0.7303157 [64] 0.7306532 0.7309897 0.7313254 0.7316601 0.7319939 0.7323268 0.7326588 [71] 0.7329898 0.7333199 0.7336491 0.7339774 0.7343048 0.7346312 0.7349567 [78] 0.7352813 0.7356050 0.7359277 0.7362496 0.7365704 0.7368904 0.7372094 [85] 0.7375275 0.7378447 0.7381610 0.7384763 0.7387907 0.7391041 0.7394167 [92] 0.7397283 0.7400389 0.7403487 0.7406575 0.7409654 0.7412723 0.7415783 [99] 0.7418834 0.7421875 0.7424907 0.7427930 0.7430943 0.7433947 0.7436942 [106] 0.7439927 0.7442903 0.7445870 0.7448827 0.7451775 0.7454714 0.7457643 [113] 0.7460562 0.7463473 0.7466374 0.7469265 0.7472148 0.7475021 0.7477884 [120] 0.7480738 0.7483583 0.7486418 0.7489244 0.7492061 0.7494868 0.7497666 [127] 0.7500454 0.7503233 0.7506003 0.7508763 0.7511514 0.7514255 0.7516987 [134] 0.7519710 0.7522423 0.7525127 0.7527821 0.7530506 0.7533182 0.7535848 [141] 0.7538505 0.7541152 0.7543790 0.7546419 0.7549038 0.7551648 0.7554249 [148] 0.7556840 0.7559421 0.7561994 0.7564557 0.7567110 0.7569654 0.7572189 [155] 0.7574714 0.7577230 0.7579737 0.7582234 0.7584722 0.7587200 0.7589669 [162] 0.7592129 0.7594579 0.7597020 0.7599452 0.7601874 0.7604287 0.7606690 [169] 0.7609084 0.7611469 0.7613844 0.7616210 0.7618567 0.7620914 0.7623252 [176] 0.7625581 0.7627900 0.7630210 0.7632511 0.7634802 0.7637084 0.7639357 [183] 0.7641620 0.7643874 0.7646119 0.7648354 0.7650580 0.7652797 0.7655004 [190] 0.7657202 0.7659391 0.7661571 0.7663741 0.7665902 0.7668054 0.7670196 [197] 0.7672330 0.7674454 0.7676568 0.7678674 0.7680770 0.7682857 0.7684934 [204] 0.7687003 0.7689062 0.7691112 0.7693153 0.7695184 0.7697207 0.7699220 [211] 0.7701224 0.7703218 0.7705204 0.7707180 0.7709147 0.7711105 0.7713054 [218] 0.7714994 0.7716924 0.7718846 0.7720758 0.7722661 0.7724555 0.7726440 [225] 0.7728315 0.7730182 0.7732039 0.7733887 0.7735727 0.7737557 0.7739378 [232] 0.7741190 0.7742992 0.7744786 0.7746571 0.7748347 0.7750113 0.7751871 [239] 0.7753619 0.7755359 0.7757089 0.7758811 0.7760523 0.7762226 0.7763921 [246] 0.7765606 0.7767283 0.7768950 0.7770609 0.7772258 0.7773899 0.7775530 [253] 0.7777153 0.7778767 0.7780372 0.7781968 0.7783555 0.7785133 0.7786702 [260] 0.7788262 0.7789814 0.7791356 0.7792890 0.7794415 0.7795931 0.7797438 [267] 0.7798936 0.7800426 0.7801907 0.7803378 0.7804842 0.7806296 0.7807741 [274] 0.7809178 0.7810606 0.7812025 0.7813436 0.7814837 0.7816230 0.7817615 [281] 0.7818990 0.7820357 0.7821715 0.7823064 0.7824405 0.7825737 0.7827061 [288] 0.7828375 0.7829681 0.7830979 0.7832268 0.7833548 0.7834820 0.7836083 [295] 0.7837337 0.7838583 0.7839820 0.7841049 0.7842269 0.7843480 0.7844683 [302] 0.7845878 0.7847064 0.7848241 0.7849410 0.7850571 0.7851723 0.7852866 [309] 0.7854002 0.7855128 0.7856246 0.7857356 0.7858457 0.7859550 0.7860635 [316] 0.7861711 0.7862779 0.7863838 0.7864889 0.7865932 0.7866966 0.7867992 [323] 0.7869009 0.7870019 0.7871020 0.7872012 0.7872997 0.7873973 0.7874941 [330] 0.7875901 0.7876852 0.7877795 0.7878730 0.7879657 0.7880575 0.7881486 [337] 0.7882388 0.7883282 0.7884167 0.7885045 0.7885915 0.7886776 0.7887629 [344] 0.7888474 0.7889312 0.7890140 0.7890961 0.7891774 0.7892579 0.7893376 [351] 0.7894164 0.7894945 0.7895718 0.7896482 0.7897239 0.7897988 0.7898729 [358] 0.7899461 0.7900186 0.7900903 0.7901612 0.7902313 0.7903006 0.7903692 [365] 0.7904369 0.7905038 0.7905700 0.7906354 0.7907000 0.7907638 0.7908268 [372] 0.7908891 0.7909506 0.7910113 0.7910712 0.7911303 0.7911887 0.7912463 [379] 0.7913031 0.7913592 0.7914144 0.7914690 0.7915227 0.7915757 0.7916279 [386] 0.7916793 0.7917300 0.7917800 0.7918291 0.7918775 0.7919252 0.7919721 [393] 0.7920182 0.7920636 0.7921082 0.7921521 0.7921952 0.7922375 0.7922792 [400] 0.7923200 0.7923602 > mx [1] 0.7923602 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/15qym1229903227.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/2f8yq1229903227.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/3d7sz1229903227.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/4bcnm1229903227.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/5fe6j1229903227.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/6r8ev1229903227.tab") > > system("convert tmp/15qym1229903227.ps tmp/15qym1229903227.png") > system("convert tmp/2f8yq1229903227.ps tmp/2f8yq1229903227.png") > system("convert tmp/3d7sz1229903227.ps tmp/3d7sz1229903227.png") > system("convert tmp/4bcnm1229903227.ps tmp/4bcnm1229903227.png") > system("convert tmp/5fe6j1229903227.ps tmp/5fe6j1229903227.png") > > > proc.time() user system elapsed 1.741 1.302 2.359