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(98.86,100.83,117.15,106.96,101.25,115.80,90.85,100.62,118.61,114.66,108.00,105.61,98.34,99.69,108.84,106.86,101.98,118.40,84.10,99.48,117.67,110.08,113.10,106.34,102.91,104.68,120.06,104.68,114.24,119.13,88.77,104.47,119.33,121.10,117.36,106.03,110.19,109.46,123.49,110.29,113.62,121.83,96.15,108.32,116.94,127.23,117.78,103.95,115.07,117.26,114.14,121.93,113.41,120.48,99.79,103.74,121.41,120.27,103.33,98.02) > x <- c(133.39,133.74,129.67,126.70,126.84,128.45,129.84,128.83,129.22,132.14,137.40,141.78,138.74,137.63,139.61,136.82,134.24,128.64,126.43,127.25,126.72,124.18,121.73,122.34,124.74,122.81,123.40,125.68,130.78,129.41,129.49,130.51,129.01,127.33,129.41,132.06,129.35,129.47,130.92,133.39,132.48,130.86,132.75,131.81,133.56,136.38,139.22,137.23,136.16,135.03,140.33,140.85,138.58,137.08,137.75,131.10,125.54,116.36,111.10,117.81) > #'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.07220053 0.07219553 0.07219053 0.07218552 0.07218051 0.07217550 [7] 0.07217048 0.07216547 0.07216045 0.07215543 0.07215040 0.07214538 [13] 0.07214035 0.07213532 0.07213029 0.07212526 0.07212023 0.07211519 [19] 0.07211015 0.07210511 0.07210006 0.07209502 0.07208997 0.07208492 [25] 0.07207987 0.07207482 0.07206976 0.07206470 0.07205965 0.07205458 [31] 0.07204952 0.07204446 0.07203939 0.07203432 0.07202925 0.07202417 [37] 0.07201910 0.07201402 0.07200894 0.07200386 0.07199878 0.07199369 [43] 0.07198861 0.07198352 0.07197843 0.07197334 0.07196824 0.07196315 [49] 0.07195805 0.07195295 0.07194785 0.07194274 0.07193764 0.07193253 [55] 0.07192742 0.07192231 0.07191720 0.07191208 0.07190697 0.07190185 [61] 0.07189673 0.07189161 0.07188648 0.07188136 0.07187623 0.07187110 [67] 0.07186597 0.07186084 0.07185570 0.07185057 0.07184543 0.07184029 [73] 0.07183515 0.07183001 0.07182486 0.07181972 0.07181457 0.07180942 [79] 0.07180427 0.07179912 0.07179396 0.07178881 0.07178365 0.07177849 [85] 0.07177333 0.07176817 0.07176300 0.07175784 0.07175267 0.07174750 [91] 0.07174233 0.07173716 0.07173199 0.07172681 0.07172163 0.07171646 [97] 0.07171128 0.07170609 0.07170091 0.07169573 0.07169054 0.07168535 [103] 0.07168016 0.07167497 0.07166978 0.07166459 0.07165939 0.07165420 [109] 0.07164900 0.07164380 0.07163860 0.07163340 0.07162819 0.07162299 [115] 0.07161778 0.07161257 0.07160736 0.07160215 0.07159694 0.07159173 [121] 0.07158651 0.07158130 0.07157608 0.07157086 0.07156564 0.07156042 [127] 0.07155519 0.07154997 0.07154474 0.07153951 0.07153429 0.07152906 [133] 0.07152383 0.07151859 0.07151336 0.07150812 0.07150289 0.07149765 [139] 0.07149241 0.07148717 0.07148193 0.07147669 0.07147144 0.07146620 [145] 0.07146095 0.07145570 0.07145045 0.07144520 0.07143995 0.07143470 [151] 0.07142945 0.07142419 0.07141894 0.07141368 0.07140842 0.07140316 [157] 0.07139790 0.07139264 0.07138737 0.07138211 0.07137685 0.07137158 [163] 0.07136631 0.07136104 0.07135577 0.07135050 0.07134523 0.07133996 [169] 0.07133468 0.07132941 0.07132413 0.07131886 0.07131358 0.07130830 [175] 0.07130302 0.07129774 0.07129245 0.07128717 0.07128189 0.07127660 [181] 0.07127131 0.07126603 0.07126074 0.07125545 0.07125016 0.07124487 [187] 0.07123958 0.07123428 0.07122899 0.07122369 0.07121840 0.07121310 [193] 0.07120780 0.07120250 0.07119720 0.07119190 0.07118660 0.07118130 [199] 0.07117600 0.07117069 0.07116539 0.07116008 0.07115478 0.07114947 [205] 0.07114416 0.07113885 0.07113354 0.07112823 0.07112292 0.07111761 [211] 0.07111229 0.07110698 0.07110166 0.07109635 0.07109103 0.07108571 [217] 0.07108040 0.07107508 0.07106976 0.07106444 0.07105912 0.07105380 [223] 0.07104847 0.07104315 0.07103783 0.07103250 0.07102718 0.07102185 [229] 0.07101653 0.07101120 0.07100587 0.07100054 0.07099521 0.07098988 [235] 0.07098455 0.07097922 0.07097389 0.07096856 0.07096323 0.07095789 [241] 0.07095256 0.07094722 0.07094189 0.07093655 0.07093122 0.07092588 [247] 0.07092054 0.07091520 0.07090986 0.07090452 0.07089918 0.07089384 [253] 0.07088850 0.07088316 0.07087782 0.07087248 0.07086713 0.07086179 [259] 0.07085645 0.07085110 0.07084576 0.07084041 0.07083507 0.07082972 [265] 0.07082437 0.07081903 0.07081368 0.07080833 0.07080298 0.07079763 [271] 0.07079228 0.07078693 0.07078158 0.07077623 0.07077088 0.07076553 [277] 0.07076018 0.07075483 0.07074948 0.07074412 0.07073877 0.07073342 [283] 0.07072806 0.07072271 0.07071735 0.07071200 0.07070664 0.07070129 [289] 0.07069593 0.07069058 0.07068522 0.07067986 0.07067451 0.07066915 [295] 0.07066379 0.07065843 0.07065308 0.07064772 0.07064236 0.07063700 [301] 0.07063164 0.07062628 0.07062092 0.07061556 0.07061020 0.07060484 [307] 0.07059948 0.07059412 0.07058876 0.07058340 0.07057804 0.07057268 [313] 0.07056732 0.07056196 0.07055660 0.07055124 0.07054587 0.07054051 [319] 0.07053515 0.07052979 0.07052443 0.07051906 0.07051370 0.07050834 [325] 0.07050298 0.07049761 0.07049225 0.07048689 0.07048153 0.07047616 [331] 0.07047080 0.07046544 0.07046007 0.07045471 0.07044935 0.07044398 [337] 0.07043862 0.07043326 0.07042790 0.07042253 0.07041717 0.07041181 [343] 0.07040644 0.07040108 0.07039572 0.07039035 0.07038499 0.07037963 [349] 0.07037427 0.07036890 0.07036354 0.07035818 0.07035282 0.07034745 [355] 0.07034209 0.07033673 0.07033137 0.07032601 0.07032064 0.07031528 [361] 0.07030992 0.07030456 0.07029920 0.07029384 0.07028848 0.07028312 [367] 0.07027775 0.07027239 0.07026703 0.07026167 0.07025631 0.07025095 [373] 0.07024559 0.07024024 0.07023488 0.07022952 0.07022416 0.07021880 [379] 0.07021344 0.07020808 0.07020273 0.07019737 0.07019201 0.07018666 [385] 0.07018130 0.07017594 0.07017059 0.07016523 0.07015987 0.07015452 [391] 0.07014916 0.07014381 0.07013846 0.07013310 0.07012775 0.07012239 [397] 0.07011704 0.07011169 0.07010634 0.07010099 0.07009563 > mx [1] 0.07220053 > 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/1uh061258140271.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/2d9741258140271.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/3jhlw1258140271.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/43lhf1258140271.tab") > system("convert tmp/1uh061258140271.ps tmp/1uh061258140271.png") > system("convert tmp/2d9741258140271.ps tmp/2d9741258140271.png") > system("convert tmp/3jhlw1258140271.ps tmp/3jhlw1258140271.png") > > > proc.time() user system elapsed 0.773 0.510 0.951