R version 2.8.1 (2008-12-22) 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(100,91.74,84.40,84.40,87.16,88.07,87.16,83.49,81.65,82.57,92.66,94.50,93.58,88.07,84.40,85.32,86.24,86.24,84.40,82.57,82.57,82.57,89.91,91.74,89.91,85.32,82.57,82.57,83.49,83.49,83.49,84.40,80.73,76.15,77.06,74.31,70.64,72.48,72.48,73.39,72.48,69.72,65.14,62.39,59.63,63.30,75.23,79.82,76.15,72.48,68.81,71.56,76.15,77.06,75.23,70.64,66.06,66.97,74.31,77.98) > #'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.6853196 -0.6855767 -0.6858335 -0.6860898 -0.6863459 -0.6866015 [7] -0.6868568 -0.6871118 -0.6873663 -0.6876205 -0.6878743 -0.6881278 [13] -0.6883809 -0.6886336 -0.6888859 -0.6891379 -0.6893895 -0.6896407 [19] -0.6898916 -0.6901421 -0.6903922 -0.6906419 -0.6908913 -0.6911402 [25] -0.6913888 -0.6916371 -0.6918849 -0.6921324 -0.6923795 -0.6926262 [31] -0.6928725 -0.6931185 -0.6933640 -0.6936092 -0.6938540 -0.6940984 [37] -0.6943425 -0.6945861 -0.6948294 -0.6950723 -0.6953148 -0.6955569 [43] -0.6957986 -0.6960400 -0.6962809 -0.6965215 -0.6967616 -0.6970014 [49] -0.6972408 -0.6974798 -0.6977184 -0.6979566 -0.6981944 -0.6984319 [55] -0.6986689 -0.6989056 -0.6991418 -0.6993777 -0.6996131 -0.6998482 [61] -0.7000828 -0.7003171 -0.7005510 -0.7007844 -0.7010175 -0.7012502 [67] -0.7014825 -0.7017143 -0.7019458 -0.7021769 -0.7024075 -0.7026378 [73] -0.7028677 -0.7030971 -0.7033262 -0.7035548 -0.7037831 -0.7040109 [79] -0.7042383 -0.7044654 -0.7046920 -0.7049182 -0.7051440 -0.7053694 [85] -0.7055944 -0.7058190 -0.7060431 -0.7062669 -0.7064902 -0.7067132 [91] -0.7069357 -0.7071578 -0.7073795 -0.7076008 -0.7078217 -0.7080421 [97] -0.7082622 -0.7084818 -0.7087010 -0.7089198 -0.7091382 -0.7093562 [103] -0.7095737 -0.7097908 -0.7100075 -0.7102238 -0.7104397 -0.7106552 [109] -0.7108702 -0.7110848 -0.7112990 -0.7115128 -0.7117261 -0.7119390 [115] -0.7121515 -0.7123636 -0.7125753 -0.7127865 -0.7129973 -0.7132077 [121] -0.7134177 -0.7136272 -0.7138363 -0.7140450 -0.7142532 -0.7144610 [127] -0.7146684 -0.7148754 -0.7150819 -0.7152881 -0.7154937 -0.7156990 [133] -0.7159038 -0.7161082 -0.7163121 -0.7165157 -0.7167188 -0.7169214 [139] -0.7171237 -0.7173255 -0.7175268 -0.7177278 -0.7179282 -0.7181283 [145] -0.7183279 -0.7185271 -0.7187259 -0.7189242 -0.7191221 -0.7193195 [151] -0.7195165 -0.7197131 -0.7199092 -0.7201049 -0.7203002 -0.7204950 [157] -0.7206894 -0.7208833 -0.7210768 -0.7212698 -0.7214625 -0.7216546 [163] -0.7218464 -0.7220376 -0.7222285 -0.7224189 -0.7226089 -0.7227984 [169] -0.7229874 -0.7231761 -0.7233643 -0.7235520 -0.7237393 -0.7239261 [175] -0.7241125 -0.7242985 -0.7244840 -0.7246691 -0.7248537 -0.7250379 [181] -0.7252216 -0.7254049 -0.7255877 -0.7257701 -0.7259520 -0.7261335 [187] -0.7263145 -0.7264951 -0.7266752 -0.7268549 -0.7270341 -0.7272129 [193] -0.7273912 -0.7275691 -0.7277465 -0.7279235 -0.7281000 -0.7282760 [199] -0.7284516 -0.7286268 -0.7288015 -0.7289757 -0.7291495 -0.7293229 [205] -0.7294958 -0.7296682 -0.7298402 -0.7300117 -0.7301827 -0.7303533 [211] -0.7305235 -0.7306932 -0.7308624 -0.7310312 -0.7311995 -0.7313674 [217] -0.7315348 -0.7317017 -0.7318682 -0.7320342 -0.7321998 -0.7323649 [223] -0.7325296 -0.7326937 -0.7328575 -0.7330207 -0.7331836 -0.7333459 [229] -0.7335078 -0.7336692 -0.7338302 -0.7339907 -0.7341507 -0.7343103 [235] -0.7344694 -0.7346281 -0.7347862 -0.7349440 -0.7351012 -0.7352580 [241] -0.7354144 -0.7355702 -0.7357256 -0.7358806 -0.7360351 -0.7361891 [247] -0.7363426 -0.7364957 -0.7366483 -0.7368005 -0.7369521 -0.7371034 [253] -0.7372541 -0.7374044 -0.7375542 -0.7377036 -0.7378525 -0.7380009 [259] -0.7381488 -0.7382963 -0.7384433 -0.7385899 -0.7387359 -0.7388816 [265] -0.7390267 -0.7391714 -0.7393156 -0.7394593 -0.7396026 -0.7397454 [271] -0.7398877 -0.7400296 -0.7401709 -0.7403119 -0.7404523 -0.7405923 [277] -0.7407318 -0.7408708 -0.7410094 -0.7411475 -0.7412851 -0.7414223 [283] -0.7415590 -0.7416952 -0.7418309 -0.7419662 -0.7421010 -0.7422353 [289] -0.7423691 -0.7425025 -0.7426354 -0.7427679 -0.7428998 -0.7430313 [295] -0.7431623 -0.7432929 -0.7434229 -0.7435525 -0.7436816 -0.7438103 [301] -0.7439385 -0.7440662 -0.7441934 -0.7443201 -0.7444464 -0.7445722 [307] -0.7446976 -0.7448224 -0.7449468 -0.7450707 -0.7451941 -0.7453171 [313] -0.7454396 -0.7455616 -0.7456831 -0.7458042 -0.7459248 -0.7460449 [319] -0.7461645 -0.7462837 -0.7464024 -0.7465206 -0.7466383 -0.7467555 [325] -0.7468723 -0.7469886 -0.7471045 -0.7472198 -0.7473347 -0.7474491 [331] -0.7475630 -0.7476765 -0.7477894 -0.7479019 -0.7480139 -0.7481255 [337] -0.7482365 -0.7483471 -0.7484572 -0.7485669 -0.7486760 -0.7487847 [343] -0.7488929 -0.7490006 -0.7491079 -0.7492147 -0.7493210 -0.7494268 [349] -0.7495321 -0.7496370 -0.7497414 -0.7498453 -0.7499487 -0.7500517 [355] -0.7501542 -0.7502562 -0.7503577 -0.7504588 -0.7505593 -0.7506594 [361] -0.7507590 -0.7508582 -0.7509569 -0.7510550 -0.7511527 -0.7512500 [367] -0.7513467 -0.7514430 -0.7515388 -0.7516341 -0.7517290 -0.7518233 [373] -0.7519172 -0.7520107 -0.7521036 -0.7521960 -0.7522880 -0.7523795 [379] -0.7524706 -0.7525611 -0.7526512 -0.7527408 -0.7528299 -0.7529185 [385] -0.7530067 -0.7530944 -0.7531816 -0.7532683 -0.7533546 -0.7534404 [391] -0.7535257 -0.7536105 -0.7536949 -0.7537787 -0.7538621 -0.7539451 [397] -0.7540275 -0.7541095 -0.7541910 -0.7542720 -0.7543525 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/rcomp/tmp/1sf8h1257950328.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/rcomp/tmp/2qggg1257950328.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/rcomp/tmp/3bpq31257950328.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/rcomp/tmp/4msya1257950328.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/rcomp/tmp/5laqn1257950328.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/6jykh1257950328.tab") > > system("convert tmp/1sf8h1257950328.ps tmp/1sf8h1257950328.png") > system("convert tmp/2qggg1257950328.ps tmp/2qggg1257950328.png") > system("convert tmp/3bpq31257950328.ps tmp/3bpq31257950328.png") > system("convert tmp/4msya1257950328.ps tmp/4msya1257950328.png") > system("convert tmp/5laqn1257950328.ps tmp/5laqn1257950328.png") > > > proc.time() user system elapsed 1.34 1.17 2.27