R version 2.8.1 (2008-12-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(99,98.6,98.6,98.5,98.9,99.4,99.8,99.9,100,100.1,100.1,100.2,100.3,100,99.9,99.4,99.8,99.6,100,99.9,100.3,100.6,100.7,100.8,100.8,100.6,101.1,101.1,100.9,101.1,101.2,101.4,101.9,102.1,102.1,103,103.4,103.2,103.1,103,103.7,103.4,103.5,103.8,104,104.2,104.4,104.4,104.9,105.3,105.2,105.4,105.4,105.5,105.7,105.6,105.8,105.4,105.5,105.8,106.1,106,105.5,105.4,106,106.1,106.4,106,106,106,106,106.1,106.1) > x <- c(8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9,7.7,8,8,7.7,7.3,7.4,8.1,8.3,8.2) > #'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.6579919 -0.6581418 -0.6582914 -0.6584408 -0.6585900 -0.6587390 [7] -0.6588877 -0.6590362 -0.6591845 -0.6593325 -0.6594804 -0.6596280 [13] -0.6597753 -0.6599224 -0.6600694 -0.6602160 -0.6603625 -0.6605087 [19] -0.6606547 -0.6608004 -0.6609460 -0.6610913 -0.6612363 -0.6613812 [25] -0.6615258 -0.6616702 -0.6618143 -0.6619582 -0.6621019 -0.6622453 [31] -0.6623886 -0.6625316 -0.6626743 -0.6628168 -0.6629591 -0.6631012 [37] -0.6632430 -0.6633846 -0.6635260 -0.6636671 -0.6638080 -0.6639487 [43] -0.6640891 -0.6642293 -0.6643692 -0.6645090 -0.6646484 -0.6647877 [49] -0.6649267 -0.6650655 -0.6652041 -0.6653424 -0.6654805 -0.6656183 [55] -0.6657559 -0.6658933 -0.6660304 -0.6661673 -0.6663040 -0.6664404 [61] -0.6665766 -0.6667126 -0.6668483 -0.6669838 -0.6671191 -0.6672541 [67] -0.6673888 -0.6675234 -0.6676577 -0.6677917 -0.6679256 -0.6680591 [73] -0.6681925 -0.6683256 -0.6684585 -0.6685911 -0.6687235 -0.6688557 [79] -0.6689876 -0.6691192 -0.6692507 -0.6693819 -0.6695128 -0.6696435 [85] -0.6697740 -0.6699043 -0.6700343 -0.6701640 -0.6702935 -0.6704228 [91] -0.6705518 -0.6706806 -0.6708092 -0.6709375 -0.6710656 -0.6711934 [97] -0.6713210 -0.6714483 -0.6715754 -0.6717023 -0.6718289 -0.6719553 [103] -0.6720814 -0.6722073 -0.6723330 -0.6724584 -0.6725836 -0.6727085 [109] -0.6728332 -0.6729576 -0.6730818 -0.6732057 -0.6733294 -0.6734529 [115] -0.6735761 -0.6736991 -0.6738218 -0.6739443 -0.6740666 -0.6741886 [121] -0.6743103 -0.6744318 -0.6745531 -0.6746741 -0.6747949 -0.6749154 [127] -0.6750357 -0.6751557 -0.6752755 -0.6753951 -0.6755144 -0.6756334 [133] -0.6757522 -0.6758708 -0.6759891 -0.6761072 -0.6762250 -0.6763426 [139] -0.6764599 -0.6765770 -0.6766938 -0.6768104 -0.6769268 -0.6770429 [145] -0.6771587 -0.6772743 -0.6773897 -0.6775048 -0.6776196 -0.6777342 [151] -0.6778486 -0.6779627 -0.6780766 -0.6781902 -0.6783036 -0.6784167 [157] -0.6785296 -0.6786422 -0.6787546 -0.6788667 -0.6789786 -0.6790902 [163] -0.6792016 -0.6793127 -0.6794236 -0.6795342 -0.6796446 -0.6797548 [169] -0.6798646 -0.6799743 -0.6800837 -0.6801928 -0.6803017 -0.6804103 [175] -0.6805187 -0.6806268 -0.6807347 -0.6808423 -0.6809497 -0.6810569 [181] -0.6811637 -0.6812704 -0.6813767 -0.6814829 -0.6815887 -0.6816944 [187] -0.6817997 -0.6819049 -0.6820097 -0.6821144 -0.6822187 -0.6823228 [193] -0.6824267 -0.6825303 -0.6826337 -0.6827368 -0.6828396 -0.6829423 [199] -0.6830446 -0.6831467 -0.6832485 -0.6833501 -0.6834515 -0.6835526 [205] -0.6836534 -0.6837540 -0.6838543 -0.6839544 -0.6840542 -0.6841538 [211] -0.6842531 -0.6843522 -0.6844510 -0.6845496 -0.6846479 -0.6847459 [217] -0.6848437 -0.6849412 -0.6850385 -0.6851356 -0.6852324 -0.6853289 [223] -0.6854252 -0.6855212 -0.6856169 -0.6857125 -0.6858077 -0.6859027 [229] -0.6859975 -0.6860920 -0.6861862 -0.6862802 -0.6863739 -0.6864674 [235] -0.6865606 -0.6866536 -0.6867463 -0.6868387 -0.6869309 -0.6870229 [241] -0.6871146 -0.6872060 -0.6872972 -0.6873881 -0.6874788 -0.6875692 [247] -0.6876593 -0.6877492 -0.6878389 -0.6879283 -0.6880174 -0.6881063 [253] -0.6881949 -0.6882833 -0.6883714 -0.6884592 -0.6885468 -0.6886342 [259] -0.6887213 -0.6888081 -0.6888947 -0.6889810 -0.6890670 -0.6891528 [265] -0.6892384 -0.6893237 -0.6894087 -0.6894935 -0.6895780 -0.6896623 [271] -0.6897463 -0.6898300 -0.6899135 -0.6899968 -0.6900797 -0.6901625 [277] -0.6902449 -0.6903271 -0.6904091 -0.6904908 -0.6905722 -0.6906534 [283] -0.6907343 -0.6908150 -0.6908954 -0.6909755 -0.6910554 -0.6911351 [289] -0.6912144 -0.6912936 -0.6913724 -0.6914510 -0.6915294 -0.6916075 [295] -0.6916853 -0.6917629 -0.6918402 -0.6919172 -0.6919940 -0.6920706 [301] -0.6921469 -0.6922229 -0.6922986 -0.6923742 -0.6924494 -0.6925244 [307] -0.6925991 -0.6926736 -0.6927478 -0.6928218 -0.6928955 -0.6929689 [313] -0.6930421 -0.6931150 -0.6931877 -0.6932601 -0.6933323 -0.6934042 [319] -0.6934758 -0.6935472 -0.6936183 -0.6936892 -0.6937598 -0.6938301 [325] -0.6939002 -0.6939700 -0.6940396 -0.6941089 -0.6941779 -0.6942467 [331] -0.6943152 -0.6943835 -0.6944515 -0.6945193 -0.6945868 -0.6946540 [337] -0.6947210 -0.6947877 -0.6948542 -0.6949204 -0.6949863 -0.6950520 [343] -0.6951174 -0.6951826 -0.6952475 -0.6953121 -0.6953765 -0.6954407 [349] -0.6955045 -0.6955681 -0.6956315 -0.6956946 -0.6957574 -0.6958200 [355] -0.6958823 -0.6959444 -0.6960062 -0.6960677 -0.6961290 -0.6961900 [361] -0.6962508 -0.6963113 -0.6963715 -0.6964315 -0.6964912 -0.6965507 [367] -0.6966099 -0.6966688 -0.6967275 -0.6967859 -0.6968441 -0.6969020 [373] -0.6969597 -0.6970171 -0.6970742 -0.6971311 -0.6971877 -0.6972440 [379] -0.6973001 -0.6973560 -0.6974115 -0.6974669 -0.6975219 -0.6975767 [385] -0.6976313 -0.6976855 -0.6977396 -0.6977933 -0.6978468 -0.6979001 [391] -0.6979531 -0.6980058 -0.6980582 -0.6981105 -0.6981624 -0.6982141 [397] -0.6982655 -0.6983167 -0.6983676 -0.6984183 -0.6984686 > mx [1] 0.6984686 > 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/rcomp/tmp/1ashk1257600747.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/rcomp/tmp/28fxf1257600747.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/rcomp/tmp/3e4th1257600747.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/4b3tu1257600747.tab") > > system("convert tmp/1ashk1257600747.ps tmp/1ashk1257600747.png") > system("convert tmp/28fxf1257600747.ps tmp/28fxf1257600747.png") > system("convert tmp/3e4th1257600747.ps tmp/3e4th1257600747.png") > > > proc.time() user system elapsed 0.920 0.760 1.283