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. > y <- c(9682.35,9762.12,10124.63,10540.05,10601.61,10323.73,10418.40,10092.96,10364.91,10152.09,10032.80,10204.59,10001.60,10411.75,10673.38,10539.51,10723.78,10682.06,10283.19,10377.18,10486.64,10545.38,10554.27,10532.54,10324.31,10695.25,10827.81,10872.48,10971.19,11145.65,11234.68,11333.88,10997.97,11036.89,11257.35,11533.59,11963.12,12185.15,12377.62,12512.89,12631.48,12268.53,12754.80,13407.75,13480.21,13673.28,13239.71,13557.69,13901.28,13200.58,13406.97,12538.12,12419.57,12193.88,12656.63,12812.48,12056.67,11322.38,11530.75,11114.08) > x <- c(29.08,28.76,29.59,30.70,30.52,32.67,33.19,37.13,35.54,37.75,41.84,42.94,49.14,44.61,40.22,44.23,45.85,53.38,53.26,51.80,55.30,57.81,63.96,63.77,59.15,56.12,57.42,63.52,61.71,63.01,68.18,72.03,69.75,74.41,74.33,64.24,60.03,59.44,62.50,55.04,58.34,61.92,67.65,67.68,70.30,75.26,71.44,76.36,81.71,92.60,90.60,92.23,94.09,102.79,109.65,124.05,132.69,135.81,116.07,101.42) > #'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.6265408 0.6269883 0.6274346 0.6278796 0.6283234 0.6287659 0.6292071 [8] 0.6296469 0.6300854 0.6305224 0.6309581 0.6313924 0.6318252 0.6322565 [15] 0.6326863 0.6331146 0.6335413 0.6339664 0.6343900 0.6348119 0.6352321 [22] 0.6356507 0.6360675 0.6364827 0.6368960 0.6373076 0.6377174 0.6381253 [29] 0.6385314 0.6389356 0.6393378 0.6397381 0.6401364 0.6405328 0.6409271 [36] 0.6413193 0.6417095 0.6420975 0.6424835 0.6428672 0.6432488 0.6436281 [43] 0.6440052 0.6443800 0.6447524 0.6451226 0.6454904 0.6458557 0.6462187 [50] 0.6465792 0.6469372 0.6472928 0.6476457 0.6479961 0.6483439 0.6486891 [57] 0.6490316 0.6493714 0.6497085 0.6500428 0.6503744 0.6507031 0.6510291 [64] 0.6513521 0.6516722 0.6519894 0.6523037 0.6526149 0.6529231 0.6532283 [71] 0.6535304 0.6538294 0.6541252 0.6544178 0.6547073 0.6549935 0.6552764 [78] 0.6555560 0.6558323 0.6561052 0.6563747 0.6566408 0.6569035 0.6571626 [85] 0.6574183 0.6576704 0.6579189 0.6581638 0.6584050 0.6586426 0.6588765 [92] 0.6591066 0.6593330 0.6595555 0.6597743 0.6599892 0.6602001 0.6604072 [99] 0.6606103 0.6608095 0.6610046 0.6611957 0.6613827 0.6615656 0.6617443 [106] 0.6619189 0.6620893 0.6622555 0.6624174 0.6625751 0.6627284 0.6628774 [113] 0.6630220 0.6631622 0.6632980 0.6634293 0.6635562 0.6636785 0.6637962 [120] 0.6639094 0.6640180 0.6641220 0.6642213 0.6643159 0.6644058 0.6644909 [127] 0.6645713 0.6646469 0.6647177 0.6647836 0.6648446 0.6649008 0.6649520 [134] 0.6649982 0.6650395 0.6650758 0.6651070 0.6651332 0.6651543 0.6651703 [141] 0.6651812 0.6651869 0.6651875 0.6651828 0.6651730 0.6651579 0.6651375 [148] 0.6651118 0.6650809 0.6650445 0.6650029 0.6649559 0.6649034 0.6648456 [155] 0.6647823 0.6647136 0.6646394 0.6645597 0.6644745 0.6643838 0.6642875 [162] 0.6641856 0.6640782 0.6639652 0.6638465 0.6637223 0.6635924 0.6634568 [169] 0.6633155 0.6631686 0.6630160 0.6628576 0.6626935 0.6625237 0.6623481 [176] 0.6621667 0.6619796 0.6617866 0.6615879 0.6613833 0.6611730 0.6609568 [183] 0.6607347 0.6605068 0.6602731 0.6600335 0.6597880 0.6595366 0.6592793 [190] 0.6590162 0.6587471 0.6584722 0.6581913 0.6579046 0.6576119 0.6573133 [197] 0.6570088 0.6566984 0.6563820 0.6560597 0.6557315 0.6553974 0.6550573 [204] 0.6547114 0.6543594 0.6540016 0.6536379 0.6532682 0.6528926 0.6525112 [211] 0.6521238 0.6517305 0.6513313 0.6509262 0.6505153 0.6500984 0.6496757 [218] 0.6492471 0.6488127 0.6483725 0.6479263 0.6474744 0.6470167 0.6465531 [225] 0.6460838 0.6456086 0.6451277 0.6446410 0.6441486 0.6436505 0.6431466 [232] 0.6426371 0.6421218 0.6416009 0.6410743 0.6405420 0.6400042 0.6394607 [239] 0.6389116 0.6383570 0.6377968 0.6372311 0.6366598 0.6360831 0.6355009 [246] 0.6349132 0.6343201 0.6337216 0.6331177 0.6325084 0.6318938 0.6312738 [253] 0.6306486 0.6300180 0.6293823 0.6287413 0.6280951 0.6274437 0.6267872 [260] 0.6261256 0.6254589 0.6247871 0.6241102 0.6234284 0.6227416 0.6220498 [267] 0.6213531 0.6206515 0.6199450 0.6192337 0.6185176 0.6177967 0.6170710 [274] 0.6163407 0.6156057 0.6148660 0.6141217 0.6133728 0.6126194 0.6118615 [281] 0.6110990 0.6103322 0.6095609 0.6087852 0.6080052 0.6072208 0.6064322 [288] 0.6056393 0.6048422 0.6040410 0.6032356 0.6024261 0.6016126 0.6007950 [295] 0.5999735 0.5991479 0.5983185 0.5974852 0.5966480 0.5958071 0.5949623 [302] 0.5941139 0.5932617 0.5924059 0.5915465 0.5906835 0.5898170 0.5889469 [309] 0.5880735 0.5871965 0.5863163 0.5854326 0.5845457 0.5836555 0.5827620 [316] 0.5818654 0.5809657 0.5800628 0.5791569 0.5782479 0.5773360 0.5764211 [323] 0.5755033 0.5745826 0.5736591 0.5727329 0.5718038 0.5708721 0.5699377 [330] 0.5690007 0.5680610 0.5671189 0.5661742 0.5652271 0.5642775 0.5633255 [337] 0.5623712 0.5614146 0.5604557 0.5594946 0.5585313 0.5575659 0.5565983 [344] 0.5556287 0.5546570 0.5536833 0.5527077 0.5517302 0.5507508 0.5497696 [351] 0.5487865 0.5478017 0.5468152 0.5458270 0.5448372 0.5438457 0.5428527 [358] 0.5418581 0.5408621 0.5398646 0.5388657 0.5378654 0.5368638 0.5358609 [365] 0.5348567 0.5338513 0.5328446 0.5318369 0.5308280 0.5298180 0.5288070 [372] 0.5277949 0.5267819 0.5257679 0.5247531 0.5237373 0.5227208 0.5217034 [379] 0.5206853 0.5196664 0.5186468 0.5176266 0.5166058 0.5155843 0.5145623 [386] 0.5135397 0.5125167 0.5114932 0.5104693 0.5094449 0.5084202 0.5073952 [393] 0.5063699 0.5053443 0.5043184 0.5032924 0.5022662 0.5012398 0.5002133 [400] 0.4991867 0.4981601 > mx [1] 0.6651875 > mxli [1] -0.58 > 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/1k10o1227125874.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/2uata1227125874.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/30rri1227125874.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/4to0x1227125874.tab") > > system("convert tmp/1k10o1227125874.ps tmp/1k10o1227125874.png") > system("convert tmp/2uata1227125874.ps tmp/2uata1227125874.png") > system("convert tmp/30rri1227125874.ps tmp/30rri1227125874.png") > > > proc.time() user system elapsed 0.774 0.481 0.926