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(100.00,99.97,101.03,101.00,101.30,101.43,101.49,102.14,102.58,102.34,102.07,101.83,102.14,102.58,102.63,102.74,103.32,103.27,102.48,102.14,102.07,101.69,101.15,100.90,101.77,101.93,102.27,102.49,102.80,102.82,102.83,102.89,102.87,102.67,102.96,103.22,103.53,104.63,104.63,104.17,103.93,104.01,104.16,105.22,105.85,106.21,105.77,105.63,106.49,107.51,110.43,111.42,111.58,111.34,111.08,111.66,112.36,112.31,111.52,110.87,111.13,112.71,113.25,113.09,112.55,112.87,113.59,115.14,116.38,116.50,116.25,116.73) > x <- c(100.00,99.95,102.07,102.02,102.63,102.88,103.01,104.33,105.21,104.73,104.17,103.69,104.33,105.21,105.31,105.54,106.70,106.60,105.01,104.33,104.17,103.42,102.33,101.82,103.57,103.90,104.58,105.03,105.67,105.69,105.72,105.84,105.79,105.39,105.97,106.50,107.13,109.36,109.36,108.42,107.94,108.10,108.40,110.55,111.81,112.55,111.66,111.38,113.10,115.18,121.07,123.07,123.40,122.92,122.39,123.55,124.97,124.87,123.27,121.96,122.49,125.68,126.76,126.44,125.35,126.01,127.45,130.58,133.09,133.34,132.84,133.80) > #'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.9957653 0.9957931 0.9958208 0.9958484 0.9958759 0.9959034 0.9959307 [8] 0.9959580 0.9959851 0.9960122 0.9960392 0.9960661 0.9960929 0.9961196 [15] 0.9961463 0.9961728 0.9961992 0.9962256 0.9962519 0.9962781 0.9963042 [22] 0.9963302 0.9963561 0.9963819 0.9964077 0.9964333 0.9964589 0.9964843 [29] 0.9965097 0.9965350 0.9965602 0.9965853 0.9966104 0.9966353 0.9966601 [36] 0.9966849 0.9967096 0.9967341 0.9967586 0.9967830 0.9968073 0.9968316 [43] 0.9968557 0.9968797 0.9969037 0.9969275 0.9969513 0.9969750 0.9969986 [50] 0.9970221 0.9970455 0.9970688 0.9970920 0.9971152 0.9971382 0.9971612 [57] 0.9971840 0.9972068 0.9972295 0.9972521 0.9972746 0.9972970 0.9973194 [64] 0.9973416 0.9973637 0.9973858 0.9974078 0.9974296 0.9974514 0.9974731 [71] 0.9974947 0.9975162 0.9975376 0.9975590 0.9975802 0.9976014 0.9976224 [78] 0.9976434 0.9976643 0.9976851 0.9977058 0.9977264 0.9977469 0.9977673 [85] 0.9977876 0.9978079 0.9978280 0.9978481 0.9978680 0.9978879 0.9979077 [92] 0.9979274 0.9979470 0.9979665 0.9979859 0.9980053 0.9980245 0.9980437 [99] 0.9980627 0.9980817 0.9981005 0.9981193 0.9981380 0.9981566 0.9981751 [106] 0.9981935 0.9982119 0.9982301 0.9982482 0.9982663 0.9982842 0.9983021 [113] 0.9983199 0.9983376 0.9983551 0.9983726 0.9983900 0.9984074 0.9984246 [120] 0.9984417 0.9984587 0.9984757 0.9984925 0.9985093 0.9985260 0.9985426 [127] 0.9985590 0.9985754 0.9985917 0.9986079 0.9986241 0.9986401 0.9986560 [134] 0.9986718 0.9986876 0.9987032 0.9987188 0.9987343 0.9987497 0.9987649 [141] 0.9987801 0.9987952 0.9988102 0.9988251 0.9988400 0.9988547 0.9988693 [148] 0.9988839 0.9988983 0.9989127 0.9989269 0.9989411 0.9989552 0.9989692 [155] 0.9989831 0.9989969 0.9990106 0.9990242 0.9990377 0.9990511 0.9990645 [162] 0.9990777 0.9990909 0.9991039 0.9991169 0.9991297 0.9991425 0.9991552 [169] 0.9991678 0.9991803 0.9991927 0.9992050 0.9992172 0.9992293 0.9992414 [176] 0.9992533 0.9992651 0.9992769 0.9992885 0.9993001 0.9993116 0.9993229 [183] 0.9993342 0.9993454 0.9993565 0.9993675 0.9993784 0.9993892 0.9993999 [190] 0.9994105 0.9994211 0.9994315 0.9994418 0.9994521 0.9994622 0.9994723 [197] 0.9994822 0.9994921 0.9995019 0.9995116 0.9995212 0.9995307 0.9995401 [204] 0.9995494 0.9995586 0.9995677 0.9995767 0.9995856 0.9995945 0.9996032 [211] 0.9996118 0.9996204 0.9996289 0.9996372 0.9996455 0.9996536 0.9996617 [218] 0.9996697 0.9996776 0.9996854 0.9996931 0.9997007 0.9997082 0.9997156 [225] 0.9997229 0.9997302 0.9997373 0.9997443 0.9997513 0.9997581 0.9997648 [232] 0.9997715 0.9997781 0.9997845 0.9997909 0.9997972 0.9998033 0.9998094 [239] 0.9998154 0.9998213 0.9998271 0.9998328 0.9998384 0.9998439 0.9998494 [246] 0.9998547 0.9998599 0.9998650 0.9998701 0.9998750 0.9998799 0.9998846 [253] 0.9998893 0.9998938 0.9998983 0.9999026 0.9999069 0.9999111 0.9999152 [260] 0.9999192 0.9999230 0.9999268 0.9999305 0.9999341 0.9999376 0.9999410 [267] 0.9999444 0.9999476 0.9999507 0.9999537 0.9999567 0.9999595 0.9999622 [274] 0.9999649 0.9999674 0.9999699 0.9999722 0.9999745 0.9999766 0.9999787 [281] 0.9999807 0.9999825 0.9999843 0.9999860 0.9999876 0.9999891 0.9999905 [288] 0.9999918 0.9999930 0.9999941 0.9999951 0.9999960 0.9999968 0.9999975 [295] 0.9999981 0.9999986 0.9999991 0.9999994 0.9999996 0.9999998 0.9999998 [302] 0.9999998 0.9999996 0.9999994 0.9999990 0.9999986 0.9999980 0.9999974 [309] 0.9999967 0.9999958 0.9999949 0.9999939 0.9999927 0.9999915 0.9999902 [316] 0.9999888 0.9999873 0.9999857 0.9999840 0.9999822 0.9999803 0.9999783 [323] 0.9999762 0.9999740 0.9999717 0.9999693 0.9999669 0.9999643 0.9999616 [330] 0.9999588 0.9999560 0.9999530 0.9999499 0.9999468 0.9999435 0.9999401 [337] 0.9999367 0.9999331 0.9999295 0.9999257 0.9999219 0.9999179 0.9999139 [344] 0.9999098 0.9999055 0.9999012 0.9998968 0.9998922 0.9998876 0.9998829 [351] 0.9998781 0.9998731 0.9998681 0.9998630 0.9998578 0.9998525 0.9998471 [358] 0.9998416 0.9998360 0.9998303 0.9998245 0.9998186 0.9998126 0.9998065 [365] 0.9998003 0.9997940 0.9997876 0.9997811 0.9997745 0.9997678 0.9997611 [372] 0.9997542 0.9997472 0.9997401 0.9997329 0.9997257 0.9997183 0.9997108 [379] 0.9997033 0.9996956 0.9996878 0.9996800 0.9996720 0.9996639 0.9996558 [386] 0.9996475 0.9996392 0.9996307 0.9996222 0.9996135 0.9996048 0.9995959 [393] 0.9995870 0.9995779 0.9995688 0.9995595 0.9995502 0.9995408 0.9995312 [400] 0.9995216 0.9995118 > mx [1] 0.9999998 > 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/18z171258033919.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/2iwcf1258033919.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/3eihz1258033919.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/4d67l1258033919.tab") > > system("convert tmp/18z171258033919.ps tmp/18z171258033919.png") > system("convert tmp/2iwcf1258033919.ps tmp/2iwcf1258033919.png") > system("convert tmp/3eihz1258033919.ps tmp/3eihz1258033919.png") > > > proc.time() user system elapsed 0.744 0.517 1.038