R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(0.800641,0.769764,0.745823,0.762253,0.768403,0.757518,0.772917,0.787774,0.82203,0.830772,0.813537,0.815927,0.832293,0.848464,0.843455,0.826241,0.837661,0.831947,0.81493,0.783085,0.790514,0.788395,0.780579,0.785731,0.792959,0.776337,0.75683,0.76929,0.764877,0.755173,0.739864,0.740138,0.745212,0.729076,0.734107,0.719632,0.702889,0.681013,0.686342,0.67944,0.678058,0.644039,0.63488,0.642797,0.642963,0.634115,0.66778,0.695894,0.750638,0.785423,0.74355,0.755344,0.782167,0.766284,0.75815,0.732601,0.71347,0.709824,0.700869,0.700869) > x <- c(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.3) > #'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.7078027 0.7078890 0.7079753 0.7080613 0.7081472 0.7082330 0.7083186 [8] 0.7084040 0.7084893 0.7085745 0.7086595 0.7087443 0.7088290 0.7089135 [15] 0.7089978 0.7090820 0.7091661 0.7092500 0.7093337 0.7094173 0.7095008 [22] 0.7095840 0.7096672 0.7097501 0.7098330 0.7099156 0.7099981 0.7100805 [29] 0.7101627 0.7102447 0.7103266 0.7104083 0.7104899 0.7105713 0.7106526 [36] 0.7107337 0.7108147 0.7108955 0.7109761 0.7110566 0.7111370 0.7112171 [43] 0.7112972 0.7113770 0.7114568 0.7115363 0.7116157 0.7116950 0.7117741 [50] 0.7118530 0.7119318 0.7120105 0.7120889 0.7121673 0.7122454 0.7123235 [57] 0.7124013 0.7124790 0.7125566 0.7126340 0.7127112 0.7127883 0.7128652 [64] 0.7129420 0.7130186 0.7130951 0.7131714 0.7132476 0.7133236 0.7133994 [71] 0.7134751 0.7135507 0.7136261 0.7137013 0.7137764 0.7138513 0.7139261 [78] 0.7140007 0.7140751 0.7141495 0.7142236 0.7142976 0.7143714 0.7144451 [85] 0.7145187 0.7145920 0.7146653 0.7147383 0.7148113 0.7148840 0.7149566 [92] 0.7150291 0.7151014 0.7151735 0.7152455 0.7153173 0.7153890 0.7154606 [99] 0.7155319 0.7156032 0.7156742 0.7157451 0.7158159 0.7158865 0.7159569 [106] 0.7160272 0.7160974 0.7161674 0.7162372 0.7163069 0.7163764 0.7164458 [113] 0.7165150 0.7165841 0.7166530 0.7167217 0.7167903 0.7168588 0.7169271 [120] 0.7169952 0.7170632 0.7171311 0.7171987 0.7172663 0.7173336 0.7174009 [127] 0.7174679 0.7175348 0.7176016 0.7176682 0.7177347 0.7178010 0.7178671 [134] 0.7179331 0.7179990 0.7180647 0.7181302 0.7181956 0.7182608 0.7183259 [141] 0.7183908 0.7184556 0.7185202 0.7185847 0.7186490 0.7187132 0.7187772 [148] 0.7188410 0.7189047 0.7189683 0.7190317 0.7190949 0.7191580 0.7192210 [155] 0.7192838 0.7193464 0.7194089 0.7194712 0.7195334 0.7195954 0.7196573 [162] 0.7197190 0.7197806 0.7198420 0.7199033 0.7199644 0.7200254 0.7200862 [169] 0.7201469 0.7202074 0.7202677 0.7203280 0.7203880 0.7204479 0.7205077 [176] 0.7205673 0.7206267 0.7206860 0.7207452 0.7208042 0.7208630 0.7209217 [183] 0.7209803 0.7210387 0.7210969 0.7211550 0.7212129 0.7212707 0.7213284 [190] 0.7213859 0.7214432 0.7215004 0.7215574 0.7216143 0.7216711 0.7217276 [197] 0.7217841 0.7218404 0.7218965 0.7219525 0.7220083 0.7220640 0.7221195 [204] 0.7221749 0.7222302 0.7222853 0.7223402 0.7223950 0.7224496 0.7225041 [211] 0.7225584 0.7226126 0.7226667 0.7227206 0.7227743 0.7228279 0.7228813 [218] 0.7229346 0.7229878 0.7230408 0.7230936 0.7231463 0.7231989 0.7232513 [225] 0.7233035 0.7233556 0.7234076 0.7234594 0.7235111 0.7235626 0.7236139 [232] 0.7236652 0.7237162 0.7237671 0.7238179 0.7238685 0.7239190 0.7239693 [239] 0.7240195 0.7240695 0.7241194 0.7241692 0.7242188 0.7242682 0.7243175 [246] 0.7243666 0.7244156 0.7244645 0.7245132 0.7245618 0.7246102 0.7246584 [253] 0.7247065 0.7247545 0.7248023 0.7248500 0.7248976 0.7249449 0.7249922 [260] 0.7250393 0.7250862 0.7251330 0.7251797 0.7252262 0.7252725 0.7253188 [267] 0.7253648 0.7254108 0.7254565 0.7255022 0.7255477 0.7255930 0.7256382 [274] 0.7256833 0.7257282 0.7257729 0.7258175 0.7258620 0.7259063 0.7259505 [281] 0.7259946 0.7260385 0.7260822 0.7261258 0.7261693 0.7262126 0.7262558 [288] 0.7262988 0.7263417 0.7263844 0.7264270 0.7264694 0.7265118 0.7265539 [295] 0.7265959 0.7266378 0.7266795 0.7267211 0.7267626 0.7268039 0.7268450 [302] 0.7268861 0.7269269 0.7269677 0.7270082 0.7270487 0.7270890 0.7271292 [309] 0.7271692 0.7272090 0.7272488 0.7272884 0.7273278 0.7273671 0.7274063 [316] 0.7274453 0.7274842 0.7275229 0.7275615 0.7276000 0.7276383 0.7276765 [323] 0.7277145 0.7277524 0.7277901 0.7278277 0.7278652 0.7279025 0.7279397 [330] 0.7279767 0.7280137 0.7280504 0.7280870 0.7281235 0.7281599 0.7281961 [337] 0.7282321 0.7282680 0.7283038 0.7283395 0.7283750 0.7284103 0.7284455 [344] 0.7284806 0.7285156 0.7285504 0.7285850 0.7286196 0.7286539 0.7286882 [351] 0.7287223 0.7287563 0.7287901 0.7288238 0.7288573 0.7288908 0.7289240 [358] 0.7289572 0.7289902 0.7290230 0.7290558 0.7290883 0.7291208 0.7291531 [365] 0.7291853 0.7292173 0.7292492 0.7292810 0.7293126 0.7293441 0.7293754 [372] 0.7294066 0.7294377 0.7294686 0.7294994 0.7295301 0.7295606 0.7295910 [379] 0.7296213 0.7296514 0.7296814 0.7297112 0.7297409 0.7297705 0.7298000 [386] 0.7298293 0.7298584 0.7298875 0.7299164 0.7299451 0.7299737 0.7300022 [393] 0.7300306 0.7300588 0.7300869 0.7301149 0.7301427 0.7301704 0.7301979 [400] 0.7302253 0.7302526 > mx [1] 0.7302526 > 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/1rk5c1258148632.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/218xw1258148632.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/3g8u81258148632.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/4x1jv1258148632.tab") > > system("convert tmp/1rk5c1258148632.ps tmp/1rk5c1258148632.png") > system("convert tmp/218xw1258148632.ps tmp/218xw1258148632.png") > system("convert tmp/3g8u81258148632.ps tmp/3g8u81258148632.png") > > > proc.time() user system elapsed 0.748 0.516 0.950