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(3423.40,3242.80,3277.20,3833.00,2606.30,3643.80,3686.40,3281.60,3669.30,3191.50,3512.70,3970.70,3601.20,3610.00,4172.10,3956.20,3142.70,3884.30,3892.20,3613.00,3730.50,3481.30,3649.50,4215.20,4066.60,4196.80,4536.60,4441.60,3548.30,4735.90,4130.60,4356.20,4159.60,3988.00,4167.80,4902.20,3909.40,4697.60,4308.90,4420.40,3544.20,4433.00,4479.70,4533.20,4237.50,4207.40,4394.00,5148.40,4202.20,4682.50,4884.30,5288.90,4505.20,4611.50,5081.10,4523.10,4412.80,4647.40,4778.60,4495.30) > #'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.7233136 0.7236324 0.7239500 0.7242665 0.7245818 0.7248959 0.7252088 [8] 0.7255206 0.7258312 0.7261406 0.7264489 0.7267559 0.7270618 0.7273666 [15] 0.7276701 0.7279725 0.7282737 0.7285738 0.7288726 0.7291703 0.7294669 [22] 0.7297622 0.7300564 0.7303494 0.7306412 0.7309318 0.7312213 0.7315096 [29] 0.7317967 0.7320826 0.7323674 0.7326510 0.7329334 0.7332146 0.7334947 [36] 0.7337735 0.7340512 0.7343278 0.7346031 0.7348773 0.7351503 0.7354221 [43] 0.7356928 0.7359623 0.7362306 0.7364977 0.7367637 0.7370285 0.7372921 [50] 0.7375545 0.7378158 0.7380759 0.7383348 0.7385926 0.7388491 0.7391045 [57] 0.7393588 0.7396118 0.7398637 0.7401144 0.7403640 0.7406124 0.7408596 [64] 0.7411057 0.7413505 0.7415942 0.7418368 0.7420782 0.7423184 0.7425574 [71] 0.7427953 0.7430320 0.7432676 0.7435020 0.7437352 0.7439673 0.7441982 [78] 0.7444279 0.7446565 0.7448839 0.7451102 0.7453353 0.7455592 0.7457820 [85] 0.7460037 0.7462241 0.7464435 0.7466616 0.7468787 0.7470945 0.7473092 [92] 0.7475228 0.7477352 0.7479465 0.7481566 0.7483655 0.7485734 0.7487800 [99] 0.7489855 0.7491899 0.7493932 0.7495953 0.7497962 0.7499960 0.7501947 [106] 0.7503922 0.7505886 0.7507838 0.7509780 0.7511709 0.7513628 0.7515535 [113] 0.7517431 0.7519315 0.7521188 0.7523050 0.7524901 0.7526740 0.7528568 [120] 0.7530384 0.7532190 0.7533984 0.7535767 0.7537539 0.7539299 0.7541049 [127] 0.7542787 0.7544514 0.7546230 0.7547934 0.7549628 0.7551310 0.7552982 [134] 0.7554642 0.7556291 0.7557929 0.7559556 0.7561171 0.7562776 0.7564370 [141] 0.7565953 0.7567524 0.7569085 0.7570635 0.7572173 0.7573701 0.7575218 [148] 0.7576724 0.7578218 0.7579702 0.7581175 0.7582637 0.7584089 0.7585529 [155] 0.7586959 0.7588377 0.7589785 0.7591182 0.7592568 0.7593944 0.7595308 [162] 0.7596662 0.7598005 0.7599337 0.7600659 0.7601970 0.7603270 0.7604560 [169] 0.7605838 0.7607106 0.7608364 0.7609611 0.7610847 0.7612073 0.7613288 [176] 0.7614492 0.7615686 0.7616869 0.7618042 0.7619204 0.7620356 0.7621497 [183] 0.7622628 0.7623748 0.7624858 0.7625957 0.7627046 0.7628124 0.7629192 [190] 0.7630250 0.7631297 0.7632334 0.7633361 0.7634377 0.7635383 0.7636379 [197] 0.7637364 0.7638339 0.7639304 0.7640259 0.7641203 0.7642137 0.7643061 [204] 0.7643975 0.7644878 0.7645772 0.7646655 0.7647528 0.7648391 0.7649244 [211] 0.7650087 0.7650919 0.7651742 0.7652555 0.7653357 0.7654150 0.7654933 [218] 0.7655705 0.7656468 0.7657221 0.7657963 0.7658696 0.7659419 0.7660132 [225] 0.7660835 0.7661529 0.7662212 0.7662886 0.7663550 0.7664204 0.7664848 [232] 0.7665483 0.7666107 0.7666722 0.7667328 0.7667923 0.7668509 0.7669085 [239] 0.7669652 0.7670209 0.7670756 0.7671294 0.7671822 0.7672340 0.7672849 [246] 0.7673348 0.7673838 0.7674319 0.7674789 0.7675251 0.7675702 0.7676145 [253] 0.7676578 0.7677001 0.7677415 0.7677820 0.7678215 0.7678601 0.7678978 [260] 0.7679345 0.7679703 0.7680051 0.7680391 0.7680721 0.7681041 0.7681353 [267] 0.7681655 0.7681948 0.7682232 0.7682507 0.7682772 0.7683029 0.7683276 [274] 0.7683514 0.7683743 0.7683963 0.7684174 0.7684376 0.7684569 0.7684753 [281] 0.7684927 0.7685093 0.7685250 0.7685398 0.7685537 0.7685667 0.7685788 [288] 0.7685900 0.7686003 0.7686097 0.7686183 0.7686260 0.7686327 0.7686386 [295] 0.7686437 0.7686478 0.7686511 0.7686535 0.7686550 0.7686557 0.7686555 [302] 0.7686544 0.7686524 0.7686496 0.7686459 0.7686414 0.7686360 0.7686297 [309] 0.7686226 0.7686147 0.7686058 0.7685962 0.7685856 0.7685743 0.7685620 [316] 0.7685490 0.7685350 0.7685203 0.7685047 0.7684882 0.7684709 0.7684528 [323] 0.7684339 0.7684141 0.7683935 0.7683720 0.7683497 0.7683266 0.7683027 [330] 0.7682779 0.7682524 0.7682259 0.7681987 0.7681707 0.7681418 0.7681121 [337] 0.7680817 0.7680503 0.7680182 0.7679853 0.7679516 0.7679170 0.7678817 [344] 0.7678456 0.7678086 0.7677709 0.7677323 0.7676930 0.7676528 0.7676119 [351] 0.7675702 0.7675277 0.7674843 0.7674402 0.7673954 0.7673497 0.7673032 [358] 0.7672560 0.7672080 0.7671592 0.7671096 0.7670593 0.7670082 0.7669563 [365] 0.7669036 0.7668502 0.7667960 0.7667410 0.7666853 0.7666288 0.7665715 [372] 0.7665135 0.7664547 0.7663951 0.7663348 0.7662738 0.7662120 0.7661494 [379] 0.7660861 0.7660220 0.7659572 0.7658917 0.7658254 0.7657583 0.7656905 [386] 0.7656220 0.7655527 0.7654827 0.7654120 0.7653405 0.7652683 0.7651954 [393] 0.7651217 0.7650473 0.7649722 0.7648963 0.7648197 0.7647424 0.7646644 [400] 0.7645857 0.7645062 > mx [1] 0.7686557 > mxli [1] 0.99 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/11g621225830637.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/2yvfm1225830637.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/39a571225830637.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/4x8u71225830637.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/53fwh1225830637.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/6ee3z1225830637.tab") > > system("convert tmp/11g621225830637.ps tmp/11g621225830637.png") > system("convert tmp/2yvfm1225830637.ps tmp/2yvfm1225830637.png") > system("convert tmp/39a571225830637.ps tmp/39a571225830637.png") > system("convert tmp/4x8u71225830637.ps tmp/4x8u71225830637.png") > system("convert tmp/53fwh1225830637.ps tmp/53fwh1225830637.png") > > > proc.time() user system elapsed 1.340 0.804 1.607