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(373,371,354,357,363,364,363,358,357,357,380,378,376,380,379,384,392,394,392,396,392,396,419,421,420,418,410,418,426,428,430,424,423,427,441,449,452,462,455,461,461,463,462,456,455,456,472,472,471,465,459,465,468,467,463,460,462,461,476,476,471,453,443,442,444,438,427,424,416,406,431,434,418) > #'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.7345479 0.7344796 0.7344111 0.7343424 0.7342736 0.7342047 0.7341356 [8] 0.7340664 0.7339970 0.7339275 0.7338579 0.7337881 0.7337182 0.7336481 [15] 0.7335779 0.7335076 0.7334371 0.7333665 0.7332957 0.7332248 0.7331537 [22] 0.7330825 0.7330112 0.7329397 0.7328681 0.7327963 0.7327244 0.7326524 [29] 0.7325802 0.7325079 0.7324354 0.7323628 0.7322901 0.7322172 0.7321442 [36] 0.7320710 0.7319977 0.7319243 0.7318507 0.7317770 0.7317031 0.7316291 [43] 0.7315550 0.7314807 0.7314063 0.7313317 0.7312570 0.7311822 0.7311072 [50] 0.7310321 0.7309568 0.7308814 0.7308059 0.7307302 0.7306544 0.7305785 [57] 0.7305024 0.7304262 0.7303498 0.7302733 0.7301966 0.7301199 0.7300429 [64] 0.7299659 0.7298887 0.7298114 0.7297339 0.7296563 0.7295785 0.7295007 [71] 0.7294226 0.7293445 0.7292662 0.7291878 0.7291092 0.7290305 0.7289516 [78] 0.7288727 0.7287935 0.7287143 0.7286349 0.7285554 0.7284757 0.7283959 [85] 0.7283160 0.7282359 0.7281557 0.7280753 0.7279949 0.7279142 0.7278335 [92] 0.7277526 0.7276716 0.7275904 0.7275091 0.7274277 0.7273461 0.7272644 [99] 0.7271826 0.7271006 0.7270185 0.7269363 0.7268539 0.7267714 0.7266887 [106] 0.7266059 0.7265230 0.7264400 0.7263568 0.7262735 0.7261900 0.7261064 [113] 0.7260227 0.7259389 0.7258549 0.7257707 0.7256865 0.7256021 0.7255176 [120] 0.7254329 0.7253481 0.7252632 0.7251782 0.7250930 0.7250076 0.7249222 [127] 0.7248366 0.7247509 0.7246650 0.7245791 0.7244929 0.7244067 0.7243203 [134] 0.7242338 0.7241472 0.7240604 0.7239735 0.7238864 0.7237993 0.7237120 [141] 0.7236245 0.7235370 0.7234493 0.7233615 0.7232735 0.7231854 0.7230972 [148] 0.7230088 0.7229204 0.7228318 0.7227430 0.7226542 0.7225652 0.7224760 [155] 0.7223868 0.7222974 0.7222079 0.7221182 0.7220284 0.7219385 0.7218485 [162] 0.7217583 0.7216681 0.7215776 0.7214871 0.7213964 0.7213056 0.7212147 [169] 0.7211236 0.7210324 0.7209411 0.7208496 0.7207581 0.7206664 0.7205745 [176] 0.7204826 0.7203905 0.7202983 0.7202059 0.7201135 0.7200209 0.7199282 [183] 0.7198353 0.7197423 0.7196492 0.7195560 0.7194627 0.7193692 0.7192756 [190] 0.7191819 0.7190880 0.7189940 0.7188999 0.7188057 0.7187113 0.7186168 [197] 0.7185222 0.7184275 0.7183327 0.7182377 0.7181426 0.7180473 0.7179520 [204] 0.7178565 0.7177609 0.7176652 0.7175693 0.7174733 0.7173772 0.7172810 [211] 0.7171847 0.7170882 0.7169916 0.7168949 0.7167981 0.7167011 0.7166040 [218] 0.7165068 0.7164095 0.7163120 0.7162145 0.7161168 0.7160190 0.7159210 [225] 0.7158230 0.7157248 0.7156265 0.7155281 0.7154295 0.7153309 0.7152321 [232] 0.7151332 0.7150341 0.7149350 0.7148357 0.7147363 0.7146368 0.7145372 [239] 0.7144375 0.7143376 0.7142376 0.7141375 0.7140373 0.7139369 0.7138365 [246] 0.7137359 0.7136352 0.7135344 0.7134334 0.7133324 0.7132312 0.7131299 [253] 0.7130285 0.7129270 0.7128253 0.7127236 0.7126217 0.7125197 0.7124176 [260] 0.7123153 0.7122130 0.7121105 0.7120079 0.7119052 0.7118024 0.7116995 [267] 0.7115965 0.7114933 0.7113900 0.7112866 0.7111831 0.7110795 0.7109757 [274] 0.7108719 0.7107679 0.7106638 0.7105596 0.7104553 0.7103509 0.7102464 [281] 0.7101417 0.7100369 0.7099320 0.7098270 0.7097219 0.7096167 0.7095114 [288] 0.7094059 0.7093004 0.7091947 0.7090889 0.7089830 0.7088770 0.7087708 [295] 0.7086646 0.7085583 0.7084518 0.7083452 0.7082385 0.7081317 0.7080248 [302] 0.7079178 0.7078107 0.7077034 0.7075961 0.7074886 0.7073811 0.7072734 [309] 0.7071656 0.7070577 0.7069497 0.7068415 0.7067333 0.7066250 0.7065165 [316] 0.7064080 0.7062993 0.7061905 0.7060816 0.7059726 0.7058635 0.7057543 [323] 0.7056450 0.7055356 0.7054261 0.7053164 0.7052067 0.7050968 0.7049868 [330] 0.7048768 0.7047666 0.7046563 0.7045459 0.7044354 0.7043248 0.7042141 [337] 0.7041033 0.7039924 0.7038814 0.7037702 0.7036590 0.7035477 0.7034362 [344] 0.7033247 0.7032130 0.7031013 0.7029894 0.7028774 0.7027654 0.7026532 [351] 0.7025409 0.7024285 0.7023160 0.7022035 0.7020908 0.7019780 0.7018651 [358] 0.7017521 0.7016390 0.7015258 0.7014125 0.7012991 0.7011855 0.7010719 [365] 0.7009582 0.7008444 0.7007305 0.7006165 0.7005024 0.7003881 0.7002738 [372] 0.7001594 0.7000449 0.6999303 0.6998155 0.6997007 0.6995858 0.6994708 [379] 0.6993557 0.6992405 0.6991251 0.6990097 0.6988942 0.6987786 0.6986629 [386] 0.6985471 0.6984312 0.6983152 0.6981991 0.6980829 0.6979666 0.6978502 [393] 0.6977337 0.6976171 0.6975004 0.6973837 0.6972668 0.6971498 0.6970328 [400] 0.6969156 0.6967983 > mx [1] 0.734548 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1wu5l1193950355.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/2pxwk1193950355.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/3pnfe1193950355.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/4b78t1193950355.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/5o0jt1193950355.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/6s2sz1193950355.tab") > > system("convert tmp/1wu5l1193950355.ps tmp/1wu5l1193950355.png") > system("convert tmp/2pxwk1193950355.ps tmp/2pxwk1193950355.png") > system("convert tmp/3pnfe1193950355.ps tmp/3pnfe1193950355.png") > system("convert tmp/4b78t1193950355.ps tmp/4b78t1193950355.png") > system("convert tmp/5o0jt1193950355.ps tmp/5o0jt1193950355.png") > > > proc.time() user system elapsed 1.304 0.796 1.556