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(77.9,60,99.5,95,105.6,102.5,93.3,97.3,127,111.7,96.4,133,72.2,95.8,124.1,127.6,110.7,104.6,112.7,115.3,139.4,119,97.4,154,81.5,88.8,127.7,105.1,114.9,106.4,104.5,121.6,141.4,99,126.7,134.1,81.3,88.6,132.7,132.9,134.4,103.7,119.7,115,132.9,108.5,113.9,142,97.7,92.2,128.8,134.9,128.2,114.8,117.9,119.1,120.7,129.1,117.6,129.2,99.1) > x <- c(117.8,113.5,121.2,130.4,115.2,117.9,110.7,107.6,124.3,115.1,112.5,127.9,117.4,119.3,130.4,126,125.4,130.5,115.9,108.7,124,119.4,118.6,131.3,111.1,124.8,132.3,126.7,131.7,130.9,122.1,113.2,133.6,119.2,129.4,131.4,117.1,130.5,132.3,140.8,137.5,128.6,126.7,120.8,139.3,128.6,131.3,136.3,128.8,133.2,136.3,151.1,145,134.4,135.7,128.7,129.2,138.6,132.7,132.5,135.2) > #'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.5684470 0.5684943 0.5685415 0.5685886 0.5686355 0.5686823 0.5687290 [8] 0.5687756 0.5688221 0.5688684 0.5689146 0.5689606 0.5690065 0.5690523 [15] 0.5690980 0.5691436 0.5691890 0.5692343 0.5692794 0.5693245 0.5693694 [22] 0.5694141 0.5694588 0.5695033 0.5695477 0.5695919 0.5696361 0.5696801 [29] 0.5697239 0.5697677 0.5698113 0.5698547 0.5698981 0.5699413 0.5699844 [36] 0.5700273 0.5700701 0.5701128 0.5701554 0.5701978 0.5702401 0.5702823 [43] 0.5703243 0.5703662 0.5704080 0.5704496 0.5704911 0.5705325 0.5705737 [50] 0.5706148 0.5706558 0.5706966 0.5707374 0.5707779 0.5708184 0.5708587 [57] 0.5708988 0.5709389 0.5709788 0.5710186 0.5710582 0.5710977 0.5711371 [64] 0.5711763 0.5712154 0.5712544 0.5712932 0.5713319 0.5713704 0.5714089 [71] 0.5714472 0.5714853 0.5715233 0.5715612 0.5715990 0.5716366 0.5716740 [78] 0.5717114 0.5717486 0.5717856 0.5718226 0.5718594 0.5718960 0.5719325 [85] 0.5719689 0.5720051 0.5720412 0.5720772 0.5721130 0.5721487 0.5721843 [92] 0.5722197 0.5722550 0.5722901 0.5723251 0.5723600 0.5723947 0.5724293 [99] 0.5724637 0.5724980 0.5725322 0.5725662 0.5726001 0.5726338 0.5726675 [106] 0.5727009 0.5727342 0.5727674 0.5728005 0.5728334 0.5728662 0.5728988 [113] 0.5729313 0.5729636 0.5729958 0.5730279 0.5730598 0.5730916 0.5731232 [120] 0.5731547 0.5731861 0.5732173 0.5732483 0.5732793 0.5733100 0.5733407 [127] 0.5733712 0.5734015 0.5734318 0.5734618 0.5734918 0.5735215 0.5735512 [134] 0.5735807 0.5736100 0.5736392 0.5736683 0.5736972 0.5737260 0.5737546 [141] 0.5737831 0.5738115 0.5738397 0.5738677 0.5738957 0.5739234 0.5739510 [148] 0.5739785 0.5740058 0.5740330 0.5740601 0.5740870 0.5741137 0.5741403 [155] 0.5741668 0.5741931 0.5742192 0.5742453 0.5742711 0.5742969 0.5743224 [162] 0.5743479 0.5743732 0.5743983 0.5744233 0.5744481 0.5744728 0.5744974 [169] 0.5745218 0.5745460 0.5745701 0.5745941 0.5746179 0.5746415 0.5746650 [176] 0.5746884 0.5747116 0.5747347 0.5747576 0.5747803 0.5748030 0.5748254 [183] 0.5748477 0.5748699 0.5748919 0.5749138 0.5749355 0.5749571 0.5749785 [190] 0.5749998 0.5750209 0.5750418 0.5750627 0.5750833 0.5751038 0.5751242 [197] 0.5751444 0.5751645 0.5751844 0.5752041 0.5752237 0.5752432 0.5752625 [204] 0.5752816 0.5753006 0.5753195 0.5753382 0.5753567 0.5753751 0.5753933 [211] 0.5754114 0.5754293 0.5754471 0.5754647 0.5754822 0.5754995 0.5755167 [218] 0.5755337 0.5755505 0.5755672 0.5755838 0.5756002 0.5756164 0.5756325 [225] 0.5756484 0.5756642 0.5756798 0.5756953 0.5757106 0.5757257 0.5757407 [232] 0.5757556 0.5757702 0.5757848 0.5757992 0.5758134 0.5758274 0.5758413 [239] 0.5758551 0.5758687 0.5758821 0.5758954 0.5759085 0.5759215 0.5759343 [246] 0.5759470 0.5759595 0.5759718 0.5759840 0.5759960 0.5760079 0.5760196 [253] 0.5760312 0.5760426 0.5760538 0.5760649 0.5760758 0.5760866 0.5760972 [260] 0.5761076 0.5761179 0.5761280 0.5761380 0.5761478 0.5761575 0.5761669 [267] 0.5761763 0.5761854 0.5761945 0.5762033 0.5762120 0.5762205 0.5762289 [274] 0.5762371 0.5762452 0.5762531 0.5762608 0.5762684 0.5762758 0.5762831 [281] 0.5762901 0.5762971 0.5763038 0.5763104 0.5763169 0.5763232 0.5763293 [288] 0.5763353 0.5763411 0.5763467 0.5763522 0.5763575 0.5763626 0.5763676 [295] 0.5763725 0.5763771 0.5763816 0.5763860 0.5763901 0.5763942 0.5763980 [302] 0.5764017 0.5764052 0.5764086 0.5764118 0.5764148 0.5764177 0.5764204 [309] 0.5764229 0.5764253 0.5764275 0.5764296 0.5764315 0.5764332 0.5764347 [316] 0.5764361 0.5764374 0.5764384 0.5764393 0.5764400 0.5764406 0.5764410 [323] 0.5764413 0.5764413 0.5764412 0.5764410 0.5764405 0.5764400 0.5764392 [330] 0.5764383 0.5764372 0.5764359 0.5764345 0.5764329 0.5764312 0.5764293 [337] 0.5764272 0.5764249 0.5764225 0.5764199 0.5764171 0.5764142 0.5764111 [344] 0.5764079 0.5764045 0.5764009 0.5763971 0.5763932 0.5763891 0.5763848 [351] 0.5763804 0.5763758 0.5763710 0.5763661 0.5763610 0.5763557 0.5763503 [358] 0.5763447 0.5763389 0.5763329 0.5763268 0.5763205 0.5763141 0.5763074 [365] 0.5763007 0.5762937 0.5762866 0.5762793 0.5762718 0.5762641 0.5762563 [372] 0.5762483 0.5762402 0.5762319 0.5762234 0.5762147 0.5762059 0.5761969 [379] 0.5761877 0.5761784 0.5761688 0.5761592 0.5761493 0.5761393 0.5761291 [386] 0.5761187 0.5761082 0.5760974 0.5760866 0.5760755 0.5760643 0.5760529 [393] 0.5760413 0.5760296 0.5760176 0.5760056 0.5759933 0.5759809 0.5759683 [400] 0.5759555 0.5759425 > mx [1] 0.5764413 > mxli [1] 1.23 > 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/1zupd1226261899.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/2grp11226261899.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/3nald1226261899.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/4ww7z1226261899.tab") > > system("convert tmp/1zupd1226261899.ps tmp/1zupd1226261899.png") > system("convert tmp/2grp11226261899.ps tmp/2grp11226261899.png") > system("convert tmp/3nald1226261899.ps tmp/3nald1226261899.png") > > > proc.time() user system elapsed 1.001 0.492 1.191