R version 2.7.0 (2008-04-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(82.7,88.9,105.9,100.8,94,105,58.5,87.6,113.1,112.5,89.6,74.5,82.7,90.1,109.4,96,89.2,109.1,49.1,92.9,107.7,103.5,91.1,79.8,71.9,82.9,90.1,100.7,90.7,108.8,44.1,93.6,107.4,96.5,93.6,76.5,76.7,84,103.3,88.5,99,105.9,44.7,94,107.1,104.8,102.5,77.7,85.2,91.3,106.5,92.4,97.5,107,51.1,98.6,102.2,114.3,99.4,72.5,92.3,99.4,85.9,109.4,97.6) > #'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.02217924 0.02230636 0.02243361 0.02256099 0.02268849 0.02281612 [7] 0.02294387 0.02307174 0.02319973 0.02332785 0.02345608 0.02358442 [13] 0.02371288 0.02384146 0.02397014 0.02409893 0.02422784 0.02435685 [19] 0.02448596 0.02461518 0.02474449 0.02487391 0.02500343 0.02513304 [25] 0.02526275 0.02539255 0.02552245 0.02565243 0.02578250 0.02591266 [31] 0.02604290 0.02617323 0.02630363 0.02643412 0.02656469 0.02669533 [37] 0.02682604 0.02695683 0.02708769 0.02721861 0.02734961 0.02748067 [43] 0.02761179 0.02774298 0.02787422 0.02800552 0.02813688 0.02826830 [49] 0.02839976 0.02853128 0.02866284 0.02879445 0.02892611 0.02905781 [55] 0.02918955 0.02932133 0.02945315 0.02958500 0.02971689 0.02984881 [61] 0.02998075 0.03011273 0.03024473 0.03037675 0.03050880 0.03064086 [67] 0.03077295 0.03090504 0.03103716 0.03116928 0.03130141 0.03143356 [73] 0.03156570 0.03169785 0.03183001 0.03196216 0.03209431 0.03222645 [79] 0.03235859 0.03249072 0.03262284 0.03275495 0.03288704 0.03301911 [85] 0.03315117 0.03328320 0.03341522 0.03354720 0.03367916 0.03381109 [91] 0.03394299 0.03407486 0.03420668 0.03433848 0.03447023 0.03460194 [97] 0.03473360 0.03486522 0.03499679 0.03512831 0.03525978 0.03539119 [103] 0.03552255 0.03565384 0.03578508 0.03591625 0.03604736 0.03617840 [109] 0.03630937 0.03644026 0.03657109 0.03670183 0.03683250 0.03696309 [115] 0.03709360 0.03722402 0.03735435 0.03748460 0.03761475 0.03774481 [121] 0.03787477 0.03800464 0.03813441 0.03826407 0.03839363 0.03852309 [127] 0.03865243 0.03878167 0.03891079 0.03903980 0.03916869 0.03929746 [133] 0.03942611 0.03955464 0.03968304 0.03981131 0.03993946 0.04006747 [139] 0.04019534 0.04032308 0.04045069 0.04057815 0.04070547 0.04083264 [145] 0.04095967 0.04108655 0.04121328 0.04133985 0.04146627 0.04159253 [151] 0.04171863 0.04184457 0.04197035 0.04209596 0.04222141 0.04234668 [157] 0.04247178 0.04259671 0.04272146 0.04284603 0.04297042 0.04309463 [163] 0.04321866 0.04334250 0.04346615 0.04358961 0.04371288 0.04383596 [169] 0.04395884 0.04408152 0.04420399 0.04432627 0.04444834 0.04457021 [175] 0.04469187 0.04481332 0.04493455 0.04505557 0.04517638 0.04529697 [181] 0.04541733 0.04553748 0.04565740 0.04577710 0.04589656 0.04601580 [187] 0.04613481 0.04625358 0.04637212 0.04649043 0.04660849 0.04672631 [193] 0.04684389 0.04696123 0.04707832 0.04719516 0.04731176 0.04742810 [199] 0.04754419 0.04766002 0.04777560 0.04789091 0.04800597 0.04812077 [205] 0.04823530 0.04834957 0.04846357 0.04857730 0.04869076 0.04880395 [211] 0.04891686 0.04902950 0.04914187 0.04925395 0.04936575 0.04947728 [217] 0.04958851 0.04969947 0.04981013 0.04992051 0.05003060 0.05014040 [223] 0.05024990 0.05035912 0.05046803 0.05057665 0.05068497 0.05079299 [229] 0.05090070 0.05100812 0.05111523 0.05122203 0.05132852 0.05143471 [235] 0.05154059 0.05164615 0.05175140 0.05185634 0.05196097 0.05206527 [241] 0.05216926 0.05227292 0.05237627 0.05247930 0.05258200 0.05268437 [247] 0.05278642 0.05288815 0.05298954 0.05309061 0.05319134 0.05329174 [253] 0.05339181 0.05349155 0.05359095 0.05369001 0.05378874 0.05388712 [259] 0.05398517 0.05408288 0.05418024 0.05427726 0.05437394 0.05447027 [265] 0.05456626 0.05466190 0.05475719 0.05485213 0.05494672 0.05504096 [271] 0.05513485 0.05522839 0.05532157 0.05541440 0.05550687 0.05559898 [277] 0.05569074 0.05578214 0.05587318 0.05596386 0.05605419 0.05614415 [283] 0.05623374 0.05632298 0.05641185 0.05650036 0.05658850 0.05667627 [289] 0.05676368 0.05685073 0.05693740 0.05702371 0.05710964 0.05719521 [295] 0.05728041 0.05736523 0.05744969 0.05753377 0.05761748 0.05770081 [301] 0.05778377 0.05786636 0.05794857 0.05803041 0.05811187 0.05819296 [307] 0.05827366 0.05835399 0.05843395 0.05851352 0.05859272 0.05867153 [313] 0.05874997 0.05882803 0.05890570 0.05898300 0.05905992 0.05913645 [319] 0.05921260 0.05928838 0.05936376 0.05943877 0.05951339 0.05958763 [325] 0.05966149 0.05973497 0.05980806 0.05988076 0.05995309 0.06002502 [331] 0.06009658 0.06016775 0.06023853 0.06030893 0.06037894 0.06044857 [337] 0.06051782 0.06058667 0.06065515 0.06072323 0.06079093 0.06085825 [343] 0.06092518 0.06099173 0.06105788 0.06112366 0.06118904 0.06125404 [349] 0.06131866 0.06138289 0.06144673 0.06151019 0.06157326 0.06163595 [355] 0.06169825 0.06176017 0.06182170 0.06188285 0.06194361 0.06200399 [361] 0.06206398 0.06212358 0.06218281 0.06224165 0.06230010 0.06235817 [367] 0.06241586 0.06247316 0.06253008 0.06258662 0.06264278 0.06269855 [373] 0.06275394 0.06280895 0.06286357 0.06291782 0.06297168 0.06302516 [379] 0.06307827 0.06313099 0.06318333 0.06323530 0.06328688 0.06333809 [385] 0.06338891 0.06343936 0.06348943 0.06353913 0.06358844 0.06363738 [391] 0.06368595 0.06373414 0.06378195 0.06382939 0.06387645 0.06392314 [397] 0.06396946 0.06401540 0.06406097 0.06410617 0.06415100 > mx [1] 0.064151 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/172kp1229085318.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/20v5v1229085318.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/319oz1229085318.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/47njv1229085318.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/52qof1229085318.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/6w45u1229085318.tab") > > system("convert tmp/172kp1229085318.ps tmp/172kp1229085318.png") > system("convert tmp/20v5v1229085318.ps tmp/20v5v1229085318.png") > system("convert tmp/319oz1229085318.ps tmp/319oz1229085318.png") > system("convert tmp/47njv1229085318.ps tmp/47njv1229085318.png") > system("convert tmp/52qof1229085318.ps tmp/52qof1229085318.png") > > > proc.time() user system elapsed 2.409 1.332 2.637