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(10205.29,10295.98,10892.76,10631.92,11441.08,11950.95,11037.54,11527.72,11383.89,10989.34,11079.42,11028.93,10973,11068.05,11394.84,11545.71,11809.38,11395.64,11082.38,11402.75,11716.87,12204.98,12986.62,13392.79,14368.05,15650.83,16102.64,16187.64,16311.54,17232.97,16397.83,14990.31,15147.55,15786.78,15934.09,16519.44,16101.07,16775.08,17286.32,17741.23,17128.37,17460.53,17611.14,18001.37,17974.77,16460.95,16235.39,16903.36,15543.76,15532.18,13731.31,13547.84,12602.93,13357.7,13995.33,14084.6,13168.91,12989.35,12123.53,9117.03) > x <- c(10205.29,10295.98,10892.76,10631.92,11441.08,11950.95,11037.54,11527.72,11383.89,10989.34,11079.42,11028.93,10973,11068.05,11394.84,11545.71,11809.38,11395.64,11082.38,11402.75,11716.87,12204.98,12986.62,13392.79,14368.05,15650.83,16102.64,16187.64,16311.54,17232.97,16397.83,14990.31,15147.55,15786.78,15934.09,16519.44,16101.07,16775.08,17286.32,17741.23,17128.37,17460.53,17611.14,18001.37,17974.77,16460.95,16235.39,16903.36,15543.76,15532.18,13731.31,13547.84,12602.93,13357.7,13995.33,14084.6,13168.91,12989.35,12123.53,9117.03) > #'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.9736934 0.9738816 0.9740691 0.9742558 0.9744418 0.9746270 0.9748114 [8] 0.9749951 0.9751781 0.9753602 0.9755417 0.9757224 0.9759023 0.9760815 [15] 0.9762600 0.9764377 0.9766147 0.9767909 0.9769663 0.9771411 0.9773151 [22] 0.9774883 0.9776608 0.9778326 0.9780036 0.9781739 0.9783434 0.9785123 [29] 0.9786803 0.9788477 0.9790143 0.9791802 0.9793453 0.9795097 0.9796734 [36] 0.9798363 0.9799985 0.9801600 0.9803208 0.9804808 0.9806401 0.9807987 [43] 0.9809566 0.9811137 0.9812701 0.9814258 0.9815808 0.9817350 0.9818885 [50] 0.9820413 0.9821934 0.9823448 0.9824954 0.9826454 0.9827946 0.9829431 [57] 0.9830909 0.9832380 0.9833844 0.9835300 0.9836750 0.9838192 0.9839627 [64] 0.9841056 0.9842477 0.9843891 0.9845298 0.9846698 0.9848091 0.9849477 [71] 0.9850856 0.9852228 0.9853593 0.9854951 0.9856302 0.9857646 0.9858983 [78] 0.9860313 0.9861637 0.9862953 0.9864262 0.9865565 0.9866860 0.9868149 [85] 0.9869430 0.9870705 0.9871973 0.9873234 0.9874488 0.9875736 0.9876976 [92] 0.9878210 0.9879437 0.9880657 0.9881870 0.9883077 0.9884276 0.9885469 [99] 0.9886655 0.9887835 0.9889007 0.9890173 0.9891333 0.9892485 0.9893631 [106] 0.9894770 0.9895902 0.9897028 0.9898147 0.9899259 0.9900364 0.9901463 [113] 0.9902556 0.9903641 0.9904720 0.9905793 0.9906859 0.9907918 0.9908971 [120] 0.9910017 0.9911056 0.9912089 0.9913115 0.9914135 0.9915148 0.9916155 [127] 0.9917155 0.9918149 0.9919136 0.9920117 0.9921091 0.9922059 0.9923021 [134] 0.9923975 0.9924924 0.9925866 0.9926801 0.9927730 0.9928653 0.9929570 [141] 0.9930479 0.9931383 0.9932280 0.9933171 0.9934055 0.9934934 0.9935805 [148] 0.9936671 0.9937530 0.9938383 0.9939229 0.9940069 0.9940903 0.9941731 [155] 0.9942552 0.9943368 0.9944177 0.9944979 0.9945776 0.9946566 0.9947350 [162] 0.9948128 0.9948899 0.9949665 0.9950424 0.9951177 0.9951924 0.9952665 [169] 0.9953399 0.9954128 0.9954850 0.9955567 0.9956277 0.9956981 0.9957679 [176] 0.9958371 0.9959057 0.9959736 0.9960410 0.9961078 0.9961740 0.9962395 [183] 0.9963045 0.9963689 0.9964326 0.9964958 0.9965584 0.9966203 0.9966817 [190] 0.9967425 0.9968027 0.9968623 0.9969213 0.9969797 0.9970375 0.9970948 [197] 0.9971514 0.9972075 0.9972629 0.9973178 0.9973721 0.9974258 0.9974790 [204] 0.9975315 0.9975835 0.9976349 0.9976857 0.9977359 0.9977856 0.9978347 [211] 0.9978831 0.9979311 0.9979784 0.9980252 0.9980714 0.9981170 0.9981621 [218] 0.9982066 0.9982505 0.9982939 0.9983367 0.9983789 0.9984205 0.9984616 [225] 0.9985022 0.9985421 0.9985815 0.9986204 0.9986587 0.9986964 0.9987336 [232] 0.9987702 0.9988062 0.9988417 0.9988767 0.9989110 0.9989449 0.9989782 [239] 0.9990109 0.9990431 0.9990747 0.9991058 0.9991363 0.9991663 0.9991958 [246] 0.9992247 0.9992530 0.9992808 0.9993081 0.9993348 0.9993610 0.9993866 [253] 0.9994118 0.9994363 0.9994604 0.9994839 0.9995068 0.9995292 0.9995511 [260] 0.9995725 0.9995933 0.9996136 0.9996334 0.9996526 0.9996713 0.9996895 [267] 0.9997072 0.9997243 0.9997409 0.9997570 0.9997725 0.9997875 0.9998021 [274] 0.9998160 0.9998295 0.9998425 0.9998549 0.9998668 0.9998782 0.9998891 [281] 0.9998995 0.9999093 0.9999187 0.9999275 0.9999358 0.9999436 0.9999509 [288] 0.9999577 0.9999640 0.9999697 0.9999750 0.9999798 0.9999840 0.9999878 [295] 0.9999910 0.9999938 0.9999960 0.9999978 0.9999990 0.9999998 1.0000000 [302] 0.9999998 0.9999990 0.9999978 0.9999960 0.9999938 0.9999911 0.9999879 [309] 0.9999842 0.9999800 0.9999753 0.9999701 0.9999644 0.9999583 0.9999517 [316] 0.9999445 0.9999369 0.9999289 0.9999203 0.9999112 0.9999017 0.9998917 [323] 0.9998812 0.9998702 0.9998588 0.9998468 0.9998344 0.9998215 0.9998082 [330] 0.9997944 0.9997800 0.9997653 0.9997500 0.9997343 0.9997181 0.9997015 [337] 0.9996843 0.9996667 0.9996487 0.9996302 0.9996112 0.9995917 0.9995718 [344] 0.9995514 0.9995306 0.9995093 0.9994875 0.9994653 0.9994426 0.9994195 [351] 0.9993959 0.9993718 0.9993473 0.9993224 0.9992969 0.9992711 0.9992448 [358] 0.9992180 0.9991908 0.9991631 0.9991350 0.9991064 0.9990774 0.9990479 [365] 0.9990180 0.9989877 0.9989569 0.9989256 0.9988939 0.9988618 0.9988292 [372] 0.9987962 0.9987628 0.9987289 0.9986946 0.9986598 0.9986246 0.9985890 [379] 0.9985529 0.9985164 0.9984795 0.9984421 0.9984043 0.9983661 0.9983274 [386] 0.9982884 0.9982488 0.9982089 0.9981685 0.9981277 0.9980865 0.9980448 [393] 0.9980028 0.9979603 0.9979174 0.9978740 0.9978303 0.9977861 0.9977415 [400] 0.9976965 0.9976510 > mx [1] 1 > mxli [1] 1 > 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/11qte1226563609.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/2ti5q1226563609.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/3a8ee1226563609.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/4906d1226563609.tab") > > system("convert tmp/11qte1226563609.ps tmp/11qte1226563609.png") > system("convert tmp/2ti5q1226563609.ps tmp/2ti5q1226563609.png") > system("convert tmp/3a8ee1226563609.ps tmp/3a8ee1226563609.png") > > > proc.time() user system elapsed 1.059 0.517 1.259