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(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) > x <- c(4,3.8,4.7,4.3,3.9,4,4.3,4.8,4.4,4.3,4.7,4.7,4.9,5,4.2,4.3,4.8,4.8,4.8,4.2,4.6,4.8,4.5,4.4,4.3,3.9,3.7,4,4.1,3.7,3.8,3.8,3.8,3.3,3.3,3.3,3.2,3.4,4.2,4.9,5.1,5.5,5.6,6.4,6.1,7.1,7.8,7.9,7.4,7.5,6.8,5.2,4.7,4.1,3.9,2.6,2.7,1.8,1,0.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.03765471 -0.03761148 -0.03756866 -0.03752630 -0.03748442 -0.03744305 [7] -0.03740222 -0.03736196 -0.03732230 -0.03728327 -0.03724491 -0.03720725 [13] -0.03717033 -0.03713418 -0.03709884 -0.03706435 -0.03703074 -0.03699806 [19] -0.03696635 -0.03693564 -0.03690598 -0.03687742 -0.03685000 -0.03682376 [25] -0.03679876 -0.03677504 -0.03675265 -0.03673164 -0.03671207 -0.03669399 [31] -0.03667744 -0.03666249 -0.03664920 -0.03663762 -0.03662781 -0.03661983 [37] -0.03661375 -0.03660962 -0.03660751 -0.03660750 -0.03660964 -0.03661400 [43] -0.03662067 -0.03662969 -0.03664116 -0.03665515 -0.03667172 -0.03669096 [49] -0.03671296 -0.03673778 -0.03676551 -0.03679624 -0.03683005 -0.03686703 [55] -0.03690726 -0.03695084 -0.03699786 -0.03704841 -0.03710259 -0.03716049 [61] -0.03722221 -0.03728785 -0.03735752 -0.03743131 -0.03750933 -0.03759169 [67] -0.03767849 -0.03776984 -0.03786586 -0.03796666 -0.03807235 -0.03818305 [73] -0.03829887 -0.03841993 -0.03854636 -0.03867828 -0.03881581 -0.03895907 [79] -0.03910819 -0.03926331 -0.03942454 -0.03959202 -0.03976588 -0.03994626 [85] -0.04013328 -0.04032709 -0.04052782 -0.04073562 -0.04095061 -0.04117294 [91] -0.04140275 -0.04164018 -0.04188538 -0.04213849 -0.04239965 -0.04266901 [97] -0.04294672 -0.04323292 -0.04352776 -0.04383138 -0.04414394 -0.04446557 [103] -0.04479644 -0.04513669 -0.04548646 -0.04584590 -0.04621517 -0.04659440 [109] -0.04698375 -0.04738336 -0.04779337 -0.04821394 -0.04864520 -0.04908730 [115] -0.04954037 -0.05000457 -0.05048002 -0.05096687 -0.05146525 -0.05197529 [121] -0.05249713 -0.05303089 -0.05357671 -0.05413470 -0.05470500 -0.05528771 [127] -0.05588296 -0.05649085 -0.05711151 -0.05774503 -0.05839152 -0.05905109 [133] -0.05972382 -0.06040981 -0.06110914 -0.06182191 -0.06254818 -0.06328804 [139] -0.06404156 -0.06480880 -0.06558981 -0.06638466 -0.06719340 -0.06801607 [145] -0.06885270 -0.06970334 -0.07056800 -0.07144672 -0.07233950 -0.07324635 [151] -0.07416728 -0.07510229 -0.07605136 -0.07701448 -0.07799162 -0.07898275 [157] -0.07998785 -0.08100686 -0.08203973 -0.08308641 -0.08414683 -0.08522093 [163] -0.08630862 -0.08740981 -0.08852443 -0.08965236 -0.09079351 -0.09194775 [169] -0.09311498 -0.09429505 -0.09548785 -0.09669323 -0.09791104 -0.09914113 [175] -0.10038334 -0.10163751 -0.10290346 -0.10418102 -0.10547000 -0.10677020 [181] -0.10808145 -0.10940352 -0.11073623 -0.11207935 -0.11343267 -0.11479597 [187] -0.11616903 -0.11755160 -0.11894347 -0.12034438 -0.12175410 -0.12317238 [193] -0.12459898 -0.12603363 -0.12747609 -0.12892610 -0.13038339 -0.13184771 [199] -0.13331879 -0.13479636 -0.13628016 -0.13776992 -0.13926536 -0.14076623 [205] -0.14227224 -0.14378312 -0.14529861 -0.14681843 -0.14834231 -0.14986998 [211] -0.15140117 -0.15293562 -0.15447305 -0.15601320 -0.15755580 -0.15910060 [217] -0.16064732 -0.16219572 -0.16374553 -0.16529651 -0.16684839 -0.16840094 [223] -0.16995390 -0.17150703 -0.17306010 -0.17461287 -0.17616510 -0.17771657 [229] -0.17926704 -0.18081631 -0.18236414 -0.18391033 -0.18545466 -0.18699693 [235] -0.18853693 -0.19007447 -0.19160936 -0.19314139 -0.19467040 -0.19619619 [241] -0.19771858 -0.19923742 -0.20075251 -0.20226371 -0.20377086 -0.20527379 [247] -0.20677235 -0.20826640 -0.20975580 -0.21124040 -0.21272007 -0.21419469 [253] -0.21566412 -0.21712824 -0.21858694 -0.22004010 -0.22148761 -0.22292937 [259] -0.22436527 -0.22579521 -0.22721911 -0.22863686 -0.23004839 -0.23145360 [265] -0.23285243 -0.23424478 -0.23563060 -0.23700981 -0.23838234 -0.23974813 [271] -0.24110712 -0.24245926 -0.24380448 -0.24514275 -0.24647400 -0.24779820 [277] -0.24911531 -0.25042528 -0.25172807 -0.25302366 -0.25431201 -0.25559309 [283] -0.25686687 -0.25813333 -0.25939245 -0.26064421 -0.26188858 -0.26312555 [289] -0.26435511 -0.26557725 -0.26679195 -0.26799920 -0.26919901 -0.27039136 [295] -0.27157625 -0.27275368 -0.27392365 -0.27508616 -0.27624121 -0.27738880 [301] -0.27852895 -0.27966166 -0.28078694 -0.28190479 -0.28301523 -0.28411827 [307] -0.28521392 -0.28630219 -0.28738311 -0.28845668 -0.28952292 -0.29058185 [313] -0.29163348 -0.29267785 -0.29371496 -0.29474484 -0.29576751 -0.29678299 [319] -0.29779130 -0.29879247 -0.29978653 -0.30077349 -0.30175338 -0.30272623 [325] -0.30369206 -0.30465090 -0.30560278 -0.30654772 -0.30748576 -0.30841692 [331] -0.30934122 -0.31025871 -0.31116940 -0.31207334 -0.31297053 -0.31386103 [337] -0.31474486 -0.31562204 -0.31649262 -0.31735661 -0.31821406 -0.31906499 [343] -0.31990944 -0.32074743 -0.32157900 -0.32240419 -0.32322301 -0.32403552 [349] -0.32484172 -0.32564167 -0.32643540 -0.32722292 -0.32800429 -0.32877952 [355] -0.32954865 -0.33031173 -0.33106876 -0.33181980 -0.33256487 -0.33330401 [361] -0.33403724 -0.33476461 -0.33548614 -0.33620186 -0.33691181 -0.33761602 [367] -0.33831452 -0.33900735 -0.33969453 -0.34037611 -0.34105210 -0.34172254 [373] -0.34238747 -0.34304692 -0.34370092 -0.34434949 -0.34499267 -0.34563050 [379] -0.34626300 -0.34689021 -0.34751215 -0.34812886 -0.34874036 -0.34934670 [385] -0.34994789 -0.35054397 -0.35113497 -0.35172092 -0.35230185 -0.35287779 [391] -0.35344877 -0.35401482 -0.35457596 -0.35513224 -0.35568367 -0.35623029 [397] -0.35677212 -0.35730920 -0.35784155 -0.35836920 -0.35889218 > mx [1] 0.3588922 > 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/1zfwx1261054873.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/2489t1261054873.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/35rj01261054873.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/44o6m1261054873.tab") > > try(system("convert tmp/1zfwx1261054873.ps tmp/1zfwx1261054873.png",intern=TRUE)) character(0) > try(system("convert tmp/2489t1261054873.ps tmp/2489t1261054873.png",intern=TRUE)) character(0) > try(system("convert tmp/35rj01261054873.ps tmp/35rj01261054873.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.776 0.502 0.922