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. > y <- c(14271,14013,15912,14290,14744,14721,13918,13263,15660,15629,15113,14526,15132,14908,16167,14122,13985,14236,13921,12394,15454,16146,15107,14593,14695,14513,17071,15179,15460,17173,15938,15003,18216,17847,18029,17281,16706,16750,18912,17763,16736,18061,16713,16769,19514,19251,19951,19052,19555,19083,22534,18854,19801,20346,18169,19087,20842,21602,22360,20334,21215,20530,23152,20134,21193,21628,20823,20493,22106,24178,24958,21620) > x <- c(9356,9337,10149,9788,9770,9911,9429,8775,10189,10529,9914,9790,9625,9729,10589,9611,9388,9510,9690,8434,9844,10601,9942,10229,9381,9635,11228,9999,10089,11622,10533,9965,11567,11321,11686,11747,10595,10751,12199,11690,10978,11753,10839,10518,12183,11967,12363,12359,12162,12096,14325,12670,13865,13563,12734,12464,13389,13961,14088,13143,13413,13579,15388,13708,14689,14883,13991,13854,14364,15672,15904,14016) > #'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(x1,y) + if (mx < abs(c[i])) + { + mx <- abs(c[i]) + mxli <- l[i] + } + } > c [1] 0.9676833 0.9678083 0.9679328 0.9680568 0.9681803 0.9683034 0.9684259 [8] 0.9685479 0.9686695 0.9687905 0.9689111 0.9690311 0.9691507 0.9692698 [15] 0.9693884 0.9695064 0.9696240 0.9697411 0.9698577 0.9699738 0.9700894 [22] 0.9702045 0.9703191 0.9704333 0.9705469 0.9706600 0.9707726 0.9708847 [29] 0.9709964 0.9711075 0.9712181 0.9713282 0.9714379 0.9715470 0.9716556 [36] 0.9717637 0.9718714 0.9719785 0.9720851 0.9721912 0.9722969 0.9724020 [43] 0.9725066 0.9726107 0.9727143 0.9728175 0.9729201 0.9730222 0.9731238 [50] 0.9732249 0.9733255 0.9734256 0.9735252 0.9736242 0.9737228 0.9738209 [57] 0.9739185 0.9740155 0.9741121 0.9742081 0.9743037 0.9743987 0.9744933 [64] 0.9745873 0.9746808 0.9747738 0.9748663 0.9749583 0.9750498 0.9751408 [71] 0.9752313 0.9753212 0.9754107 0.9754997 0.9755881 0.9756760 0.9757635 [78] 0.9758504 0.9759368 0.9760227 0.9761081 0.9761929 0.9762773 0.9763611 [85] 0.9764445 0.9765273 0.9766096 0.9766915 0.9767728 0.9768535 0.9769338 [92] 0.9770136 0.9770928 0.9771716 0.9772498 0.9773275 0.9774047 0.9774814 [99] 0.9775575 0.9776332 0.9777084 0.9777830 0.9778571 0.9779307 0.9780038 [106] 0.9780764 0.9781484 0.9782200 0.9782910 0.9783615 0.9784315 0.9785010 [113] 0.9785700 0.9786384 0.9787063 0.9787738 0.9788407 0.9789070 0.9789729 [120] 0.9790383 0.9791031 0.9791674 0.9792312 0.9792945 0.9793573 0.9794195 [127] 0.9794813 0.9795425 0.9796032 0.9796633 0.9797230 0.9797821 0.9798408 [134] 0.9798989 0.9799565 0.9800135 0.9800701 0.9801261 0.9801816 0.9802366 [141] 0.9802911 0.9803450 0.9803984 0.9804514 0.9805037 0.9805556 0.9806070 [148] 0.9806578 0.9807081 0.9807579 0.9808072 0.9808559 0.9809041 0.9809518 [155] 0.9809990 0.9810457 0.9810918 0.9811375 0.9811826 0.9812271 0.9812712 [162] 0.9813147 0.9813577 0.9814002 0.9814422 0.9814836 0.9815246 0.9815650 [169] 0.9816049 0.9816442 0.9816830 0.9817214 0.9817591 0.9817964 0.9818332 [176] 0.9818694 0.9819051 0.9819403 0.9819749 0.9820090 0.9820427 0.9820757 [183] 0.9821083 0.9821403 0.9821718 0.9822028 0.9822333 0.9822633 0.9822927 [190] 0.9823216 0.9823499 0.9823778 0.9824051 0.9824319 0.9824582 0.9824840 [197] 0.9825092 0.9825339 0.9825581 0.9825817 0.9826049 0.9826275 0.9826496 [204] 0.9826711 0.9826922 0.9827127 0.9827327 0.9827522 0.9827711 0.9827895 [211] 0.9828074 0.9828248 0.9828416 0.9828580 0.9828738 0.9828890 0.9829038 [218] 0.9829180 0.9829317 0.9829449 0.9829575 0.9829697 0.9829813 0.9829924 [225] 0.9830029 0.9830130 0.9830225 0.9830315 0.9830399 0.9830479 0.9830553 [232] 0.9830622 0.9830685 0.9830744 0.9830797 0.9830845 0.9830888 0.9830925 [239] 0.9830957 0.9830984 0.9831006 0.9831023 0.9831034 0.9831040 0.9831041 [246] 0.9831036 0.9831027 0.9831012 0.9830992 0.9830966 0.9830936 0.9830900 [253] 0.9830859 0.9830813 0.9830761 0.9830705 0.9830643 0.9830575 0.9830503 [260] 0.9830425 0.9830343 0.9830255 0.9830161 0.9830063 0.9829959 0.9829850 [267] 0.9829736 0.9829617 0.9829492 0.9829362 0.9829227 0.9829087 0.9828942 [274] 0.9828791 0.9828635 0.9828474 0.9828308 0.9828136 0.9827960 0.9827778 [281] 0.9827591 0.9827398 0.9827201 0.9826998 0.9826790 0.9826577 0.9826359 [288] 0.9826135 0.9825907 0.9825673 0.9825434 0.9825189 0.9824940 0.9824685 [295] 0.9824426 0.9824161 0.9823890 0.9823615 0.9823335 0.9823049 0.9822758 [302] 0.9822462 0.9822161 0.9821854 0.9821543 0.9821226 0.9820904 0.9820577 [309] 0.9820245 0.9819907 0.9819565 0.9819217 0.9818864 0.9818506 0.9818143 [316] 0.9817775 0.9817401 0.9817023 0.9816639 0.9816250 0.9815856 0.9815457 [323] 0.9815053 0.9814643 0.9814229 0.9813809 0.9813384 0.9812954 0.9812519 [330] 0.9812079 0.9811634 0.9811183 0.9810728 0.9810267 0.9809801 0.9809330 [337] 0.9808855 0.9808373 0.9807887 0.9807396 0.9806900 0.9806398 0.9805892 [344] 0.9805380 0.9804863 0.9804341 0.9803815 0.9803283 0.9802746 0.9802203 [351] 0.9801656 0.9801104 0.9800547 0.9799984 0.9799417 0.9798844 0.9798267 [358] 0.9797684 0.9797097 0.9796504 0.9795906 0.9795303 0.9794696 0.9794083 [365] 0.9793465 0.9792842 0.9792214 0.9791581 0.9790943 0.9790300 0.9789652 [372] 0.9788999 0.9788341 0.9787678 0.9787010 0.9786337 0.9785659 0.9784976 [379] 0.9784288 0.9783595 0.9782897 0.9782194 0.9781486 0.9780773 0.9780055 [386] 0.9779332 0.9778604 0.9777872 0.9777134 0.9776391 0.9775643 0.9774891 [393] 0.9774133 0.9773371 0.9772603 0.9771831 0.9771054 0.9770272 0.9769485 [400] 0.9768693 0.9767896 > mx [1] 0.983104 > mxli [1] 0.44 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > r<-lm(y~x) > se <- sqrt(var(r$residuals)) > r1 <- lm(y~x1) > se1 <- sqrt(var(r1$residuals)) > postscript(file="/var/www/html/rcomp/tmp/13o6v1257281763.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(l,c,main='Box-Cox Linearity Plot',xlab='Lambda',ylab='correlation') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/28wta1257281763.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,y,main='Linear Fit of Original Data',xlab='x',ylab='y') > abline(r) > grid() > mtext(paste('Residual Standard Deviation = ',se)) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3nh661257281763.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x1,y,main='Linear Fit of Transformed Data',xlab='x',ylab='y') > abline(r1) > grid() > mtext(paste('Residual Standard Deviation = ',se1)) > 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 Linearity 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(x)',header=TRUE) > a<-table.element(a,mxli) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Residual SD (orginial)',header=TRUE) > a<-table.element(a,se) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Residual SD (transformed)',header=TRUE) > a<-table.element(a,se1) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/4l3ep1257281763.tab") > > system("convert tmp/13o6v1257281763.ps tmp/13o6v1257281763.png") > system("convert tmp/28wta1257281763.ps tmp/28wta1257281763.png") > system("convert tmp/3nh661257281763.ps tmp/3nh661257281763.png") > > > proc.time() user system elapsed 0.783 0.508 1.237