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(99.5,98.2,108.9,100.0,105.0,108.4,96.7,100.5,115.6,114.9,110.7,107.7,113.5,106.9,119.6,109.4,106.9,118.7,108.9,113.1,125.1,126.5,122.7,127.5,107.1,112.0,122.1,111.5,113.2,128.2,115.1,117.4,132.0,130.8,128.0,132.7,117.0,110.9,123.5,117.4,122.7,123.5,111.5,113.8,131.2,127.0,126.2,121.2,118.8,117.9,135.2,120.7,126.4,129.6,113.4,120.5,135.5,137.6,130.6,133.1,121.5,120.5,136.9,123.7,128.5,135.0,120.9,121.1,132.2,134.5,133.6,136.1,124.5,124.6,133.5,132.3,125.3,135.5,121.2,117.5,135.9) > x <- c(97.7,101.5,119.6,108.1,117.8,125.5,89.2,92.3,104.6,122.8,96.0,94.6,93.3,101.1,114.2,104.7,113.3,118.2,83.6,73.9,99.5,97.7,103.0,106.3,92.2,101.8,122.8,111.8,106.3,121.5,81.9,85.4,110.9,117.3,106.3,105.5,101.3,105.9,126.3,111.9,108.9,127.2,94.2,85.7,116.2,107.2,110.6,112.0,104.5,112.0,132.8,110.8,128.7,136.8,94.9,88.8,123.2,125.3,122.7,125.7,116.3,118.7,142.0,127.9,131.9,152.3,110.8,99.1,135.0,133.2,131.0,133.9,119.9,136.9,148.9,145.1,142.4,159.6,120.7,109.0,142.0) > #'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.6036324 0.6039395 0.6042458 0.6045515 0.6048563 0.6051604 0.6054638 [8] 0.6057665 0.6060683 0.6063695 0.6066699 0.6069695 0.6072684 0.6075665 [15] 0.6078639 0.6081605 0.6084564 0.6087515 0.6090458 0.6093394 0.6096322 [22] 0.6099243 0.6102156 0.6105061 0.6107959 0.6110849 0.6113731 0.6116606 [29] 0.6119472 0.6122331 0.6125183 0.6128026 0.6130862 0.6133690 0.6136510 [36] 0.6139323 0.6142127 0.6144924 0.6147713 0.6150494 0.6153267 0.6156033 [43] 0.6158790 0.6161540 0.6164282 0.6167015 0.6169741 0.6172459 0.6175169 [50] 0.6177871 0.6180565 0.6183251 0.6185930 0.6188600 0.6191262 0.6193916 [57] 0.6196562 0.6199200 0.6201830 0.6204452 0.6207066 0.6209672 0.6212269 [64] 0.6214859 0.6217441 0.6220014 0.6222579 0.6225137 0.6227686 0.6230227 [71] 0.6232759 0.6235284 0.6237800 0.6240309 0.6242809 0.6245300 0.6247784 [78] 0.6250260 0.6252727 0.6255186 0.6257636 0.6260079 0.6262513 0.6264939 [85] 0.6267357 0.6269766 0.6272167 0.6274560 0.6276945 0.6279321 0.6281689 [92] 0.6284048 0.6286399 0.6288742 0.6291077 0.6293403 0.6295721 0.6298030 [99] 0.6300331 0.6302624 0.6304908 0.6307184 0.6309452 0.6311711 0.6313961 [106] 0.6316204 0.6318438 0.6320663 0.6322880 0.6325088 0.6327288 0.6329480 [113] 0.6331663 0.6333838 0.6336004 0.6338162 0.6340311 0.6342451 0.6344584 [120] 0.6346707 0.6348822 0.6350929 0.6353027 0.6355117 0.6357198 0.6359270 [127] 0.6361334 0.6363390 0.6365437 0.6367475 0.6369505 0.6371526 0.6373539 [134] 0.6375543 0.6377538 0.6379525 0.6381503 0.6383473 0.6385434 0.6387387 [141] 0.6389331 0.6391266 0.6393193 0.6395111 0.6397020 0.6398921 0.6400813 [148] 0.6402697 0.6404572 0.6406438 0.6408296 0.6410145 0.6411985 0.6413817 [155] 0.6415640 0.6417454 0.6419260 0.6421057 0.6422845 0.6424625 0.6426396 [162] 0.6428159 0.6429912 0.6431657 0.6433394 0.6435121 0.6436840 0.6438551 [169] 0.6440252 0.6441945 0.6443630 0.6445305 0.6446972 0.6448630 0.6450280 [176] 0.6451920 0.6453552 0.6455176 0.6456790 0.6458396 0.6459994 0.6461582 [183] 0.6463162 0.6464733 0.6466295 0.6467849 0.6469394 0.6470930 0.6472458 [190] 0.6473976 0.6475486 0.6476988 0.6478480 0.6479964 0.6481440 0.6482906 [197] 0.6484364 0.6485813 0.6487253 0.6488685 0.6490108 0.6491522 0.6492927 [204] 0.6494324 0.6495712 0.6497091 0.6498462 0.6499824 0.6501177 0.6502521 [211] 0.6503857 0.6505184 0.6506502 0.6507812 0.6509112 0.6510405 0.6511688 [218] 0.6512963 0.6514229 0.6515486 0.6516734 0.6517974 0.6519205 0.6520428 [225] 0.6521642 0.6522847 0.6524043 0.6525231 0.6526410 0.6527580 0.6528741 [232] 0.6529894 0.6531039 0.6532174 0.6533301 0.6534419 0.6535529 0.6536629 [239] 0.6537721 0.6538805 0.6539880 0.6540946 0.6542003 0.6543052 0.6544092 [246] 0.6545124 0.6546147 0.6547161 0.6548166 0.6549163 0.6550151 0.6551131 [253] 0.6552102 0.6553064 0.6554018 0.6554963 0.6555900 0.6556828 0.6557747 [260] 0.6558657 0.6559559 0.6560453 0.6561338 0.6562214 0.6563082 0.6563941 [267] 0.6564791 0.6565633 0.6566466 0.6567291 0.6568107 0.6568915 0.6569714 [274] 0.6570505 0.6571287 0.6572060 0.6572825 0.6573581 0.6574329 0.6575068 [281] 0.6575799 0.6576521 0.6577235 0.6577940 0.6578637 0.6579325 0.6580005 [288] 0.6580676 0.6581339 0.6581993 0.6582639 0.6583276 0.6583905 0.6584526 [295] 0.6585138 0.6585741 0.6586336 0.6586923 0.6587501 0.6588071 0.6588633 [302] 0.6589186 0.6589730 0.6590266 0.6590794 0.6591314 0.6591825 0.6592327 [309] 0.6592822 0.6593308 0.6593785 0.6594255 0.6594715 0.6595168 0.6595612 [316] 0.6596048 0.6596476 0.6596895 0.6597306 0.6597709 0.6598103 0.6598489 [323] 0.6598867 0.6599237 0.6599598 0.6599951 0.6600296 0.6600633 0.6600961 [330] 0.6601281 0.6601593 0.6601897 0.6602192 0.6602479 0.6602758 0.6603029 [337] 0.6603292 0.6603547 0.6603793 0.6604031 0.6604261 0.6604483 0.6604697 [344] 0.6604903 0.6605101 0.6605290 0.6605472 0.6605645 0.6605810 0.6605967 [351] 0.6606116 0.6606258 0.6606391 0.6606515 0.6606632 0.6606741 0.6606842 [358] 0.6606935 0.6607020 0.6607097 0.6607166 0.6607227 0.6607280 0.6607325 [365] 0.6607362 0.6607391 0.6607412 0.6607425 0.6607431 0.6607428 0.6607418 [372] 0.6607400 0.6607373 0.6607339 0.6607297 0.6607248 0.6607190 0.6607125 [379] 0.6607051 0.6606970 0.6606881 0.6606785 0.6606680 0.6606568 0.6606448 [386] 0.6606320 0.6606185 0.6606042 0.6605891 0.6605732 0.6605566 0.6605392 [393] 0.6605210 0.6605020 0.6604823 0.6604618 0.6604406 0.6604186 0.6603958 [400] 0.6603723 0.6603480 > mx [1] 0.6607431 > mxli [1] 1.68 > 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/1jdjl1228922621.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/2zlah1228922621.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/3cu4w1228922621.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/4l4og1228922621.tab") > > system("convert tmp/1jdjl1228922621.ps tmp/1jdjl1228922621.png") > system("convert tmp/2zlah1228922621.ps tmp/2zlah1228922621.png") > system("convert tmp/3cu4w1228922621.ps tmp/3cu4w1228922621.png") > > > proc.time() user system elapsed 0.781 0.493 1.017