R version 2.7.2 (2008-08-25) 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(9682.35,9762.12,10124.63,10540.05,10601.61,10323.73,10418.40,10092.96,10364.91,10152.09,10032.80,10204.59,10001.60,10411.75,10673.38,10539.51,10723.78,10682.06,10283.19,10377.18,10486.64,10545.38,10554.27,10532.54,10324.31,10695.25,10827.81,10872.48,10971.19,11145.65,11234.68,11333.88,10997.97,11036.89,11257.35,11533.59,11963.12,12185.15,12377.62,12512.89,12631.48,12268.53,12754.80,13407.75,13480.21,13673.28,13239.71,13557.69,13901.28,13200.58,13406.97,12538.12,12419.57,12193.88,12656.63,12812.48,12056.67,11322.38,11530.75,11114.08) > #'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.7838656 0.7837327 0.7835997 0.7834664 0.7833330 0.7831995 0.7830658 [8] 0.7829319 0.7827979 0.7826638 0.7825294 0.7823950 0.7822603 0.7821255 [15] 0.7819906 0.7818555 0.7817202 0.7815848 0.7814492 0.7813135 0.7811776 [22] 0.7810416 0.7809054 0.7807691 0.7806326 0.7804959 0.7803591 0.7802222 [29] 0.7800851 0.7799478 0.7798104 0.7796728 0.7795351 0.7793972 0.7792592 [36] 0.7791210 0.7789827 0.7788442 0.7787055 0.7785668 0.7784278 0.7782887 [43] 0.7781495 0.7780101 0.7778705 0.7777308 0.7775910 0.7774510 0.7773108 [50] 0.7771705 0.7770301 0.7768894 0.7767487 0.7766078 0.7764667 0.7763255 [57] 0.7761842 0.7760427 0.7759010 0.7757592 0.7756172 0.7754751 0.7753329 [64] 0.7751905 0.7750479 0.7749052 0.7747624 0.7746194 0.7744763 0.7743330 [71] 0.7741895 0.7740460 0.7739022 0.7737583 0.7736143 0.7734701 0.7733258 [78] 0.7731814 0.7730367 0.7728920 0.7727471 0.7726020 0.7724568 0.7723115 [85] 0.7721660 0.7720203 0.7718746 0.7717286 0.7715826 0.7714364 0.7712900 [92] 0.7711435 0.7709968 0.7708500 0.7707031 0.7705560 0.7704088 0.7702614 [99] 0.7701139 0.7699663 0.7698185 0.7696705 0.7695224 0.7693742 0.7692258 [106] 0.7690773 0.7689287 0.7687799 0.7686309 0.7684818 0.7683326 0.7681832 [113] 0.7680337 0.7678841 0.7677343 0.7675844 0.7674343 0.7672841 0.7671337 [120] 0.7669833 0.7668326 0.7666818 0.7665309 0.7663799 0.7662287 0.7660774 [127] 0.7659259 0.7657743 0.7656225 0.7654707 0.7653186 0.7651665 0.7650142 [134] 0.7648617 0.7647092 0.7645564 0.7644036 0.7642506 0.7640975 0.7639442 [141] 0.7637908 0.7636373 0.7634836 0.7633298 0.7631759 0.7630218 0.7628676 [148] 0.7627132 0.7625587 0.7624041 0.7622493 0.7620945 0.7619394 0.7617843 [155] 0.7616290 0.7614735 0.7613180 0.7611623 0.7610064 0.7608505 0.7606944 [162] 0.7605381 0.7603818 0.7602253 0.7600686 0.7599119 0.7597550 0.7595979 [169] 0.7594408 0.7592835 0.7591261 0.7589685 0.7588108 0.7586530 0.7584951 [176] 0.7583370 0.7581788 0.7580204 0.7578619 0.7577033 0.7575446 0.7573857 [183] 0.7572267 0.7570676 0.7569084 0.7567490 0.7565895 0.7564298 0.7562701 [190] 0.7561102 0.7559502 0.7557900 0.7556297 0.7554693 0.7553088 0.7551481 [197] 0.7549873 0.7548264 0.7546654 0.7545042 0.7543429 0.7541815 0.7540199 [204] 0.7538582 0.7536964 0.7535345 0.7533725 0.7532103 0.7530480 0.7528856 [211] 0.7527230 0.7525603 0.7523975 0.7522346 0.7520715 0.7519084 0.7517451 [218] 0.7515817 0.7514181 0.7512544 0.7510907 0.7509267 0.7507627 0.7505986 [225] 0.7504343 0.7502699 0.7501053 0.7499407 0.7497759 0.7496110 0.7494460 [232] 0.7492809 0.7491157 0.7489503 0.7487848 0.7486192 0.7484535 0.7482876 [239] 0.7481216 0.7479555 0.7477893 0.7476230 0.7474566 0.7472900 0.7471233 [246] 0.7469565 0.7467896 0.7466226 0.7464554 0.7462881 0.7461207 0.7459532 [253] 0.7457856 0.7456179 0.7454500 0.7452820 0.7451139 0.7449457 0.7447774 [260] 0.7446090 0.7444404 0.7442717 0.7441030 0.7439341 0.7437651 0.7435959 [267] 0.7434267 0.7432573 0.7430879 0.7429183 0.7427486 0.7425788 0.7424088 [274] 0.7422388 0.7420687 0.7418984 0.7417280 0.7415575 0.7413869 0.7412162 [281] 0.7410454 0.7408745 0.7407034 0.7405323 0.7403610 0.7401896 0.7400181 [288] 0.7398465 0.7396748 0.7395030 0.7393311 0.7391591 0.7389869 0.7388147 [295] 0.7386423 0.7384698 0.7382972 0.7381245 0.7379518 0.7377788 0.7376058 [302] 0.7374327 0.7372595 0.7370862 0.7369127 0.7367392 0.7365655 0.7363917 [309] 0.7362179 0.7360439 0.7358698 0.7356956 0.7355214 0.7353470 0.7351725 [316] 0.7349979 0.7348232 0.7346483 0.7344734 0.7342984 0.7341233 0.7339480 [323] 0.7337727 0.7335973 0.7334217 0.7332461 0.7330704 0.7328945 0.7327186 [330] 0.7325425 0.7323664 0.7321901 0.7320138 0.7318373 0.7316608 0.7314841 [337] 0.7313073 0.7311305 0.7309535 0.7307765 0.7305993 0.7304221 0.7302447 [344] 0.7300672 0.7298897 0.7297120 0.7295343 0.7293564 0.7291785 0.7290004 [351] 0.7288223 0.7286441 0.7284657 0.7282873 0.7281088 0.7279301 0.7277514 [358] 0.7275726 0.7273937 0.7272147 0.7270356 0.7268564 0.7266771 0.7264977 [365] 0.7263182 0.7261386 0.7259589 0.7257791 0.7255993 0.7254193 0.7252393 [372] 0.7250591 0.7248789 0.7246985 0.7245181 0.7243376 0.7241570 0.7239763 [379] 0.7237955 0.7236146 0.7234336 0.7232526 0.7230714 0.7228902 0.7227088 [386] 0.7225274 0.7223459 0.7221642 0.7219825 0.7218008 0.7216189 0.7214369 [393] 0.7212548 0.7210727 0.7208905 0.7207081 0.7205257 0.7203432 0.7201606 [400] 0.7199780 0.7197952 > mx [1] 0.7838656 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/19cwp1226447186.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/2l2981226447186.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/3znwe1226447186.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/4oeyy1226447186.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/5ayfq1226447186.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/6t99c1226447186.tab") > > system("convert tmp/19cwp1226447186.ps tmp/19cwp1226447186.png") > system("convert tmp/2l2981226447186.ps tmp/2l2981226447186.png") > system("convert tmp/3znwe1226447186.ps tmp/3znwe1226447186.png") > system("convert tmp/4oeyy1226447186.ps tmp/4oeyy1226447186.png") > system("convert tmp/5ayfq1226447186.ps tmp/5ayfq1226447186.png") > > > proc.time() user system elapsed 1.360 0.854 3.371