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(124.1,124.4,115.7,108.3,102.3,104.6,104,103.5,96,96.6,95.4,92.1,93,90.4,93.3,97.1,111,114.1,113.3,111,107.2,118.3,134.1,139,116.7,112.5,122.8,130,125.6,123.8,135.8,136.4,135.3,149.5,159.6,161.4,175.2,199.5,245,257.8) > #'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.7076595 0.7080657 0.7084709 0.7088752 0.7092786 0.7096810 0.7100824 [8] 0.7104829 0.7108824 0.7112809 0.7116784 0.7120749 0.7124703 0.7128648 [15] 0.7132582 0.7136505 0.7140418 0.7144321 0.7148212 0.7152093 0.7155962 [22] 0.7159821 0.7163668 0.7167505 0.7171330 0.7175143 0.7178945 0.7182735 [29] 0.7186513 0.7190280 0.7194035 0.7197777 0.7201508 0.7205226 0.7208932 [36] 0.7212625 0.7216306 0.7219974 0.7223630 0.7227272 0.7230902 0.7234518 [43] 0.7238122 0.7241712 0.7245289 0.7248852 0.7252402 0.7255938 0.7259460 [50] 0.7262969 0.7266463 0.7269944 0.7273410 0.7276862 0.7280299 0.7283722 [57] 0.7287131 0.7290524 0.7293903 0.7297267 0.7300616 0.7303950 0.7307269 [64] 0.7310572 0.7313860 0.7317132 0.7320389 0.7323630 0.7326855 0.7330065 [71] 0.7333258 0.7336435 0.7339596 0.7342740 0.7345868 0.7348979 0.7352074 [78] 0.7355152 0.7358213 0.7361257 0.7364284 0.7367294 0.7370286 0.7373261 [85] 0.7376219 0.7379159 0.7382081 0.7384986 0.7387872 0.7390741 0.7393591 [92] 0.7396423 0.7399237 0.7402033 0.7404810 0.7407568 0.7410308 0.7413029 [99] 0.7415730 0.7418413 0.7421077 0.7423721 0.7426347 0.7428952 0.7431538 [106] 0.7434105 0.7436652 0.7439179 0.7441686 0.7444173 0.7446640 0.7449087 [113] 0.7451513 0.7453919 0.7456305 0.7458670 0.7461014 0.7463338 0.7465640 [120] 0.7467922 0.7470183 0.7472422 0.7474640 0.7476837 0.7479013 0.7481166 [127] 0.7483299 0.7485409 0.7487498 0.7489565 0.7491610 0.7493633 0.7495633 [134] 0.7497612 0.7499568 0.7501502 0.7503413 0.7505302 0.7507168 0.7509011 [141] 0.7510831 0.7512629 0.7514403 0.7516155 0.7517883 0.7519588 0.7521270 [148] 0.7522928 0.7524563 0.7526174 0.7527762 0.7529326 0.7530866 0.7532382 [155] 0.7533875 0.7535343 0.7536787 0.7538208 0.7539604 0.7540975 0.7542323 [162] 0.7543646 0.7544944 0.7546218 0.7547467 0.7548692 0.7549892 0.7551067 [169] 0.7552217 0.7553342 0.7554442 0.7555517 0.7556568 0.7557592 0.7558592 [176] 0.7559566 0.7560515 0.7561439 0.7562337 0.7563210 0.7564057 0.7564879 [183] 0.7565674 0.7566445 0.7567189 0.7567908 0.7568600 0.7569267 0.7569908 [190] 0.7570523 0.7571112 0.7571675 0.7572212 0.7572723 0.7573207 0.7573666 [197] 0.7574098 0.7574503 0.7574883 0.7575236 0.7575563 0.7575863 0.7576137 [204] 0.7576385 0.7576606 0.7576800 0.7576968 0.7577110 0.7577224 0.7577313 [211] 0.7577374 0.7577409 0.7577418 0.7577399 0.7577354 0.7577282 0.7577184 [218] 0.7577059 0.7576907 0.7576728 0.7576523 0.7576291 0.7576032 0.7575746 [225] 0.7575434 0.7575094 0.7574728 0.7574335 0.7573916 0.7573469 0.7572996 [232] 0.7572496 0.7571970 0.7571416 0.7570836 0.7570229 0.7569596 0.7568936 [239] 0.7568249 0.7567535 0.7566795 0.7566028 0.7565234 0.7564414 0.7563567 [246] 0.7562694 0.7561794 0.7560867 0.7559914 0.7558935 0.7557929 0.7556897 [253] 0.7555838 0.7554753 0.7553642 0.7552505 0.7551341 0.7550151 0.7548935 [260] 0.7547693 0.7546424 0.7545130 0.7543810 0.7542463 0.7541091 0.7539693 [267] 0.7538269 0.7536819 0.7535344 0.7533843 0.7532316 0.7530764 0.7529186 [274] 0.7527583 0.7525954 0.7524300 0.7522621 0.7520916 0.7519186 0.7517432 [281] 0.7515652 0.7513847 0.7512018 0.7510163 0.7508284 0.7506380 0.7504451 [288] 0.7502498 0.7500520 0.7498518 0.7496492 0.7494441 0.7492367 0.7490268 [295] 0.7488145 0.7485998 0.7483827 0.7481633 0.7479414 0.7477172 0.7474907 [302] 0.7472618 0.7470306 0.7467970 0.7465612 0.7463230 0.7460825 0.7458397 [309] 0.7455947 0.7453474 0.7450978 0.7448459 0.7445918 0.7443355 0.7440770 [316] 0.7438162 0.7435532 0.7432881 0.7430207 0.7427512 0.7424795 0.7422057 [323] 0.7419297 0.7416516 0.7413713 0.7410890 0.7408045 0.7405180 0.7402293 [330] 0.7399386 0.7396459 0.7393511 0.7390543 0.7387554 0.7384545 0.7381517 [337] 0.7378468 0.7375400 0.7372312 0.7369204 0.7366077 0.7362930 0.7359765 [344] 0.7356580 0.7353377 0.7350154 0.7346913 0.7343653 0.7340375 0.7337078 [351] 0.7333763 0.7330430 0.7327079 0.7323710 0.7320324 0.7316920 0.7313498 [358] 0.7310059 0.7306603 0.7303129 0.7299639 0.7296131 0.7292607 0.7289067 [365] 0.7285510 0.7281936 0.7278347 0.7274741 0.7271119 0.7267482 0.7263828 [372] 0.7260160 0.7256475 0.7252776 0.7249061 0.7245331 0.7241586 0.7237827 [379] 0.7234053 0.7230264 0.7226461 0.7222644 0.7218812 0.7214967 0.7211107 [386] 0.7207234 0.7203348 0.7199448 0.7195534 0.7191608 0.7187668 0.7183716 [393] 0.7179750 0.7175772 0.7171782 0.7167779 0.7163763 0.7159736 0.7155697 [400] 0.7151646 0.7147583 > mx [1] 0.7577418 > mxli [1] 0.12 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1s0481230044042.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/2cnxc1230044042.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/3gbft1230044042.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/4oqlq1230044042.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/5nv2i1230044042.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/6mgg51230044042.tab") > system("convert tmp/1s0481230044042.ps tmp/1s0481230044042.png") > system("convert tmp/2cnxc1230044042.ps tmp/2cnxc1230044042.png") > system("convert tmp/3gbft1230044042.ps tmp/3gbft1230044042.png") > system("convert tmp/4oqlq1230044042.ps tmp/4oqlq1230044042.png") > system("convert tmp/5nv2i1230044042.ps tmp/5nv2i1230044042.png") > > > proc.time() user system elapsed 1.056 0.774 1.264