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(2894.3,2838.1,3137.7,2703.7,2623.6,2691.1,2577.9,2430.5,2871,2922.5,2810.8,3070.3,2790,2821,3383.6,3038.4,2877.3,3283.7,2927.3,2952.5,3328.9,3467.3,3355.6,3707,3275.6,3466.5,4054.3,3708.5,3339,3559.8,3189.2,3620.7,3915.4,3804.3,4391.6,4975.9,4478.7,4455.8,5661.8,4062.8,4257.7,4114.2,3793.8,4170,4004.9,4129.7,4116,4133.8,4081.2,3854.1,4239.8,3718.5,4183.1,4336.1,4299.2,4285.3,4676.7,4980.6,5207.4,5221.7) > x <- c(2333.3,2282.2,2458.2,2345.5,2065.2,2332.5,2077.5,1691.4,2381.9,2526,2212.1,2459.9,2178.8,2318.2,2661.8,2407.9,2040.6,2601.6,2106.3,1829.9,2546.1,2363,2435.8,2668,2316.9,2324.2,2610.8,2413.2,2345.2,2590.8,2132.1,1990.7,2641.7,2437.1,2649.2,2819.4,2405.6,2451.3,2878.5,2534.1,2670.6,2909.7,2261.8,2135.3,2870.4,2803.2,2775.1,2633.7,2930.6,2779.7,3039.2,2752.7,2743.1,2914,2711.9,2295.8,2840.6,3230.5,2761.1,2769.6) > #'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.6608763 0.6611527 0.6614285 0.6617037 0.6619784 0.6622524 0.6625258 [8] 0.6627986 0.6630708 0.6633424 0.6636134 0.6638838 0.6641536 0.6644228 [15] 0.6646914 0.6649594 0.6652267 0.6654935 0.6657597 0.6660252 0.6662901 [22] 0.6665544 0.6668182 0.6670812 0.6673437 0.6676056 0.6678668 0.6681275 [29] 0.6683875 0.6686469 0.6689057 0.6691638 0.6694214 0.6696783 0.6699346 [36] 0.6701903 0.6704453 0.6706998 0.6709536 0.6712067 0.6714593 0.6717112 [43] 0.6719625 0.6722132 0.6724633 0.6727127 0.6729615 0.6732096 0.6734572 [50] 0.6737041 0.6739504 0.6741960 0.6744410 0.6746854 0.6749291 0.6751722 [57] 0.6754147 0.6756565 0.6758977 0.6761383 0.6763782 0.6766175 0.6768561 [64] 0.6770941 0.6773315 0.6775682 0.6778043 0.6780398 0.6782746 0.6785088 [71] 0.6787423 0.6789752 0.6792074 0.6794390 0.6796700 0.6799003 0.6801299 [78] 0.6803589 0.6805873 0.6808150 0.6810421 0.6812686 0.6814944 0.6817195 [85] 0.6819440 0.6821678 0.6823910 0.6826136 0.6828355 0.6830567 0.6832773 [92] 0.6834973 0.6837166 0.6839352 0.6841532 0.6843705 0.6845872 0.6848033 [99] 0.6850186 0.6852334 0.6854475 0.6856609 0.6858737 0.6860858 0.6862972 [106] 0.6865080 0.6867182 0.6869277 0.6871365 0.6873447 0.6875523 0.6877591 [113] 0.6879654 0.6881709 0.6883758 0.6885801 0.6887837 0.6889866 0.6891889 [120] 0.6893905 0.6895915 0.6897918 0.6899914 0.6901904 0.6903887 0.6905864 [127] 0.6907834 0.6909798 0.6911755 0.6913705 0.6915649 0.6917586 0.6919517 [134] 0.6921441 0.6923358 0.6925269 0.6927173 0.6929071 0.6930962 0.6932846 [141] 0.6934724 0.6936595 0.6938459 0.6940317 0.6942169 0.6944014 0.6945852 [148] 0.6947683 0.6949508 0.6951327 0.6953138 0.6954943 0.6956742 0.6958534 [155] 0.6960319 0.6962098 0.6963870 0.6965635 0.6967394 0.6969146 0.6970892 [162] 0.6972631 0.6974364 0.6976089 0.6977809 0.6979521 0.6981227 0.6982927 [169] 0.6984619 0.6986306 0.6987985 0.6989658 0.6991325 0.6992984 0.6994638 [176] 0.6996284 0.6997924 0.6999558 0.7001184 0.7002805 0.7004418 0.7006025 [183] 0.7007626 0.7009219 0.7010807 0.7012387 0.7013961 0.7015529 0.7017090 [190] 0.7018644 0.7020192 0.7021733 0.7023267 0.7024795 0.7026317 0.7027832 [197] 0.7029340 0.7030842 0.7032337 0.7033825 0.7035307 0.7036783 0.7038252 [204] 0.7039714 0.7041170 0.7042619 0.7044062 0.7045498 0.7046927 0.7048350 [211] 0.7049767 0.7051177 0.7052580 0.7053977 0.7055367 0.7056751 0.7058128 [218] 0.7059499 0.7060863 0.7062220 0.7063572 0.7064916 0.7066254 0.7067586 [225] 0.7068911 0.7070230 0.7071542 0.7072847 0.7074146 0.7075439 0.7076725 [232] 0.7078004 0.7079277 0.7080544 0.7081804 0.7083058 0.7084305 0.7085546 [239] 0.7086780 0.7088008 0.7089229 0.7090444 0.7091652 0.7092854 0.7094049 [246] 0.7095238 0.7096421 0.7097597 0.7098767 0.7099930 0.7101087 0.7102237 [253] 0.7103381 0.7104519 0.7105650 0.7106775 0.7107893 0.7109005 0.7110110 [260] 0.7111209 0.7112302 0.7113388 0.7114468 0.7115542 0.7116609 0.7117670 [267] 0.7118724 0.7119772 0.7120814 0.7121849 0.7122878 0.7123901 0.7124917 [274] 0.7125927 0.7126930 0.7127927 0.7128918 0.7129903 0.7130881 0.7131853 [281] 0.7132818 0.7133778 0.7134731 0.7135677 0.7136618 0.7137552 0.7138479 [288] 0.7139401 0.7140316 0.7141225 0.7142128 0.7143024 0.7143914 0.7144798 [295] 0.7145675 0.7146547 0.7147412 0.7148271 0.7149123 0.7149970 0.7150810 [302] 0.7151644 0.7152471 0.7153293 0.7154108 0.7154917 0.7155720 0.7156516 [309] 0.7157307 0.7158091 0.7158869 0.7159641 0.7160407 0.7161166 0.7161920 [316] 0.7162667 0.7163408 0.7164143 0.7164871 0.7165594 0.7166310 0.7167021 [323] 0.7167725 0.7168423 0.7169115 0.7169801 0.7170480 0.7171154 0.7171822 [330] 0.7172483 0.7173138 0.7173788 0.7174431 0.7175068 0.7175699 0.7176324 [337] 0.7176943 0.7177556 0.7178162 0.7178763 0.7179358 0.7179947 0.7180529 [344] 0.7181106 0.7181677 0.7182241 0.7182800 0.7183352 0.7183899 0.7184439 [351] 0.7184974 0.7185503 0.7186025 0.7186542 0.7187053 0.7187558 0.7188056 [358] 0.7188549 0.7189036 0.7189517 0.7189992 0.7190461 0.7190924 0.7191382 [365] 0.7191833 0.7192278 0.7192718 0.7193151 0.7193579 0.7194001 0.7194417 [372] 0.7194827 0.7195231 0.7195630 0.7196022 0.7196409 0.7196790 0.7197165 [379] 0.7197534 0.7197897 0.7198254 0.7198606 0.7198952 0.7199292 0.7199626 [386] 0.7199954 0.7200277 0.7200594 0.7200905 0.7201210 0.7201509 0.7201803 [393] 0.7202091 0.7202373 0.7202650 0.7202920 0.7203185 0.7203445 0.7203698 [400] 0.7203946 0.7204188 > mx [1] 0.7204188 > 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/freestat/rcomp/tmp/1zhkw1226411429.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/freestat/rcomp/tmp/25sv31226411429.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/freestat/rcomp/tmp/3vabj1226411429.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/47k8q1226411429.tab") > > system("convert tmp/1zhkw1226411429.ps tmp/1zhkw1226411429.png") > system("convert tmp/25sv31226411429.ps tmp/25sv31226411429.png") > system("convert tmp/3vabj1226411429.ps tmp/3vabj1226411429.png") > > > proc.time() user system elapsed 1.258 0.843 1.754