R version 2.7.2 (2008-08-25) 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(308347,298427,289231,291975,294912,293488,290555,284736,281818,287854,316263,325412,326011,328282,317480,317539,313737,312276,309391,302950,300316,304035,333476,337698,335932,323931,313927,314485,313218,309664,302963,298989,298423,301631,329765,335083,327616,309119,295916,291413,291542,284678,276475,272566,264981,263290,296806,303598,286994,276427,266424,267153,268381,262522,255542,253158,243803,250741,280445,285257,270976) > x <- c(577992,565464,547344,554788,562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141,593408,590072,579799,574205,572775,572942,619567,625809,619916,587625,565742,557274,560576,548854,531673,525919,511038,498662,555362,564591,541657,527070,509846,514258,516922,507561,492622,490243,469357,477580,528379,533590,517945) > #'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.9840385 0.9840960 0.9841618 0.9842208 0.9842794 0.9843401 0.9843941 [8] 0.9844532 0.9845160 0.9845743 0.9846329 0.9846904 0.9847494 0.9848069 [15] 0.9848656 0.9849231 0.9849805 0.9850383 0.9850953 0.9851530 0.9852097 [22] 0.9852660 0.9853225 0.9853791 0.9854353 0.9854913 0.9855472 0.9856029 [29] 0.9856584 0.9857139 0.9857691 0.9858240 0.9858789 0.9859335 0.9859880 [36] 0.9860423 0.9860964 0.9861504 0.9862042 0.9862578 0.9863112 0.9863645 [43] 0.9864176 0.9864705 0.9865232 0.9865758 0.9866282 0.9866804 0.9867325 [50] 0.9867843 0.9868360 0.9868876 0.9869389 0.9869901 0.9870411 0.9870919 [57] 0.9871426 0.9871930 0.9872433 0.9872935 0.9873434 0.9873932 0.9874428 [64] 0.9874922 0.9875415 0.9875906 0.9876395 0.9876882 0.9877368 0.9877852 [71] 0.9878334 0.9878814 0.9879293 0.9879769 0.9880245 0.9880718 0.9881190 [78] 0.9881660 0.9882128 0.9882594 0.9883059 0.9883522 0.9883983 0.9884442 [85] 0.9884900 0.9885356 0.9885810 0.9886263 0.9886714 0.9887163 0.9887610 [92] 0.9888056 0.9888499 0.9888941 0.9889382 0.9889820 0.9890257 0.9890692 [99] 0.9891126 0.9891557 0.9891987 0.9892415 0.9892842 0.9893266 0.9893689 [106] 0.9894110 0.9894530 0.9894948 0.9895363 0.9895778 0.9896190 0.9896601 [113] 0.9897010 0.9897417 0.9897823 0.9898227 0.9898629 0.9899029 0.9899428 [120] 0.9899824 0.9900220 0.9900613 0.9901005 0.9901395 0.9901783 0.9902169 [127] 0.9902554 0.9902937 0.9903318 0.9903698 0.9904075 0.9904451 0.9904826 [134] 0.9905198 0.9905569 0.9905938 0.9906306 0.9906671 0.9907035 0.9907397 [141] 0.9907758 0.9908117 0.9908474 0.9908829 0.9909182 0.9909534 0.9909884 [148] 0.9910233 0.9910579 0.9910924 0.9911267 0.9911609 0.9911948 0.9912286 [155] 0.9912623 0.9912957 0.9913290 0.9913621 0.9913950 0.9914278 0.9914604 [162] 0.9914928 0.9915250 0.9915571 0.9915890 0.9916207 0.9916523 0.9916837 [169] 0.9917149 0.9917459 0.9917768 0.9918075 0.9918380 0.9918684 0.9918985 [176] 0.9919285 0.9919584 0.9919880 0.9920175 0.9920469 0.9920760 0.9921050 [183] 0.9921338 0.9921624 0.9921909 0.9922192 0.9922473 0.9922752 0.9923030 [190] 0.9923306 0.9923580 0.9923853 0.9924124 0.9924393 0.9924660 0.9924926 [197] 0.9925190 0.9925453 0.9925713 0.9925972 0.9926229 0.9926485 0.9926739 [204] 0.9926991 0.9927241 0.9927490 0.9927737 0.9927982 0.9928226 0.9928467 [211] 0.9928708 0.9928946 0.9929183 0.9929418 0.9929651 0.9929883 0.9930113 [218] 0.9930341 0.9930567 0.9930792 0.9931015 0.9931237 0.9931456 0.9931675 [225] 0.9931891 0.9932105 0.9932318 0.9932530 0.9932739 0.9932947 0.9933153 [232] 0.9933358 0.9933560 0.9933762 0.9933961 0.9934159 0.9934355 0.9934549 [239] 0.9934742 0.9934933 0.9935122 0.9935309 0.9935495 0.9935679 0.9935862 [246] 0.9936043 0.9936222 0.9936399 0.9936575 0.9936749 0.9936922 0.9937092 [253] 0.9937261 0.9937429 0.9937594 0.9937758 0.9937921 0.9938081 0.9938240 [260] 0.9938398 0.9938553 0.9938707 0.9938860 0.9939010 0.9939159 0.9939306 [267] 0.9939452 0.9939596 0.9939738 0.9939879 0.9940017 0.9940155 0.9940290 [274] 0.9940424 0.9940556 0.9940687 0.9940816 0.9940943 0.9941069 0.9941192 [281] 0.9941315 0.9941435 0.9941554 0.9941671 0.9941787 0.9941901 0.9942013 [288] 0.9942124 0.9942233 0.9942340 0.9942446 0.9942550 0.9942652 0.9942753 [295] 0.9942852 0.9942949 0.9943045 0.9943139 0.9943231 0.9943322 0.9943411 [302] 0.9943499 0.9943584 0.9943669 0.9943751 0.9943832 0.9943911 0.9943989 [309] 0.9944065 0.9944139 0.9944212 0.9944283 0.9944352 0.9944420 0.9944486 [316] 0.9944551 0.9944614 0.9944675 0.9944734 0.9944792 0.9944849 0.9944903 [323] 0.9944956 0.9945008 0.9945057 0.9945106 0.9945152 0.9945197 0.9945240 [330] 0.9945282 0.9945322 0.9945360 0.9945397 0.9945432 0.9945466 0.9945498 [337] 0.9945528 0.9945557 0.9945584 0.9945609 0.9945633 0.9945655 0.9945676 [344] 0.9945695 0.9945712 0.9945728 0.9945742 0.9945754 0.9945765 0.9945775 [351] 0.9945782 0.9945788 0.9945793 0.9945796 0.9945797 0.9945797 0.9945795 [358] 0.9945791 0.9945786 0.9945779 0.9945771 0.9945761 0.9945750 0.9945736 [365] 0.9945722 0.9945705 0.9945687 0.9945668 0.9945647 0.9945624 0.9945600 [372] 0.9945574 0.9945547 0.9945517 0.9945487 0.9945455 0.9945421 0.9945385 [379] 0.9945348 0.9945310 0.9945270 0.9945228 0.9945185 0.9945140 0.9945093 [386] 0.9945045 0.9944996 0.9944945 0.9944892 0.9944837 0.9944782 0.9944724 [393] 0.9944665 0.9944604 0.9944542 0.9944478 0.9944413 0.9944346 0.9944278 [400] 0.9944208 0.9944136 > mx [1] 0.9945797 > mxli [1] 1.54 > 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/1ky8x1226438178.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/24pdj1226438178.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/3gqzc1226438178.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/4s7n41226438178.tab") > > system("convert tmp/1ky8x1226438178.ps tmp/1ky8x1226438178.png") > system("convert tmp/24pdj1226438178.ps tmp/24pdj1226438178.png") > system("convert tmp/3gqzc1226438178.ps tmp/3gqzc1226438178.png") > > > proc.time() user system elapsed 1.049 0.527 1.315