R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(12710.3,12120.8,12469.5,12054.6,12112.9,9617.2,12645.8,13581.3,12162.3,10969.7,11880.0,11887.6,12926.9,12300.0,12092.8,12380.8,12196.9,9455.0,13168.0,13427.9,11980.5,11884.8,11691.7,12233.8,14341.4,13130.7,12421.1,14285.8,12864.6,11160.2,14316.2,14388.7,14013.9,13419.0,12769.6,13315.5,15332.9,14243.0,13824.4,14962.9,13202.9,12199.0,15508.9,14199.8,15169.6,14058.0,13786.2,14147.9,16541.7,13587.5,15582.4,15802.8,14130.5,12923.2,15612.2,16033.7,16036.6,14037.8,15330.6,15038.3,17401.8) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Normality Plot (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxnorm.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.6483102 0.6486804 0.6490498 0.6494185 0.6497865 0.6501538 0.6505203 [8] 0.6508862 0.6512513 0.6516157 0.6519794 0.6523424 0.6527046 0.6530661 [15] 0.6534269 0.6537870 0.6541464 0.6545050 0.6548629 0.6552200 0.6555765 [22] 0.6559321 0.6562871 0.6566413 0.6569948 0.6573476 0.6576996 0.6580508 [29] 0.6584014 0.6587511 0.6591002 0.6594485 0.6597960 0.6601428 0.6604889 [36] 0.6608342 0.6611787 0.6615225 0.6618656 0.6622079 0.6625494 0.6628902 [43] 0.6632302 0.6635695 0.6639080 0.6642457 0.6645827 0.6649190 0.6652544 [50] 0.6655891 0.6659231 0.6662563 0.6665887 0.6669203 0.6672512 0.6675813 [57] 0.6679106 0.6682392 0.6685670 0.6688940 0.6692203 0.6695458 0.6698705 [64] 0.6701944 0.6705176 0.6708399 0.6711615 0.6714824 0.6718024 0.6721217 [71] 0.6724402 0.6727579 0.6730748 0.6733910 0.6737063 0.6740209 0.6743347 [78] 0.6746477 0.6749599 0.6752714 0.6755820 0.6758919 0.6762010 0.6765092 [85] 0.6768167 0.6771235 0.6774294 0.6777345 0.6780388 0.6783424 0.6786452 [92] 0.6789471 0.6792483 0.6795487 0.6798483 0.6801470 0.6804450 0.6807422 [99] 0.6810386 0.6813343 0.6816291 0.6819231 0.6822163 0.6825087 0.6828003 [106] 0.6830912 0.6833812 0.6836704 0.6839588 0.6842465 0.6845333 0.6848193 [113] 0.6851046 0.6853890 0.6856726 0.6859554 0.6862375 0.6865187 0.6867991 [120] 0.6870787 0.6873575 0.6876355 0.6879127 0.6881891 0.6884647 0.6887395 [127] 0.6890135 0.6892867 0.6895591 0.6898307 0.6901015 0.6903714 0.6906406 [134] 0.6909090 0.6911765 0.6914433 0.6917092 0.6919744 0.6922387 0.6925022 [141] 0.6927650 0.6930269 0.6932880 0.6935483 0.6938078 0.6940665 0.6943244 [148] 0.6945815 0.6948378 0.6950933 0.6953479 0.6956018 0.6958549 0.6961071 [155] 0.6963586 0.6966092 0.6968590 0.6971081 0.6973563 0.6976037 0.6978504 [162] 0.6980962 0.6983412 0.6985854 0.6988288 0.6990714 0.6993132 0.6995542 [169] 0.6997944 0.7000338 0.7002724 0.7005101 0.7007471 0.7009833 0.7012187 [176] 0.7014532 0.7016870 0.7019200 0.7021522 0.7023835 0.7026141 0.7028438 [183] 0.7030728 0.7033010 0.7035283 0.7037549 0.7039807 0.7042056 0.7044298 [190] 0.7046532 0.7048757 0.7050975 0.7053185 0.7055387 0.7057581 0.7059767 [197] 0.7061944 0.7064114 0.7066276 0.7068430 0.7070577 0.7072715 0.7074845 [204] 0.7076967 0.7079082 0.7081188 0.7083287 0.7085377 0.7087460 0.7089535 [211] 0.7091602 0.7093661 0.7095712 0.7097755 0.7099791 0.7101818 0.7103838 [218] 0.7105850 0.7107854 0.7109850 0.7111838 0.7113818 0.7115791 0.7117755 [225] 0.7119712 0.7121661 0.7123602 0.7125536 0.7127461 0.7129379 0.7131289 [232] 0.7133191 0.7135086 0.7136972 0.7138851 0.7140722 0.7142586 0.7144441 [239] 0.7146289 0.7148129 0.7149961 0.7151786 0.7153603 0.7155412 0.7157213 [246] 0.7159007 0.7160793 0.7162571 0.7164342 0.7166105 0.7167860 0.7169608 [253] 0.7171348 0.7173080 0.7174805 0.7176522 0.7178231 0.7179933 0.7181627 [260] 0.7183314 0.7184993 0.7186664 0.7188328 0.7189984 0.7191633 0.7193274 [267] 0.7194907 0.7196533 0.7198151 0.7199762 0.7201365 0.7202961 0.7204549 [274] 0.7206130 0.7207703 0.7209269 0.7210827 0.7212378 0.7213922 0.7215457 [281] 0.7216986 0.7218507 0.7220020 0.7221526 0.7223025 0.7224516 0.7226000 [288] 0.7227476 0.7228945 0.7230407 0.7231861 0.7233308 0.7234748 0.7236180 [295] 0.7237605 0.7239022 0.7240433 0.7241835 0.7243231 0.7244619 0.7246000 [302] 0.7247374 0.7248740 0.7250100 0.7251451 0.7252796 0.7254134 0.7255464 [309] 0.7256787 0.7258102 0.7259411 0.7260712 0.7262007 0.7263294 0.7264573 [316] 0.7265846 0.7267112 0.7268370 0.7269621 0.7270865 0.7272102 0.7273332 [323] 0.7274555 0.7275771 0.7276979 0.7278181 0.7279375 0.7280563 0.7281743 [330] 0.7282916 0.7284083 0.7285242 0.7286394 0.7287540 0.7288678 0.7289809 [337] 0.7290934 0.7292051 0.7293162 0.7294265 0.7295362 0.7296452 0.7297534 [344] 0.7298610 0.7299679 0.7300741 0.7301796 0.7302845 0.7303886 0.7304921 [351] 0.7305949 0.7306970 0.7307984 0.7308991 0.7309992 0.7310986 0.7311973 [358] 0.7312953 0.7313926 0.7314893 0.7315853 0.7316806 0.7317753 0.7318693 [365] 0.7319626 0.7320552 0.7321472 0.7322385 0.7323292 0.7324192 0.7325085 [372] 0.7325971 0.7326851 0.7327724 0.7328591 0.7329451 0.7330305 0.7331152 [379] 0.7331992 0.7332826 0.7333653 0.7334474 0.7335288 0.7336096 0.7336897 [386] 0.7337692 0.7338480 0.7339262 0.7340037 0.7340806 0.7341568 0.7342324 [393] 0.7343074 0.7343817 0.7344554 0.7345284 0.7346008 0.7346726 0.7347437 [400] 0.7348142 0.7348840 > mx [1] 0.734884 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/12vlb1194257232.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/27qjg1194257232.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/3fp261194257232.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/4lcmi1194257232.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5jczu1194257232.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > grid() > mtext('Transformed Data') > dev.off() null device 1 > 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/6o4z11194257233.tab") > > system("convert tmp/12vlb1194257232.ps tmp/12vlb1194257232.png") > system("convert tmp/27qjg1194257232.ps tmp/27qjg1194257232.png") > system("convert tmp/3fp261194257232.ps tmp/3fp261194257232.png") > system("convert tmp/4lcmi1194257232.ps tmp/4lcmi1194257232.png") > system("convert tmp/5jczu1194257232.ps tmp/5jczu1194257232.png") > > > proc.time() user system elapsed 1.360 0.792 1.544