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(98.5,97.0,103.3,99.6,100.1,102.9,95.9,94.5,107.4,116.0,102.8,99.8,109.6,103.0,111.6,106.3,97.9,108.8,103.9,101.2,122.9,123.9,111.7,120.9,99.6,103.3,119.4,106.5,101.9,124.6,106.5,107.8,127.4,120.1,118.5,127.7,107.7,104.5,118.8,110.3,109.6,119.1,96.5,106.7,126.3,116.2,118.8,115.2,110.0,111.4,129.6,108.1,117.8,122.9,100.6,111.8,127.0,128.6,124.8,118.5,114.7,112.6,128.7,111.0,115.8,126.0,111.1,113.2,120.1,130.6,124.0,119.4,116.7,116.5,119.6,126.5,111.3,123.5,114.2,103.7,129.5) > 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.6031989 0.6034287 0.6036578 0.6038861 0.6041137 0.6043405 0.6045665 [8] 0.6047919 0.6050164 0.6052402 0.6054633 0.6056856 0.6059071 0.6061279 [15] 0.6063479 0.6065672 0.6067857 0.6070034 0.6072204 0.6074366 0.6076520 [22] 0.6078667 0.6080806 0.6082938 0.6085061 0.6087178 0.6089286 0.6091386 [29] 0.6093479 0.6095565 0.6097642 0.6099712 0.6101773 0.6103828 0.6105874 [36] 0.6107912 0.6109943 0.6111966 0.6113981 0.6115988 0.6117988 0.6119979 [43] 0.6121963 0.6123939 0.6125907 0.6127867 0.6129819 0.6131764 0.6133700 [50] 0.6135629 0.6137549 0.6139462 0.6141367 0.6143264 0.6145152 0.6147033 [57] 0.6148906 0.6150771 0.6152628 0.6154477 0.6156318 0.6158151 0.6159976 [64] 0.6161793 0.6163602 0.6165403 0.6167196 0.6168981 0.6170758 0.6172527 [71] 0.6174287 0.6176040 0.6177785 0.6179521 0.6181250 0.6182970 0.6184682 [78] 0.6186386 0.6188082 0.6189770 0.6191450 0.6193122 0.6194785 0.6196440 [85] 0.6198088 0.6199727 0.6201358 0.6202980 0.6204595 0.6206201 0.6207800 [92] 0.6209390 0.6210972 0.6212545 0.6214111 0.6215668 0.6217217 0.6218758 [99] 0.6220291 0.6221815 0.6223331 0.6224839 0.6226339 0.6227831 0.6229314 [106] 0.6230789 0.6232256 0.6233714 0.6235164 0.6236606 0.6238040 0.6239466 [113] 0.6240883 0.6242292 0.6243692 0.6245085 0.6246469 0.6247845 0.6249212 [120] 0.6250571 0.6251922 0.6253265 0.6254599 0.6255925 0.6257243 0.6258552 [127] 0.6259853 0.6261146 0.6262430 0.6263707 0.6264974 0.6266234 0.6267485 [134] 0.6268728 0.6269962 0.6271188 0.6272406 0.6273615 0.6274816 0.6276009 [141] 0.6277194 0.6278370 0.6279537 0.6280697 0.6281848 0.6282990 0.6284124 [148] 0.6285250 0.6286368 0.6287477 0.6288578 0.6289670 0.6290755 0.6291830 [155] 0.6292898 0.6293957 0.6295007 0.6296050 0.6297084 0.6298109 0.6299126 [162] 0.6300135 0.6301135 0.6302128 0.6303111 0.6304087 0.6305054 0.6306012 [169] 0.6306962 0.6307904 0.6308838 0.6309763 0.6310680 0.6311588 0.6312488 [176] 0.6313380 0.6314263 0.6315138 0.6316004 0.6316862 0.6317712 0.6318554 [183] 0.6319387 0.6320212 0.6321028 0.6321836 0.6322636 0.6323427 0.6324210 [190] 0.6324984 0.6325751 0.6326508 0.6327258 0.6327999 0.6328732 0.6329456 [197] 0.6330173 0.6330880 0.6331580 0.6332271 0.6332954 0.6333628 0.6334294 [204] 0.6334952 0.6335602 0.6336243 0.6336876 0.6337500 0.6338116 0.6338724 [211] 0.6339324 0.6339915 0.6340498 0.6341073 0.6341639 0.6342197 0.6342747 [218] 0.6343288 0.6343821 0.6344346 0.6344863 0.6345371 0.6345871 0.6346363 [225] 0.6346846 0.6347322 0.6347789 0.6348247 0.6348698 0.6349140 0.6349574 [232] 0.6350000 0.6350417 0.6350826 0.6351227 0.6351620 0.6352005 0.6352381 [239] 0.6352749 0.6353109 0.6353461 0.6353804 0.6354140 0.6354467 0.6354786 [246] 0.6355096 0.6355399 0.6355693 0.6355980 0.6356258 0.6356528 0.6356789 [253] 0.6357043 0.6357288 0.6357526 0.6357755 0.6357976 0.6358189 0.6358394 [260] 0.6358590 0.6358779 0.6358959 0.6359132 0.6359296 0.6359452 0.6359600 [267] 0.6359740 0.6359872 0.6359996 0.6360112 0.6360220 0.6360319 0.6360411 [274] 0.6360495 0.6360571 0.6360638 0.6360698 0.6360749 0.6360793 0.6360829 [281] 0.6360856 0.6360876 0.6360887 0.6360891 0.6360887 0.6360875 0.6360854 [288] 0.6360826 0.6360790 0.6360746 0.6360694 0.6360634 0.6360567 0.6360491 [295] 0.6360407 0.6360316 0.6360217 0.6360109 0.6359994 0.6359871 0.6359741 [302] 0.6359602 0.6359456 0.6359301 0.6359139 0.6358969 0.6358791 0.6358606 [309] 0.6358413 0.6358211 0.6358003 0.6357786 0.6357561 0.6357329 0.6357089 [316] 0.6356842 0.6356586 0.6356323 0.6356052 0.6355774 0.6355488 0.6355194 [323] 0.6354892 0.6354583 0.6354266 0.6353941 0.6353609 0.6353269 0.6352922 [330] 0.6352567 0.6352204 0.6351834 0.6351456 0.6351070 0.6350677 0.6350277 [337] 0.6349868 0.6349453 0.6349029 0.6348598 0.6348160 0.6347714 0.6347261 [344] 0.6346800 0.6346332 0.6345856 0.6345372 0.6344882 0.6344383 0.6343878 [351] 0.6343365 0.6342844 0.6342316 0.6341781 0.6341238 0.6340688 0.6340131 [358] 0.6339566 0.6338993 0.6338414 0.6337827 0.6337233 0.6336631 0.6336022 [365] 0.6335406 0.6334783 0.6334152 0.6333514 0.6332869 0.6332217 0.6331557 [372] 0.6330890 0.6330216 0.6329535 0.6328846 0.6328150 0.6327447 0.6326737 [379] 0.6326020 0.6325296 0.6324564 0.6323826 0.6323080 0.6322327 0.6321567 [386] 0.6320800 0.6320026 0.6319245 0.6318457 0.6317661 0.6316859 0.6316050 [393] 0.6315234 0.6314410 0.6313580 0.6312743 0.6311899 0.6311048 0.6310190 [400] 0.6309325 0.6308453 > mx [1] 0.6360891 > mxli [1] 0.83 > 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/1wwhj1228921723.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/2ppnw1228921723.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/3dvul1228921723.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/4q65h1228921723.tab") > > system("convert tmp/1wwhj1228921723.ps tmp/1wwhj1228921723.png") > system("convert tmp/2ppnw1228921723.ps tmp/2ppnw1228921723.png") > system("convert tmp/3dvul1228921723.ps tmp/3dvul1228921723.png") > > > proc.time() user system elapsed 0.779 0.518 0.917