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(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) > x <- 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) > #'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.5987843 0.5988641 0.5989438 0.5990234 0.5991030 0.5991826 0.5992620 [8] 0.5993415 0.5994208 0.5995001 0.5995794 0.5996586 0.5997378 0.5998168 [15] 0.5998959 0.5999749 0.6000538 0.6001326 0.6002114 0.6002902 0.6003689 [22] 0.6004475 0.6005261 0.6006047 0.6006831 0.6007615 0.6008399 0.6009182 [29] 0.6009964 0.6010746 0.6011528 0.6012308 0.6013089 0.6013868 0.6014647 [36] 0.6015426 0.6016203 0.6016981 0.6017758 0.6018534 0.6019309 0.6020084 [43] 0.6020859 0.6021633 0.6022406 0.6023179 0.6023951 0.6024722 0.6025493 [50] 0.6026264 0.6027033 0.6027803 0.6028571 0.6029339 0.6030107 0.6030874 [57] 0.6031640 0.6032406 0.6033171 0.6033935 0.6034699 0.6035463 0.6036226 [64] 0.6036988 0.6037749 0.6038510 0.6039271 0.6040031 0.6040790 0.6041549 [71] 0.6042307 0.6043064 0.6043821 0.6044577 0.6045333 0.6046088 0.6046843 [78] 0.6047596 0.6048350 0.6049102 0.6049855 0.6050606 0.6051357 0.6052107 [85] 0.6052857 0.6053606 0.6054355 0.6055103 0.6055850 0.6056597 0.6057343 [92] 0.6058088 0.6058833 0.6059577 0.6060321 0.6061064 0.6061807 0.6062548 [99] 0.6063290 0.6064030 0.6064770 0.6065510 0.6066249 0.6066987 0.6067724 [106] 0.6068461 0.6069198 0.6069933 0.6070669 0.6071403 0.6072137 0.6072870 [113] 0.6073603 0.6074335 0.6075066 0.6075797 0.6076527 0.6077257 0.6077986 [120] 0.6078714 0.6079442 0.6080169 0.6080896 0.6081622 0.6082347 0.6083071 [127] 0.6083795 0.6084519 0.6085242 0.6085964 0.6086685 0.6087406 0.6088126 [134] 0.6088846 0.6089565 0.6090283 0.6091001 0.6091718 0.6092435 0.6093151 [141] 0.6093866 0.6094580 0.6095294 0.6096008 0.6096720 0.6097432 0.6098144 [148] 0.6098855 0.6099565 0.6100274 0.6100983 0.6101692 0.6102399 0.6103106 [155] 0.6103812 0.6104518 0.6105223 0.6105928 0.6106631 0.6107335 0.6108037 [162] 0.6108739 0.6109440 0.6110141 0.6110841 0.6111540 0.6112239 0.6112937 [169] 0.6113634 0.6114331 0.6115027 0.6115722 0.6116417 0.6117111 0.6117805 [176] 0.6118498 0.6119190 0.6119881 0.6120572 0.6121263 0.6121952 0.6122641 [183] 0.6123329 0.6124017 0.6124704 0.6125390 0.6126076 0.6126761 0.6127445 [190] 0.6128129 0.6128812 0.6129495 0.6130176 0.6130858 0.6131538 0.6132218 [197] 0.6132897 0.6133575 0.6134253 0.6134930 0.6135607 0.6136283 0.6136958 [204] 0.6137632 0.6138306 0.6138980 0.6139652 0.6140324 0.6140995 0.6141666 [211] 0.6142336 0.6143005 0.6143673 0.6144341 0.6145008 0.6145675 0.6146341 [218] 0.6147006 0.6147671 0.6148335 0.6148998 0.6149660 0.6150322 0.6150983 [225] 0.6151644 0.6152304 0.6152963 0.6153622 0.6154279 0.6154937 0.6155593 [232] 0.6156249 0.6156904 0.6157559 0.6158212 0.6158866 0.6159518 0.6160170 [239] 0.6160821 0.6161471 0.6162121 0.6162770 0.6163419 0.6164066 0.6164714 [246] 0.6165360 0.6166006 0.6166651 0.6167295 0.6167939 0.6168582 0.6169224 [253] 0.6169865 0.6170506 0.6171147 0.6171786 0.6172425 0.6173063 0.6173701 [260] 0.6174338 0.6174974 0.6175609 0.6176244 0.6176878 0.6177512 0.6178144 [267] 0.6178776 0.6179408 0.6180038 0.6180668 0.6181298 0.6181926 0.6182554 [274] 0.6183181 0.6183808 0.6184434 0.6185059 0.6185683 0.6186307 0.6186930 [281] 0.6187552 0.6188174 0.6188795 0.6189415 0.6190035 0.6190654 0.6191272 [288] 0.6191889 0.6192506 0.6193122 0.6193738 0.6194352 0.6194966 0.6195580 [295] 0.6196192 0.6196804 0.6197416 0.6198026 0.6198636 0.6199245 0.6199854 [302] 0.6200461 0.6201068 0.6201675 0.6202280 0.6202885 0.6203489 0.6204093 [309] 0.6204696 0.6205298 0.6205899 0.6206500 0.6207100 0.6207699 0.6208298 [316] 0.6208896 0.6209493 0.6210089 0.6210685 0.6211280 0.6211875 0.6212468 [323] 0.6213061 0.6213654 0.6214245 0.6214836 0.6215426 0.6216015 0.6216604 [330] 0.6217192 0.6217779 0.6218366 0.6218952 0.6219537 0.6220121 0.6220705 [337] 0.6221288 0.6221870 0.6222452 0.6223033 0.6223613 0.6224192 0.6224771 [344] 0.6225349 0.6225926 0.6226503 0.6227079 0.6227654 0.6228228 0.6228802 [351] 0.6229375 0.6229947 0.6230519 0.6231090 0.6231660 0.6232229 0.6232798 [358] 0.6233366 0.6233933 0.6234500 0.6235066 0.6235631 0.6236195 0.6236759 [365] 0.6237322 0.6237884 0.6238445 0.6239006 0.6239566 0.6240126 0.6240684 [372] 0.6241242 0.6241799 0.6242356 0.6242911 0.6243466 0.6244021 0.6244574 [379] 0.6245127 0.6245679 0.6246230 0.6246781 0.6247331 0.6247880 0.6248429 [386] 0.6248976 0.6249523 0.6250070 0.6250615 0.6251160 0.6251704 0.6252247 [393] 0.6252790 0.6253332 0.6253873 0.6254413 0.6254953 0.6255492 0.6256030 [400] 0.6256568 0.6257105 > mx [1] 0.6257105 > 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/1xjox1226422935.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/2lgn31226422935.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/3qfyi1226422935.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/462em1226422935.tab") > > system("convert tmp/1xjox1226422935.ps tmp/1xjox1226422935.png") > system("convert tmp/2lgn31226422935.ps tmp/2lgn31226422935.png") > system("convert tmp/3qfyi1226422935.ps tmp/3qfyi1226422935.png") > > > proc.time() user system elapsed 0.971 0.490 1.141