R version 2.7.0 (2008-04-22) 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(6.6,6.4,6,5.8,5.5,5.4,5.4,5.6,5.5,5.8,5.8,5.7,5.5,5.3,5.2,5.3,5.3,5,4.8,4.9,5.3,6,6.2,6.4,6.4,6.4,6.2,6.1,6,5.9,6.2,6.2,6.4,6.8,6.9,7,7,6.9,6.7,6.6,6.5,6.4,6.5,6.5,6.6,6.7,6.8,7.2,7.6,7.6,7.3,6.4,6.1,6.3,7.1,7.5,7.4,7.1,6.8,6.9,7.2,7.4,7.3,6.9,6.9,6.8,7.1,7.2,7.1,7,6.9,7,7.4,7.5,7.5,7.4,7.3,7,6.7,6.5,6.5,6.5,6.6,6.8,6.9,6.9,6.8,6.8,6.5,6.1,6,5.9,5.8,5.9,5.9,6.2,6.3,6.2,6,5.8,5.5,5.5,5.7,5.8,5.7) > x <- c(15.9,15.5,15.3,14.5,14.4,14.7,19.1,21.6,20.2,17.9,15.7,14.5,14.1,13.9,14.2,15.3,15.4,15.2,16.5,18.2,18.6,21,19.2,18.7,18.4,17.8,17.2,16.2,15.5,15.3,18.3,19.2,19,18.7,18.1,18.5,21.1,21,20.4,19.5,18.6,18.8,23.7,24.8,25,23.6,22.3,21.8,20.8,19.7,18.3,17.4,17,18.1,23.9,25.6,25.3,23.6,21.9,21.4,20.6,20.5,20.2,20.6,19.7,19.3,22.8,23.5,23.8,22.6,22,21.7,20.7,20.2,19.1,19.5,18.7,18.6,22.2,23.2,23.5,21.3,20,18.7,18.9,18.3,18.4,19.9,19.2,18.5,20.9,20.5,19.4,18.1,17,17,17.3,16.7,15.5,15.3,13.7,14.1,17.3,18.1,18.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.6610375 0.6610296 0.6610213 0.6610124 0.6610030 0.6609930 0.6609826 [8] 0.6609716 0.6609601 0.6609480 0.6609355 0.6609224 0.6609087 0.6608946 [15] 0.6608799 0.6608646 0.6608489 0.6608326 0.6608157 0.6607984 0.6607804 [22] 0.6607620 0.6607430 0.6607235 0.6607034 0.6606828 0.6606617 0.6606400 [29] 0.6606178 0.6605950 0.6605717 0.6605479 0.6605235 0.6604985 0.6604731 [36] 0.6604470 0.6604205 0.6603933 0.6603657 0.6603375 0.6603087 0.6602794 [43] 0.6602495 0.6602191 0.6601881 0.6601566 0.6601246 0.6600919 0.6600588 [50] 0.6600250 0.6599908 0.6599559 0.6599205 0.6598846 0.6598481 0.6598110 [57] 0.6597734 0.6597352 0.6596965 0.6596572 0.6596174 0.6595770 0.6595360 [64] 0.6594945 0.6594524 0.6594098 0.6593665 0.6593228 0.6592784 0.6592335 [71] 0.6591881 0.6591421 0.6590955 0.6590483 0.6590006 0.6589523 0.6589035 [78] 0.6588541 0.6588041 0.6587535 0.6587024 0.6586508 0.6585985 0.6585457 [85] 0.6584923 0.6584383 0.6583838 0.6583287 0.6582731 0.6582168 0.6581600 [92] 0.6581026 0.6580447 0.6579862 0.6579271 0.6578674 0.6578072 0.6577464 [99] 0.6576850 0.6576230 0.6575605 0.6574974 0.6574337 0.6573695 0.6573047 [106] 0.6572393 0.6571733 0.6571067 0.6570396 0.6569719 0.6569036 0.6568348 [113] 0.6567654 0.6566954 0.6566248 0.6565536 0.6564819 0.6564096 0.6563367 [120] 0.6562632 0.6561892 0.6561145 0.6560393 0.6559636 0.6558872 0.6558103 [127] 0.6557328 0.6556547 0.6555760 0.6554967 0.6554169 0.6553365 0.6552555 [134] 0.6551740 0.6550918 0.6550091 0.6549258 0.6548419 0.6547574 0.6546724 [141] 0.6545868 0.6545006 0.6544138 0.6543264 0.6542385 0.6541500 0.6540609 [148] 0.6539712 0.6538810 0.6537901 0.6536987 0.6536067 0.6535141 0.6534210 [155] 0.6533273 0.6532329 0.6531381 0.6530426 0.6529465 0.6528499 0.6527527 [162] 0.6526549 0.6525566 0.6524576 0.6523581 0.6522580 0.6521573 0.6520561 [169] 0.6519542 0.6518518 0.6517488 0.6516453 0.6515411 0.6514364 0.6513311 [176] 0.6512253 0.6511188 0.6510118 0.6509042 0.6507960 0.6506872 0.6505779 [183] 0.6504680 0.6503575 0.6502465 0.6501349 0.6500226 0.6499099 0.6497965 [190] 0.6496826 0.6495681 0.6494530 0.6493374 0.6492212 0.6491044 0.6489870 [197] 0.6488691 0.6487506 0.6486315 0.6485119 0.6483917 0.6482709 0.6481495 [204] 0.6480276 0.6479051 0.6477820 0.6476584 0.6475342 0.6474095 0.6472841 [211] 0.6471582 0.6470318 0.6469047 0.6467771 0.6466490 0.6465203 0.6463910 [218] 0.6462611 0.6461307 0.6459997 0.6458682 0.6457361 0.6456034 0.6454702 [225] 0.6453364 0.6452021 0.6450672 0.6449317 0.6447957 0.6446591 0.6445220 [232] 0.6443843 0.6442460 0.6441072 0.6439679 0.6438280 0.6436875 0.6435465 [239] 0.6434049 0.6432628 0.6431201 0.6429769 0.6428331 0.6426887 0.6425439 [246] 0.6423984 0.6422525 0.6421059 0.6419589 0.6418112 0.6416631 0.6415144 [253] 0.6413651 0.6412153 0.6410650 0.6409141 0.6407627 0.6406107 0.6404582 [260] 0.6403051 0.6401516 0.6399974 0.6398428 0.6396876 0.6395318 0.6393756 [267] 0.6392188 0.6390614 0.6389036 0.6387452 0.6385862 0.6384267 0.6382667 [274] 0.6381062 0.6379452 0.6377836 0.6376215 0.6374588 0.6372957 0.6371320 [281] 0.6369678 0.6368030 0.6366378 0.6364720 0.6363057 0.6361389 0.6359715 [288] 0.6358037 0.6356353 0.6354664 0.6352970 0.6351271 0.6349566 0.6347857 [295] 0.6346142 0.6344422 0.6342698 0.6340968 0.6339233 0.6337493 0.6335747 [302] 0.6333997 0.6332242 0.6330482 0.6328716 0.6326946 0.6325171 0.6323390 [309] 0.6321605 0.6319814 0.6318019 0.6316219 0.6314414 0.6312603 0.6310788 [316] 0.6308968 0.6307143 0.6305313 0.6303479 0.6301639 0.6299794 0.6297945 [323] 0.6296091 0.6294232 0.6292368 0.6290499 0.6288625 0.6286747 0.6284864 [330] 0.6282976 0.6281083 0.6279186 0.6277283 0.6275376 0.6273465 0.6271548 [337] 0.6269627 0.6267701 0.6265771 0.6263836 0.6261896 0.6259951 0.6258002 [344] 0.6256048 0.6254090 0.6252127 0.6250159 0.6248187 0.6246210 0.6244229 [351] 0.6242243 0.6240252 0.6238257 0.6236258 0.6234254 0.6232245 0.6230232 [358] 0.6228215 0.6226193 0.6224167 0.6222136 0.6220101 0.6218061 0.6216017 [365] 0.6213969 0.6211916 0.6209859 0.6207797 0.6205731 0.6203661 0.6201587 [372] 0.6199508 0.6197425 0.6195337 0.6193246 0.6191150 0.6189050 0.6186945 [379] 0.6184837 0.6182724 0.6180607 0.6178486 0.6176360 0.6174231 0.6172097 [386] 0.6169959 0.6167817 0.6165671 0.6163521 0.6161367 0.6159209 0.6157046 [393] 0.6154880 0.6152710 0.6150535 0.6148357 0.6146175 0.6143988 0.6141798 [400] 0.6139604 0.6137405 > mx [1] 0.6610375 > 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/17vy31226492075.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/20vez1226492075.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/30si81226492075.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/4amoj1226492075.tab") > > system("convert tmp/17vy31226492075.ps tmp/17vy31226492075.png") > system("convert tmp/20vez1226492075.ps tmp/20vez1226492075.png") > system("convert tmp/30si81226492075.ps tmp/30si81226492075.png") > > > proc.time() user system elapsed 1.891 0.845 2.003