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(2.1,2.2,2.2,2.7,3.1,3.2,3.1,3.1,2.8,3,2.8,2.7,3.2,3.1,3,2,1.7,1.2,1.4,1.3,1.3,1.1,0.9,1.2,0.9,1.3,1.4,1.5,1.1,1.6,1.5,1.6,1.7,1.6,1.7,1.6,1.6,1.3,1.1,1.6,1.9,1.6,1.7,1.6,1.4,2.1,1.9,1.7,1.8,2,2.5,2.1,2.1,2.3,2.4,2.4,2.3,1.7,2,2.3) > x <- c(2.2,2.3,2.1,2.8,3.1,2.9,2.6,2.7,2.3,2.3,2.1,2.2,2.9,2.6,2.7,1.8,1.3,0.9,1.3,1.3,1.3,1.3,1.1,1.4,1.2,1.7,1.8,1.5,1,1.6,1.5,1.8,1.8,1.6,1.9,1.7,1.6,1.3,1.1,1.9,2.6,2.3,2.4,2.2,2,2.9,2.6,2.3,2.3,2.6,3.1,2.8,2.5,2.9,3.1,3.1,3.2,2.5,2.6,2.9) > #'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.7016173 0.7022180 0.7028171 0.7034146 0.7040104 0.7046045 0.7051969 [8] 0.7057876 0.7063766 0.7069638 0.7075494 0.7081332 0.7087152 0.7092955 [15] 0.7098740 0.7104508 0.7110257 0.7115989 0.7121702 0.7127397 0.7133074 [22] 0.7138733 0.7144373 0.7149994 0.7155597 0.7161181 0.7166747 0.7172293 [29] 0.7177820 0.7183329 0.7188818 0.7194287 0.7199738 0.7205169 0.7210580 [36] 0.7215972 0.7221344 0.7226696 0.7232028 0.7237340 0.7242632 0.7247904 [43] 0.7253156 0.7258388 0.7263599 0.7268790 0.7273960 0.7279109 0.7284238 [50] 0.7289346 0.7294433 0.7299499 0.7304544 0.7309568 0.7314571 0.7319552 [57] 0.7324512 0.7329451 0.7334368 0.7339264 0.7344138 0.7348991 0.7353821 [64] 0.7358630 0.7363417 0.7368182 0.7372925 0.7377646 0.7382344 0.7387021 [71] 0.7391675 0.7396307 0.7400916 0.7405503 0.7410067 0.7414609 0.7419128 [78] 0.7423624 0.7428098 0.7432548 0.7436976 0.7441381 0.7445762 0.7450121 [85] 0.7454457 0.7458769 0.7463058 0.7467324 0.7471566 0.7475785 0.7479981 [92] 0.7484153 0.7488301 0.7492426 0.7496528 0.7500605 0.7504659 0.7508689 [99] 0.7512695 0.7516678 0.7520636 0.7524571 0.7528481 0.7532368 0.7536230 [106] 0.7540069 0.7543883 0.7547673 0.7551438 0.7555180 0.7558897 0.7562590 [113] 0.7566258 0.7569903 0.7573522 0.7577117 0.7580688 0.7584234 0.7587756 [120] 0.7591253 0.7594725 0.7598173 0.7601596 0.7604995 0.7608368 0.7611717 [127] 0.7615041 0.7618341 0.7621615 0.7624865 0.7628090 0.7631290 0.7634466 [134] 0.7637616 0.7640741 0.7643842 0.7646917 0.7649968 0.7652993 0.7655994 [141] 0.7658969 0.7661920 0.7664846 0.7667746 0.7670621 0.7673472 0.7676297 [148] 0.7679098 0.7681873 0.7684623 0.7687348 0.7690048 0.7692723 0.7695372 [155] 0.7697997 0.7700597 0.7703171 0.7705720 0.7708245 0.7710744 0.7713218 [162] 0.7715667 0.7718091 0.7720490 0.7722863 0.7725212 0.7727536 0.7729834 [169] 0.7732108 0.7734356 0.7736579 0.7738778 0.7740951 0.7743100 0.7745223 [176] 0.7747321 0.7749395 0.7751443 0.7753467 0.7755466 0.7757439 0.7759388 [183] 0.7761312 0.7763211 0.7765086 0.7766935 0.7768760 0.7770560 0.7772335 [190] 0.7774086 0.7775812 0.7777513 0.7779189 0.7780841 0.7782468 0.7784071 [197] 0.7785649 0.7787203 0.7788732 0.7790236 0.7791717 0.7793172 0.7794604 [204] 0.7796011 0.7797393 0.7798752 0.7800086 0.7801396 0.7802682 0.7803943 [211] 0.7805181 0.7806394 0.7807584 0.7808749 0.7809890 0.7811008 0.7812101 [218] 0.7813171 0.7814217 0.7815239 0.7816237 0.7817212 0.7818163 0.7819090 [225] 0.7819994 0.7820874 0.7821731 0.7822564 0.7823374 0.7824160 0.7824923 [232] 0.7825663 0.7826380 0.7827074 0.7827744 0.7828391 0.7829016 0.7829617 [239] 0.7830195 0.7830751 0.7831283 0.7831793 0.7832280 0.7832744 0.7833186 [246] 0.7833605 0.7834002 0.7834376 0.7834728 0.7835057 0.7835364 0.7835649 [253] 0.7835911 0.7836151 0.7836370 0.7836566 0.7836740 0.7836892 0.7837023 [260] 0.7837131 0.7837218 0.7837283 0.7837326 0.7837348 0.7837348 0.7837327 [267] 0.7837285 0.7837221 0.7837135 0.7837029 0.7836901 0.7836752 0.7836582 [274] 0.7836391 0.7836180 0.7835947 0.7835694 0.7835419 0.7835124 0.7834809 [281] 0.7834473 0.7834116 0.7833739 0.7833342 0.7832924 0.7832486 0.7832028 [288] 0.7831550 0.7831052 0.7830533 0.7829995 0.7829437 0.7828859 0.7828262 [295] 0.7827645 0.7827008 0.7826352 0.7825676 0.7824981 0.7824267 0.7823533 [302] 0.7822780 0.7822009 0.7821218 0.7820408 0.7819579 0.7818731 0.7817865 [309] 0.7816980 0.7816076 0.7815154 0.7814213 0.7813254 0.7812276 0.7811280 [316] 0.7810266 0.7809234 0.7808184 0.7807116 0.7806029 0.7804925 0.7803803 [323] 0.7802664 0.7801507 0.7800332 0.7799139 0.7797930 0.7796703 0.7795458 [330] 0.7794197 0.7792918 0.7791622 0.7790309 0.7788979 0.7787633 0.7786269 [337] 0.7784889 0.7783492 0.7782079 0.7780649 0.7779202 0.7777740 0.7776260 [344] 0.7774765 0.7773254 0.7771726 0.7770183 0.7768623 0.7767048 0.7765457 [351] 0.7763850 0.7762228 0.7760590 0.7758936 0.7757267 0.7755583 0.7753883 [358] 0.7752168 0.7750439 0.7748693 0.7746933 0.7745158 0.7743369 0.7741564 [365] 0.7739745 0.7737911 0.7736062 0.7734199 0.7732322 0.7730430 0.7728524 [372] 0.7726604 0.7724669 0.7722721 0.7720758 0.7718782 0.7716791 0.7714787 [379] 0.7712769 0.7710738 0.7708693 0.7706634 0.7704563 0.7702477 0.7700379 [386] 0.7698267 0.7696142 0.7694004 0.7691853 0.7689689 0.7687512 0.7685322 [393] 0.7683120 0.7680905 0.7678677 0.7676437 0.7674184 0.7671919 0.7669642 [400] 0.7667353 0.7665051 > mx [1] 0.7837348 > mxli [1] 0.64 > 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/16f7a1226393277.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/20oys1226393277.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/3gmhc1226393277.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/4c03b1226393277.tab") > > system("convert tmp/16f7a1226393277.ps tmp/16f7a1226393277.png") > system("convert tmp/20oys1226393277.ps tmp/20oys1226393277.png") > system("convert tmp/3gmhc1226393277.ps tmp/3gmhc1226393277.png") > > > proc.time() user system elapsed 1.005 0.533 1.331