R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(111.4,87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7) > #'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.01537523 0.01534718 0.01531924 0.01529140 0.01526367 0.01523603 [7] 0.01520850 0.01518107 0.01515374 0.01512652 0.01509939 0.01507237 [13] 0.01504545 0.01501864 0.01499192 0.01496531 0.01493880 0.01491240 [19] 0.01488609 0.01485989 0.01483379 0.01480779 0.01478190 0.01475611 [25] 0.01473042 0.01470483 0.01467935 0.01465397 0.01462869 0.01460351 [31] 0.01457844 0.01455347 0.01452860 0.01450384 0.01447917 0.01445462 [37] 0.01443016 0.01440580 0.01438155 0.01435740 0.01433336 0.01430942 [43] 0.01428558 0.01426184 0.01423821 0.01421467 0.01419125 0.01416792 [49] 0.01414470 0.01412158 0.01409856 0.01407565 0.01405284 0.01403013 [55] 0.01400752 0.01398502 0.01396262 0.01394033 0.01391813 0.01389604 [61] 0.01387405 0.01385217 0.01383039 0.01380871 0.01378713 0.01376566 [67] 0.01374429 0.01372302 0.01370186 0.01368080 0.01365984 0.01363899 [73] 0.01361823 0.01359759 0.01357704 0.01355660 0.01353626 0.01351602 [79] 0.01349588 0.01347585 0.01345592 0.01343610 0.01341638 0.01339676 [85] 0.01337724 0.01335782 0.01333851 0.01331930 0.01330020 0.01328120 [91] 0.01326230 0.01324350 0.01322480 0.01320621 0.01318772 0.01316934 [97] 0.01315106 0.01313287 0.01311480 0.01309682 0.01307895 0.01306118 [103] 0.01304351 0.01302595 0.01300849 0.01299113 0.01297387 0.01295672 [109] 0.01293966 0.01292272 0.01290587 0.01288913 0.01287248 0.01285594 [115] 0.01283951 0.01282317 0.01280694 0.01279081 0.01277479 0.01275886 [121] 0.01274304 0.01272732 0.01271170 0.01269618 0.01268077 0.01266546 [127] 0.01265025 0.01263514 0.01262014 0.01260524 0.01259044 0.01257574 [133] 0.01256114 0.01254665 0.01253225 0.01251796 0.01250377 0.01248969 [139] 0.01247570 0.01246182 0.01244804 0.01243436 0.01242078 0.01240730 [145] 0.01239393 0.01238065 0.01236748 0.01235441 0.01234144 0.01232858 [151] 0.01231581 0.01230314 0.01229058 0.01227812 0.01226576 0.01225350 [157] 0.01224134 0.01222929 0.01221733 0.01220548 0.01219372 0.01218207 [163] 0.01217052 0.01215907 0.01214772 0.01213647 0.01212532 0.01211427 [169] 0.01210333 0.01209248 0.01208174 0.01207109 0.01206055 0.01205011 [175] 0.01203976 0.01202952 0.01201938 0.01200934 0.01199940 0.01198956 [181] 0.01197981 0.01197017 0.01196063 0.01195119 0.01194185 0.01193261 [187] 0.01192347 0.01191443 0.01190549 0.01189665 0.01188791 0.01187927 [193] 0.01187073 0.01186228 0.01185394 0.01184570 0.01183756 0.01182951 [199] 0.01182157 0.01181372 0.01180597 0.01179833 0.01179078 0.01178333 [205] 0.01177598 0.01176873 0.01176158 0.01175452 0.01174757 0.01174071 [211] 0.01173396 0.01172730 0.01172074 0.01171428 0.01170792 0.01170165 [217] 0.01169549 0.01168942 0.01168345 0.01167758 0.01167181 0.01166613 [223] 0.01166055 0.01165507 0.01164969 0.01164441 0.01163922 0.01163414 [229] 0.01162915 0.01162425 0.01161946 0.01161476 0.01161016 0.01160566 [235] 0.01160125 0.01159695 0.01159273 0.01158862 0.01158460 0.01158068 [241] 0.01157686 0.01157313 0.01156950 0.01156597 0.01156253 0.01155919 [247] 0.01155595 0.01155280 0.01154975 0.01154680 0.01154394 0.01154118 [253] 0.01153851 0.01153595 0.01153347 0.01153109 0.01152881 0.01152663 [259] 0.01152454 0.01152254 0.01152064 0.01151884 0.01151713 0.01151551 [265] 0.01151400 0.01151257 0.01151125 0.01151001 0.01150888 0.01150783 [271] 0.01150689 0.01150603 0.01150527 0.01150461 0.01150404 0.01150356 [277] 0.01150318 0.01150290 0.01150271 0.01150261 0.01150260 0.01150269 [283] 0.01150288 0.01150316 0.01150353 0.01150399 0.01150455 0.01150520 [289] 0.01150595 0.01150679 0.01150772 0.01150875 0.01150987 0.01151108 [295] 0.01151238 0.01151378 0.01151527 0.01151686 0.01151853 0.01152030 [301] 0.01152216 0.01152411 0.01152616 0.01152830 0.01153053 0.01153285 [307] 0.01153527 0.01153777 0.01154037 0.01154306 0.01154584 0.01154872 [313] 0.01155168 0.01155474 0.01155789 0.01156112 0.01156446 0.01156788 [319] 0.01157139 0.01157499 0.01157869 0.01158247 0.01158635 0.01159031 [325] 0.01159437 0.01159852 0.01160275 0.01160708 0.01161150 0.01161601 [331] 0.01162060 0.01162529 0.01163007 0.01163494 0.01163989 0.01164494 [337] 0.01165008 0.01165530 0.01166062 0.01166602 0.01167151 0.01167710 [343] 0.01168277 0.01168853 0.01169437 0.01170031 0.01170634 0.01171245 [349] 0.01171865 0.01172494 0.01173132 0.01173779 0.01174435 0.01175099 [355] 0.01175772 0.01176454 0.01177144 0.01177844 0.01178552 0.01179269 [361] 0.01179994 0.01180729 0.01181472 0.01182223 0.01182984 0.01183753 [367] 0.01184531 0.01185317 0.01186112 0.01186916 0.01187728 0.01188549 [373] 0.01189379 0.01190217 0.01191064 0.01191919 0.01192783 0.01193656 [379] 0.01194537 0.01195426 0.01196325 0.01197231 0.01198147 0.01199070 [385] 0.01200003 0.01200943 0.01201893 0.01202850 0.01203816 0.01204791 [391] 0.01205774 0.01206765 0.01207765 0.01208774 0.01209790 0.01210815 [397] 0.01211849 0.01212891 0.01213941 0.01215000 0.01216066 > mx [1] 0.01537523 > mxli [1] -2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/189jj1258131936.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/2047s1258131936.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/3a2ud1258131936.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/4ji4k1258131936.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/51ge31258131936.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/6six21258131936.tab") > > system("convert tmp/189jj1258131936.ps tmp/189jj1258131936.png") > system("convert tmp/2047s1258131936.ps tmp/2047s1258131936.png") > system("convert tmp/3a2ud1258131936.ps tmp/3a2ud1258131936.png") > system("convert tmp/4ji4k1258131936.ps tmp/4ji4k1258131936.png") > system("convert tmp/51ge31258131936.ps tmp/51ge31258131936.png") > > > proc.time() user system elapsed 1.145 0.830 1.331