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(95.1,95.9,95.9,96.9,95.7,97.8,95.9,98.2,101.2,106.8,108.2,108.2,113.2,115.2,122,119.8,119.8,112.7,113.8,118.6,119.2,118.1,121.6,125.3,126.5,133.6,136.5,131.9,131.9,139.3,139.9,140.1,142.1,141.8,143.5,143.6,140.6,137.4,133.9,134.6,134.6,132.1,132.5,134.1,135.1,136.4,136.6,138.1,138.4,141,144.9,153.4,156.5,160.7,163.9,166.7,169.7,174.3,181.8,187.8,182.4) > #'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.9359982 0.9361783 0.9363579 0.9365369 0.9367154 0.9368933 0.9370706 [8] 0.9372473 0.9374235 0.9375991 0.9377741 0.9379485 0.9381224 0.9382956 [15] 0.9384683 0.9386403 0.9388117 0.9389826 0.9391528 0.9393224 0.9394915 [22] 0.9396599 0.9398276 0.9399948 0.9401613 0.9403272 0.9404925 0.9406571 [29] 0.9408211 0.9409845 0.9411472 0.9413093 0.9414707 0.9416315 0.9417916 [36] 0.9419511 0.9421099 0.9422680 0.9424255 0.9425823 0.9427385 0.9428939 [43] 0.9430487 0.9432028 0.9433562 0.9435089 0.9436610 0.9438123 0.9439630 [50] 0.9441129 0.9442622 0.9444107 0.9445586 0.9447057 0.9448521 0.9449978 [57] 0.9451428 0.9452870 0.9454306 0.9455734 0.9457154 0.9458568 0.9459974 [64] 0.9461372 0.9462764 0.9464147 0.9465523 0.9466892 0.9468253 0.9469607 [71] 0.9470953 0.9472291 0.9473622 0.9474945 0.9476261 0.9477568 0.9478868 [78] 0.9480160 0.9481444 0.9482720 0.9483989 0.9485249 0.9486502 0.9487747 [85] 0.9488983 0.9490212 0.9491432 0.9492645 0.9493849 0.9495045 0.9496233 [92] 0.9497413 0.9498585 0.9499748 0.9500903 0.9502050 0.9503188 0.9504319 [99] 0.9505440 0.9506554 0.9507658 0.9508755 0.9509843 0.9510922 0.9511993 [106] 0.9513055 0.9514109 0.9515154 0.9516190 0.9517218 0.9518236 0.9519247 [113] 0.9520248 0.9521241 0.9522225 0.9523200 0.9524166 0.9525123 0.9526071 [120] 0.9527011 0.9527941 0.9528862 0.9529775 0.9530678 0.9531572 0.9532458 [127] 0.9533334 0.9534200 0.9535058 0.9535907 0.9536746 0.9537576 0.9538397 [134] 0.9539208 0.9540010 0.9540803 0.9541587 0.9542361 0.9543126 0.9543881 [141] 0.9544626 0.9545363 0.9546090 0.9546807 0.9547514 0.9548213 0.9548901 [148] 0.9549580 0.9550249 0.9550909 0.9551559 0.9552199 0.9552829 0.9553450 [155] 0.9554061 0.9554662 0.9555253 0.9555834 0.9556406 0.9556968 0.9557519 [162] 0.9558061 0.9558593 0.9559115 0.9559627 0.9560129 0.9560621 0.9561102 [169] 0.9561574 0.9562036 0.9562487 0.9562929 0.9563360 0.9563781 0.9564192 [176] 0.9564592 0.9564983 0.9565363 0.9565733 0.9566093 0.9566442 0.9566781 [183] 0.9567110 0.9567428 0.9567736 0.9568033 0.9568321 0.9568597 0.9568864 [190] 0.9569119 0.9569365 0.9569600 0.9569824 0.9570038 0.9570241 0.9570434 [197] 0.9570616 0.9570787 0.9570948 0.9571098 0.9571238 0.9571367 0.9571485 [204] 0.9571593 0.9571690 0.9571776 0.9571852 0.9571917 0.9571971 0.9572014 [211] 0.9572046 0.9572068 0.9572079 0.9572079 0.9572068 0.9572047 0.9572014 [218] 0.9571971 0.9571917 0.9571852 0.9571776 0.9571689 0.9571591 0.9571482 [225] 0.9571362 0.9571232 0.9571090 0.9570937 0.9570774 0.9570599 0.9570413 [232] 0.9570217 0.9570009 0.9569790 0.9569560 0.9569319 0.9569068 0.9568805 [239] 0.9568530 0.9568245 0.9567949 0.9567642 0.9567323 0.9566994 0.9566653 [246] 0.9566301 0.9565938 0.9565564 0.9565178 0.9564782 0.9564374 0.9563955 [253] 0.9563525 0.9563084 0.9562632 0.9562168 0.9561693 0.9561207 0.9560710 [260] 0.9560202 0.9559682 0.9559151 0.9558609 0.9558056 0.9557491 0.9556916 [267] 0.9556329 0.9555730 0.9555121 0.9554500 0.9553868 0.9553225 0.9552570 [274] 0.9551905 0.9551228 0.9550539 0.9549840 0.9549129 0.9548407 0.9547674 [281] 0.9546929 0.9546174 0.9545407 0.9544628 0.9543839 0.9543038 0.9542226 [288] 0.9541403 0.9540568 0.9539723 0.9538866 0.9537997 0.9537118 0.9536227 [295] 0.9535325 0.9534412 0.9533488 0.9532552 0.9531605 0.9530647 0.9529678 [302] 0.9528697 0.9527706 0.9526703 0.9525689 0.9524664 0.9523627 0.9522579 [309] 0.9521521 0.9520451 0.9519370 0.9518277 0.9517174 0.9516060 0.9514934 [316] 0.9513797 0.9512649 0.9511490 0.9510320 0.9509139 0.9507947 0.9506743 [323] 0.9505529 0.9504303 0.9503067 0.9501819 0.9500561 0.9499291 0.9498011 [330] 0.9496719 0.9495416 0.9494103 0.9492778 0.9491443 0.9490096 0.9488739 [337] 0.9487371 0.9485991 0.9484601 0.9483200 0.9481788 0.9480366 0.9478932 [344] 0.9477488 0.9476032 0.9474566 0.9473089 0.9471602 0.9470103 0.9468594 [351] 0.9467074 0.9465544 0.9464002 0.9462450 0.9460887 0.9459314 0.9457730 [358] 0.9456135 0.9454530 0.9452914 0.9451287 0.9449650 0.9448003 0.9446344 [365] 0.9444676 0.9442996 0.9441307 0.9439607 0.9437896 0.9436175 0.9434443 [372] 0.9432701 0.9430949 0.9429186 0.9427413 0.9425630 0.9423836 0.9422033 [379] 0.9420218 0.9418394 0.9416559 0.9414714 0.9412859 0.9410994 0.9409119 [386] 0.9407233 0.9405337 0.9403432 0.9401516 0.9399590 0.9397654 0.9395708 [393] 0.9393752 0.9391786 0.9389811 0.9387825 0.9385829 0.9383824 0.9381809 [400] 0.9379783 0.9377748 > mx [1] 0.957208 > mxli [1] 0.13 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1465u1229870651.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/2otal1229870651.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/3rz5i1229870651.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/4fuwu1229870651.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/5wa2d1229870651.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/6j8n31229870651.tab") > > system("convert tmp/1465u1229870651.ps tmp/1465u1229870651.png") > system("convert tmp/2otal1229870651.ps tmp/2otal1229870651.png") > system("convert tmp/3rz5i1229870651.ps tmp/3rz5i1229870651.png") > system("convert tmp/4fuwu1229870651.ps tmp/4fuwu1229870651.png") > system("convert tmp/5wa2d1229870651.ps tmp/5wa2d1229870651.png") > > > proc.time() user system elapsed 1.101 0.783 1.628