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(3.2,1.9,0,0.6,0.2,0.9,2.4,4.7,9.4,12.5,15.8,18.2,16.8,17.3,19.3,17.9,20.2,18.7,20.1,18.2,18.4,18.2,18.9,19.9,21.3,20,19.5,19.6,20.9,21,19.9,19.6,20.9,21.7,22.9,21.5,21.3,23.5,21.6,24.5,22.2,23.5,20.9,20.7,18.1,17.1,14.8,13.8,15.2,16,17.6,15,15,16.3,19.4,21.3,20.5,21.1,21.6,22.6) > x <- c(1.74,1.75,1.83,2.09,2.12,2.29,2.4,2.82,3.18,4,4.8,5.28,5.37,5.27,5.33,5.23,5.08,5.11,5.1,4.97,5,5.2,4.9,4.82,5.04,4.82,4.77,4.79,4.58,4.59,4.57,4.35,4.27,4.39,3.97,3.84,3.73,3.58,3.45,3.44,3.25,3.25,3.02,2.87,2.92,2.95,2.75,2.7,2.75,2.72,2.71,2.76,2.68,2.78,2.86,2.75,2.87,2.91,2.79,2.77) > #'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.7469868 0.7466286 0.7462669 0.7459017 0.7455329 0.7451607 0.7447850 [8] 0.7444058 0.7440230 0.7436368 0.7432471 0.7428539 0.7424572 0.7420571 [15] 0.7416534 0.7412463 0.7408357 0.7404217 0.7400042 0.7395832 0.7391588 [22] 0.7387309 0.7382996 0.7378649 0.7374267 0.7369851 0.7365401 0.7360917 [29] 0.7356398 0.7351846 0.7347260 0.7342640 0.7337986 0.7333298 0.7328577 [36] 0.7323822 0.7319034 0.7314213 0.7309358 0.7304470 0.7299548 0.7294594 [43] 0.7289607 0.7284587 0.7279534 0.7274448 0.7269330 0.7264179 0.7258996 [50] 0.7253781 0.7248533 0.7243253 0.7237942 0.7232598 0.7227223 0.7221816 [57] 0.7216378 0.7210908 0.7205407 0.7199874 0.7194311 0.7188717 0.7183092 [64] 0.7177436 0.7171749 0.7166033 0.7160286 0.7154508 0.7148701 0.7142864 [71] 0.7136997 0.7131101 0.7125174 0.7119219 0.7113235 0.7107221 0.7101178 [78] 0.7095107 0.7089007 0.7082879 0.7076722 0.7070537 0.7064324 0.7058083 [85] 0.7051815 0.7045519 0.7039195 0.7032845 0.7026467 0.7020062 0.7013631 [92] 0.7007173 0.7000689 0.6994178 0.6987641 0.6981079 0.6974490 0.6967876 [99] 0.6961237 0.6954573 0.6947883 0.6941169 0.6934429 0.6927666 0.6920878 [106] 0.6914066 0.6907230 0.6900370 0.6893486 0.6886579 0.6879649 0.6872696 [113] 0.6865719 0.6858721 0.6851699 0.6844656 0.6837590 0.6830502 0.6823393 [120] 0.6816262 0.6809109 0.6801936 0.6794741 0.6787526 0.6780290 0.6773033 [127] 0.6765757 0.6758460 0.6751144 0.6743808 0.6736453 0.6729078 0.6721685 [134] 0.6714272 0.6706841 0.6699391 0.6691924 0.6684438 0.6676934 0.6669413 [141] 0.6661875 0.6654319 0.6646746 0.6639156 0.6631550 0.6623927 0.6616288 [148] 0.6608633 0.6600962 0.6593276 0.6585574 0.6577857 0.6570125 0.6562379 [155] 0.6554617 0.6546841 0.6539051 0.6531248 0.6523430 0.6515598 0.6507754 [162] 0.6499896 0.6492025 0.6484142 0.6476245 0.6468337 0.6460416 0.6452483 [169] 0.6444539 0.6436583 0.6428616 0.6420637 0.6412648 0.6404648 0.6396637 [176] 0.6388616 0.6380584 0.6372543 0.6364492 0.6356432 0.6348362 0.6340283 [183] 0.6332195 0.6324098 0.6315992 0.6307879 0.6299757 0.6291627 0.6283489 [190] 0.6275344 0.6267191 0.6259031 0.6250864 0.6242690 0.6234510 0.6226323 [197] 0.6218130 0.6209930 0.6201725 0.6193514 0.6185298 0.6177076 0.6168850 [204] 0.6160618 0.6152381 0.6144140 0.6135895 0.6127645 0.6119391 0.6111134 [211] 0.6102872 0.6094608 0.6086340 0.6078068 0.6069794 0.6061517 0.6053238 [218] 0.6044956 0.6036672 0.6028385 0.6020097 0.6011807 0.6003516 0.5995223 [225] 0.5986928 0.5978633 0.5970337 0.5962040 0.5953743 0.5945445 0.5937147 [232] 0.5928849 0.5920551 0.5912253 0.5903956 0.5895659 0.5887363 0.5879068 [239] 0.5870774 0.5862481 0.5854189 0.5845899 0.5837611 0.5829324 0.5821039 [246] 0.5812757 0.5804476 0.5796199 0.5787923 0.5779651 0.5771381 0.5763114 [253] 0.5754850 0.5746590 0.5738333 0.5730079 0.5721830 0.5713584 0.5705342 [260] 0.5697104 0.5688870 0.5680641 0.5672416 0.5664196 0.5655981 0.5647770 [267] 0.5639565 0.5631364 0.5623169 0.5614980 0.5606796 0.5598617 0.5590444 [274] 0.5582278 0.5574117 0.5565962 0.5557814 0.5549672 0.5541536 0.5533407 [281] 0.5525285 0.5517169 0.5509061 0.5500959 0.5492865 0.5484778 0.5476698 [288] 0.5468626 0.5460561 0.5452504 0.5444455 0.5436414 0.5428381 0.5420355 [295] 0.5412338 0.5404330 0.5396330 0.5388338 0.5380355 0.5372380 0.5364414 [302] 0.5356457 0.5348510 0.5340571 0.5332641 0.5324720 0.5316809 0.5308908 [309] 0.5301015 0.5293133 0.5285260 0.5277396 0.5269543 0.5261699 0.5253866 [316] 0.5246042 0.5238229 0.5230426 0.5222633 0.5214850 0.5207078 0.5199317 [323] 0.5191566 0.5183826 0.5176096 0.5168378 0.5160670 0.5152973 0.5145287 [330] 0.5137612 0.5129949 0.5122296 0.5114655 0.5107025 0.5099407 0.5091800 [337] 0.5084204 0.5076620 0.5069048 0.5061488 0.5053939 0.5046402 0.5038877 [344] 0.5031364 0.5023862 0.5016373 0.5008896 0.5001431 0.4993978 0.4986537 [351] 0.4979109 0.4971693 0.4964289 0.4956898 0.4949519 0.4942153 0.4934799 [358] 0.4927458 0.4920129 0.4912813 0.4905510 0.4898220 0.4890942 0.4883677 [365] 0.4876425 0.4869186 0.4861960 0.4854747 0.4847547 0.4840360 0.4833186 [372] 0.4826025 0.4818877 0.4811743 0.4804622 0.4797513 0.4790419 0.4783337 [379] 0.4776269 0.4769214 0.4762173 0.4755144 0.4748130 0.4741129 0.4734141 [386] 0.4727167 0.4720206 0.4713259 0.4706325 0.4699405 0.4692499 0.4685606 [393] 0.4678727 0.4671861 0.4665010 0.4658172 0.4651347 0.4644537 0.4637740 [400] 0.4630957 0.4624187 > mx [1] 0.7469868 > 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/1m5v01258130713.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/23rj61258130713.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/3fftf1258130713.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/47edr1258130713.tab") > system("convert tmp/1m5v01258130713.ps tmp/1m5v01258130713.png") > system("convert tmp/23rj61258130713.ps tmp/23rj61258130713.png") > system("convert tmp/3fftf1258130713.ps tmp/3fftf1258130713.png") > > > proc.time() user system elapsed 0.803 0.513 0.930