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(103.1,100.6,103.1,95.5,90.5,90.9,88.8,90.7,94.3,104.6,111.1,110.8,107.2,99,99,91,96.2,96.9,96.2,100.1,99,115.4,106.9,107.1,99.3,99.2,108.3,105.6,99.5,107.4,93.1,88.1,110.7,113.1,99.6,93.6,98.6,99.6,114.3,107.8,101.2,112.5,100.5,93.9,116.2,112,106.4,95.7,96,95.8,103,102.2,98.4,111.4,86.6,91.3,107.9,101.8,104.4,93.4,100.1,98.5,112.9,101.4,107.1,110.8,90.3,95.5,111.4,113,107.5,95.9,106.3,105.2,117.2,106.9,108.2,113,97.2,99.9,108.1,118.1,109.1,93.3,112.1) > x <- c(98.6,98,106.8,96.6,100.1,107.7,91.5,97.8,107.4,117.5,105.6,97.4,99.5,98,104.3,100.6,101.1,103.9,96.9,95.5,108.4,117,103.8,100.8,110.6,104,112.6,107.3,98.9,109.8,104.9,102.2,123.9,124.9,112.7,121.9,100.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5,115.7,113.6,129.7,112,116.8,127,112.1,114.2,121.1,131.6,125,120.4,117.7) > #'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.5986775 0.5987640 0.5988504 0.5989367 0.5990229 0.5991091 0.5991951 [8] 0.5992810 0.5993668 0.5994526 0.5995382 0.5996237 0.5997092 0.5997945 [15] 0.5998798 0.5999649 0.6000500 0.6001349 0.6002198 0.6003046 0.6003892 [22] 0.6004738 0.6005583 0.6006426 0.6007269 0.6008111 0.6008952 0.6009792 [29] 0.6010630 0.6011468 0.6012305 0.6013141 0.6013976 0.6014810 0.6015643 [36] 0.6016475 0.6017306 0.6018136 0.6018965 0.6019793 0.6020620 0.6021446 [43] 0.6022271 0.6023095 0.6023918 0.6024740 0.6025561 0.6026381 0.6027200 [50] 0.6028018 0.6028836 0.6029652 0.6030467 0.6031281 0.6032094 0.6032906 [57] 0.6033717 0.6034527 0.6035336 0.6036144 0.6036951 0.6037757 0.6038562 [64] 0.6039366 0.6040169 0.6040971 0.6041772 0.6042572 0.6043371 0.6044169 [71] 0.6044966 0.6045762 0.6046557 0.6047351 0.6048143 0.6048935 0.6049726 [78] 0.6050516 0.6051305 0.6052092 0.6052879 0.6053665 0.6054449 0.6055233 [85] 0.6056016 0.6056797 0.6057578 0.6058357 0.6059136 0.6059913 0.6060690 [92] 0.6061465 0.6062240 0.6063013 0.6063785 0.6064556 0.6065327 0.6066096 [99] 0.6066864 0.6067631 0.6068397 0.6069162 0.6069926 0.6070689 0.6071451 [106] 0.6072212 0.6072972 0.6073731 0.6074488 0.6075245 0.6076001 0.6076755 [113] 0.6077509 0.6078261 0.6079013 0.6079763 0.6080512 0.6081261 0.6082008 [120] 0.6082754 0.6083499 0.6084243 0.6084986 0.6085728 0.6086469 0.6087209 [127] 0.6087948 0.6088685 0.6089422 0.6090158 0.6090892 0.6091626 0.6092358 [134] 0.6093090 0.6093820 0.6094549 0.6095277 0.6096004 0.6096730 0.6097455 [141] 0.6098179 0.6098902 0.6099624 0.6100344 0.6101064 0.6101783 0.6102500 [148] 0.6103217 0.6103932 0.6104646 0.6105359 0.6106071 0.6106782 0.6107492 [155] 0.6108201 0.6108909 0.6109616 0.6110321 0.6111026 0.6111729 0.6112432 [162] 0.6113133 0.6113833 0.6114533 0.6115231 0.6115928 0.6116624 0.6117318 [169] 0.6118012 0.6118705 0.6119396 0.6120087 0.6120776 0.6121464 0.6122152 [176] 0.6122838 0.6123523 0.6124207 0.6124890 0.6125571 0.6126252 0.6126932 [183] 0.6127610 0.6128287 0.6128964 0.6129639 0.6130313 0.6130986 0.6131658 [190] 0.6132329 0.6132998 0.6133667 0.6134334 0.6135001 0.6135666 0.6136330 [197] 0.6136993 0.6137655 0.6138316 0.6138976 0.6139635 0.6140292 0.6140949 [204] 0.6141604 0.6142259 0.6142912 0.6143564 0.6144215 0.6144865 0.6145513 [211] 0.6146161 0.6146807 0.6147453 0.6148097 0.6148740 0.6149382 0.6150023 [218] 0.6150663 0.6151302 0.6151940 0.6152576 0.6153212 0.6153846 0.6154479 [225] 0.6155111 0.6155742 0.6156372 0.6157001 0.6157628 0.6158255 0.6158880 [232] 0.6159504 0.6160127 0.6160749 0.6161370 0.6161990 0.6162609 0.6163226 [239] 0.6163843 0.6164458 0.6165072 0.6165685 0.6166297 0.6166908 0.6167517 [246] 0.6168126 0.6168733 0.6169340 0.6169945 0.6170549 0.6171152 0.6171754 [253] 0.6172354 0.6172954 0.6173552 0.6174149 0.6174746 0.6175341 0.6175934 [260] 0.6176527 0.6177119 0.6177709 0.6178299 0.6178887 0.6179474 0.6180060 [267] 0.6180645 0.6181229 0.6181811 0.6182393 0.6182973 0.6183552 0.6184130 [274] 0.6184707 0.6185283 0.6185857 0.6186431 0.6187003 0.6187575 0.6188145 [281] 0.6188714 0.6189281 0.6189848 0.6190414 0.6190978 0.6191541 0.6192103 [288] 0.6192664 0.6193224 0.6193783 0.6194341 0.6194897 0.6195452 0.6196006 [295] 0.6196559 0.6197111 0.6197662 0.6198212 0.6198760 0.6199307 0.6199854 [302] 0.6200399 0.6200942 0.6201485 0.6202027 0.6202567 0.6203107 0.6203645 [309] 0.6204182 0.6204718 0.6205252 0.6205786 0.6206318 0.6206850 0.6207380 [316] 0.6207909 0.6208437 0.6208963 0.6209489 0.6210013 0.6210537 0.6211059 [323] 0.6211580 0.6212099 0.6212618 0.6213136 0.6213652 0.6214167 0.6214681 [330] 0.6215194 0.6215706 0.6216217 0.6216726 0.6217234 0.6217742 0.6218248 [337] 0.6218753 0.6219256 0.6219759 0.6220260 0.6220761 0.6221260 0.6221758 [344] 0.6222255 0.6222750 0.6223245 0.6223738 0.6224230 0.6224721 0.6225211 [351] 0.6225700 0.6226188 0.6226674 0.6227160 0.6227644 0.6228127 0.6228609 [358] 0.6229089 0.6229569 0.6230047 0.6230525 0.6231001 0.6231476 0.6231949 [365] 0.6232422 0.6232893 0.6233364 0.6233833 0.6234301 0.6234768 0.6235234 [372] 0.6235698 0.6236161 0.6236624 0.6237085 0.6237545 0.6238004 0.6238461 [379] 0.6238918 0.6239373 0.6239827 0.6240280 0.6240732 0.6241183 0.6241632 [386] 0.6242081 0.6242528 0.6242974 0.6243419 0.6243863 0.6244305 0.6244747 [393] 0.6245187 0.6245626 0.6246064 0.6246501 0.6246937 0.6247371 0.6247805 [400] 0.6248237 0.6248668 > mx [1] 0.6248668 > mxli [1] 2 > 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/1i2801226425739.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/2tzle1226425739.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/3kdt21226425739.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/4riql1226425739.tab") > > system("convert tmp/1i2801226425739.ps tmp/1i2801226425739.png") > system("convert tmp/2tzle1226425739.ps tmp/2tzle1226425739.png") > system("convert tmp/3kdt21226425739.ps tmp/3kdt21226425739.png") > > > proc.time() user system elapsed 1.025 0.537 1.267