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(12300.00,12092.80,12380.80,12196.90,9455.00,13168.00,13427.90,11980.50,11884.80,11691.70,12233.80,14341.40,13130.70,12421.10,14285.80,12864.60,11160.20,14316.20,14388.70,14013.90,13419.00,12769.60,13315.50,15332.90,14243.00,13824.40,14962.90,13202.90,12199.00,15508.90,14199.80,15169.60,14058.00,13786.20,14147.90,16541.70,13587.50,15582.40,15802.80,14130.50,12923.20,15612.20,16033.70,16036.60,14037.80,15330.60,15038.30,17401.80,14992.50,16043.70,16929.60,15921.30,14417.20,15961.00,17851.90,16483.90,14215.50,17429.70,17839.50,17629.20) > #'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.7406323 0.7409762 0.7413190 0.7416608 0.7420016 0.7423413 0.7426801 [8] 0.7430177 0.7433544 0.7436900 0.7440245 0.7443581 0.7446905 0.7450220 [15] 0.7453524 0.7456818 0.7460102 0.7463375 0.7466638 0.7469890 0.7473132 [22] 0.7476364 0.7479585 0.7482796 0.7485997 0.7489187 0.7492367 0.7495536 [29] 0.7498696 0.7501844 0.7504983 0.7508111 0.7511229 0.7514336 0.7517433 [36] 0.7520520 0.7523597 0.7526663 0.7529718 0.7532764 0.7535799 0.7538824 [43] 0.7541838 0.7544842 0.7547836 0.7550819 0.7553793 0.7556755 0.7559708 [50] 0.7562650 0.7565582 0.7568504 0.7571415 0.7574316 0.7577207 0.7580088 [57] 0.7582958 0.7585818 0.7588668 0.7591507 0.7594336 0.7597155 0.7599964 [64] 0.7602763 0.7605551 0.7608329 0.7611097 0.7613855 0.7616602 0.7619339 [71] 0.7622067 0.7624783 0.7627490 0.7630187 0.7632873 0.7635549 0.7638215 [78] 0.7640871 0.7643517 0.7646153 0.7648778 0.7651394 0.7653999 0.7656595 [85] 0.7659180 0.7661755 0.7664320 0.7666875 0.7669420 0.7671954 0.7674479 [92] 0.7676994 0.7679499 0.7681994 0.7684478 0.7686953 0.7689418 0.7691873 [99] 0.7694317 0.7696752 0.7699177 0.7701592 0.7703997 0.7706392 0.7708777 [106] 0.7711153 0.7713518 0.7715874 0.7718219 0.7720555 0.7722881 0.7725197 [113] 0.7727503 0.7729800 0.7732086 0.7734363 0.7736630 0.7738887 0.7741135 [120] 0.7743373 0.7745601 0.7747819 0.7750028 0.7752226 0.7754416 0.7756595 [127] 0.7758765 0.7760925 0.7763075 0.7765216 0.7767347 0.7769469 0.7771581 [134] 0.7773683 0.7775776 0.7777859 0.7779933 0.7781997 0.7784051 0.7786096 [141] 0.7788132 0.7790158 0.7792175 0.7794182 0.7796179 0.7798168 0.7800146 [148] 0.7802116 0.7804076 0.7806026 0.7807967 0.7809899 0.7811821 0.7813734 [155] 0.7815638 0.7817533 0.7819418 0.7821294 0.7823160 0.7825017 0.7826866 [162] 0.7828704 0.7830534 0.7832354 0.7834165 0.7835968 0.7837760 0.7839544 [169] 0.7841319 0.7843084 0.7844840 0.7846588 0.7848326 0.7850055 0.7851775 [176] 0.7853486 0.7855188 0.7856881 0.7858565 0.7860240 0.7861906 0.7863563 [183] 0.7865211 0.7866850 0.7868480 0.7870101 0.7871714 0.7873318 0.7874912 [190] 0.7876498 0.7878075 0.7879644 0.7881203 0.7882754 0.7884296 0.7885829 [197] 0.7887354 0.7888869 0.7890376 0.7891875 0.7893364 0.7894846 0.7896318 [204] 0.7897782 0.7899237 0.7900683 0.7902121 0.7903551 0.7904972 0.7906384 [211] 0.7907788 0.7909183 0.7910570 0.7911948 0.7913318 0.7914680 0.7916033 [218] 0.7917377 0.7918713 0.7920041 0.7921361 0.7922672 0.7923975 0.7925269 [225] 0.7926555 0.7927833 0.7929103 0.7930364 0.7931617 0.7932862 0.7934099 [232] 0.7935327 0.7936547 0.7937760 0.7938963 0.7940159 0.7941347 0.7942527 [239] 0.7943698 0.7944862 0.7946017 0.7947165 0.7948304 0.7949435 0.7950559 [246] 0.7951674 0.7952782 0.7953881 0.7954973 0.7956056 0.7957132 0.7958200 [253] 0.7959260 0.7960312 0.7961357 0.7962393 0.7963422 0.7964443 0.7965456 [260] 0.7966462 0.7967460 0.7968450 0.7969432 0.7970407 0.7971374 0.7972333 [267] 0.7973285 0.7974229 0.7975165 0.7976094 0.7977016 0.7977929 0.7978836 [274] 0.7979734 0.7980625 0.7981509 0.7982385 0.7983254 0.7984115 0.7984969 [281] 0.7985816 0.7986655 0.7987487 0.7988311 0.7989128 0.7989938 0.7990740 [288] 0.7991535 0.7992323 0.7993103 0.7993877 0.7994643 0.7995401 0.7996153 [295] 0.7996897 0.7997635 0.7998365 0.7999088 0.7999803 0.8000512 0.8001214 [302] 0.8001908 0.8002596 0.8003276 0.8003950 0.8004616 0.8005275 0.8005928 [309] 0.8006573 0.8007212 0.8007843 0.8008468 0.8009086 0.8009697 0.8010301 [316] 0.8010898 0.8011488 0.8012072 0.8012648 0.8013218 0.8013781 0.8014338 [323] 0.8014887 0.8015430 0.8015966 0.8016496 0.8017018 0.8017535 0.8018044 [330] 0.8018547 0.8019043 0.8019533 0.8020016 0.8020492 0.8020962 0.8021425 [337] 0.8021882 0.8022333 0.8022776 0.8023214 0.8023645 0.8024069 0.8024487 [344] 0.8024899 0.8025304 0.8025703 0.8026095 0.8026481 0.8026861 0.8027234 [351] 0.8027601 0.8027962 0.8028317 0.8028665 0.8029007 0.8029343 0.8029672 [358] 0.8029996 0.8030313 0.8030624 0.8030929 0.8031227 0.8031520 0.8031806 [365] 0.8032087 0.8032361 0.8032629 0.8032891 0.8033147 0.8033398 0.8033642 [372] 0.8033880 0.8034112 0.8034338 0.8034558 0.8034773 0.8034981 0.8035183 [379] 0.8035380 0.8035571 0.8035755 0.8035934 0.8036108 0.8036275 0.8036437 [386] 0.8036592 0.8036742 0.8036887 0.8037025 0.8037158 0.8037285 0.8037406 [393] 0.8037522 0.8037632 0.8037736 0.8037835 0.8037928 0.8038016 0.8038098 [400] 0.8038174 0.8038245 > mx [1] 0.8038245 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/17zur1226425206.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/freestat/rcomp/tmp/2then1226425206.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/freestat/rcomp/tmp/3bdts1226425206.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/freestat/rcomp/tmp/4d8zp1226425206.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/freestat/rcomp/tmp/5pimp1226425206.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/6rzsf1226425206.tab") > > system("convert tmp/17zur1226425206.ps tmp/17zur1226425206.png") > system("convert tmp/2then1226425206.ps tmp/2then1226425206.png") > system("convert tmp/3bdts1226425206.ps tmp/3bdts1226425206.png") > system("convert tmp/4d8zp1226425206.ps tmp/4d8zp1226425206.png") > system("convert tmp/5pimp1226425206.ps tmp/5pimp1226425206.png") > > > proc.time() user system elapsed 1.710 1.252 2.051