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(267413,267366,264777,258863,254844,254868,277267,285351,286602,283042,276687,277915,277128,277103,275037,270150,267140,264993,287259,291186,292300,288186,281477,282656,280190,280408,276836,275216,274352,271311,289802,290726,292300,278506,269826,265861,269034,264176,255198,253353,246057,235372,258556,260993,254663,250643,243422,247105,248541,245039,237080,237085,225554,226839,247934,248333,246969,245098,246263,255765,264319,268347,273046,273963,267430,271993,292710,295881,293299) > x <- c(294912,293488,290555,284736,281818,287854,316263,325412,326011,328282,317480,317539,313737,312276,309391,302950,300316,304035,333476,337698,335932,323931,313927,314485,313218,309664,302963,298989,298423,301631,329765,335083,327616,309119,295916,291413,291542,284678,276475,272566,264981,263290,296806,303598,286994,276427,266424,267153,268381,262522,255542,253158,243803,250741,280445,285257,270976,261076,255603,260376,263903,264291,263276,262572,256167,264221,293860,300713,287224) > #'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.8147238 0.8147426 0.8147644 0.8147824 0.8148034 0.8148226 0.8148377 [8] 0.8148573 0.8148745 0.8148945 0.8149130 0.8149317 0.8149507 0.8149684 [15] 0.8149861 0.8150038 0.8150223 0.8150393 0.8150574 0.8150746 0.8150921 [22] 0.8151094 0.8151265 0.8151434 0.8151606 0.8151771 0.8151940 0.8152106 [29] 0.8152270 0.8152434 0.8152597 0.8152759 0.8152919 0.8153078 0.8153236 [36] 0.8153393 0.8153548 0.8153704 0.8153857 0.8154009 0.8154161 0.8154311 [43] 0.8154460 0.8154608 0.8154755 0.8154900 0.8155045 0.8155188 0.8155330 [50] 0.8155471 0.8155611 0.8155750 0.8155888 0.8156025 0.8156160 0.8156294 [57] 0.8156427 0.8156559 0.8156690 0.8156820 0.8156949 0.8157076 0.8157202 [64] 0.8157327 0.8157451 0.8157574 0.8157696 0.8157817 0.8157936 0.8158054 [71] 0.8158171 0.8158287 0.8158402 0.8158516 0.8158628 0.8158740 0.8158850 [78] 0.8158959 0.8159067 0.8159174 0.8159279 0.8159384 0.8159487 0.8159589 [85] 0.8159690 0.8159790 0.8159889 0.8159986 0.8160083 0.8160178 0.8160272 [92] 0.8160365 0.8160457 0.8160547 0.8160637 0.8160725 0.8160812 0.8160898 [99] 0.8160983 0.8161066 0.8161149 0.8161230 0.8161310 0.8161389 0.8161467 [106] 0.8161544 0.8161619 0.8161693 0.8161766 0.8161838 0.8161909 0.8161979 [113] 0.8162047 0.8162115 0.8162181 0.8162246 0.8162309 0.8162372 0.8162433 [120] 0.8162494 0.8162553 0.8162611 0.8162667 0.8162723 0.8162777 0.8162830 [127] 0.8162882 0.8162933 0.8162983 0.8163031 0.8163079 0.8163125 0.8163170 [134] 0.8163214 0.8163256 0.8163298 0.8163338 0.8163377 0.8163415 0.8163452 [141] 0.8163487 0.8163521 0.8163555 0.8163587 0.8163617 0.8163647 0.8163675 [148] 0.8163703 0.8163729 0.8163754 0.8163777 0.8163800 0.8163821 0.8163841 [155] 0.8163860 0.8163878 0.8163894 0.8163910 0.8163924 0.8163937 0.8163949 [162] 0.8163959 0.8163969 0.8163977 0.8163984 0.8163990 0.8163994 0.8163998 [169] 0.8164000 0.8164001 0.8164001 0.8164000 0.8163997 0.8163993 0.8163989 [176] 0.8163982 0.8163975 0.8163967 0.8163957 0.8163946 0.8163934 0.8163921 [183] 0.8163906 0.8163890 0.8163874 0.8163856 0.8163836 0.8163816 0.8163794 [190] 0.8163771 0.8163747 0.8163722 0.8163695 0.8163668 0.8163639 0.8163609 [197] 0.8163577 0.8163545 0.8163511 0.8163476 0.8163440 0.8163403 0.8163364 [204] 0.8163325 0.8163284 0.8163242 0.8163198 0.8163154 0.8163108 0.8163061 [211] 0.8163013 0.8162964 0.8162913 0.8162861 0.8162808 0.8162754 0.8162699 [218] 0.8162642 0.8162584 0.8162525 0.8162465 0.8162404 0.8162341 0.8162277 [225] 0.8162212 0.8162146 0.8162078 0.8162010 0.8161940 0.8161869 0.8161796 [232] 0.8161723 0.8161648 0.8161572 0.8161495 0.8161416 0.8161337 0.8161256 [239] 0.8161174 0.8161091 0.8161006 0.8160921 0.8160834 0.8160746 0.8160656 [246] 0.8160566 0.8160474 0.8160381 0.8160287 0.8160192 0.8160095 0.8159997 [253] 0.8159898 0.8159798 0.8159696 0.8159594 0.8159490 0.8159385 0.8159278 [260] 0.8159171 0.8159062 0.8158952 0.8158841 0.8158729 0.8158615 0.8158500 [267] 0.8158384 0.8158267 0.8158148 0.8158028 0.8157908 0.8157785 0.8157662 [274] 0.8157537 0.8157412 0.8157285 0.8157156 0.8157027 0.8156896 0.8156764 [281] 0.8156631 0.8156497 0.8156361 0.8156225 0.8156087 0.8155947 0.8155807 [288] 0.8155665 0.8155522 0.8155378 0.8155233 0.8155086 0.8154939 0.8154790 [295] 0.8154639 0.8154488 0.8154335 0.8154181 0.8154026 0.8153870 0.8153713 [302] 0.8153554 0.8153394 0.8153233 0.8153070 0.8152907 0.8152742 0.8152576 [309] 0.8152408 0.8152240 0.8152070 0.8151899 0.8151727 0.8151554 0.8151379 [316] 0.8151203 0.8151026 0.8150848 0.8150668 0.8150488 0.8150306 0.8150123 [323] 0.8149938 0.8149753 0.8149566 0.8149378 0.8149188 0.8148998 0.8148806 [330] 0.8148613 0.8148419 0.8148224 0.8148027 0.8147829 0.8147630 0.8147430 [337] 0.8147229 0.8147026 0.8146822 0.8146617 0.8146410 0.8146203 0.8145994 [344] 0.8145784 0.8145573 0.8145360 0.8145147 0.8144932 0.8144716 0.8144498 [351] 0.8144280 0.8144060 0.8143839 0.8143617 0.8143393 0.8143168 0.8142943 [358] 0.8142716 0.8142487 0.8142258 0.8142027 0.8141795 0.8141562 0.8141327 [365] 0.8141092 0.8140855 0.8140617 0.8140377 0.8140137 0.8139895 0.8139652 [372] 0.8139408 0.8139163 0.8138916 0.8138668 0.8138419 0.8138169 0.8137918 [379] 0.8137665 0.8137411 0.8137156 0.8136900 0.8136642 0.8136383 0.8136123 [386] 0.8135862 0.8135600 0.8135336 0.8135071 0.8134805 0.8134538 0.8134269 [393] 0.8134000 0.8133729 0.8133457 0.8133183 0.8132909 0.8132633 0.8132356 [400] 0.8132078 0.8131798 > mx [1] 0.8164001 > mxli [1] -0.31 > 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/1j0dn1257979900.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/2a5c11257979900.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/3bs4f1257979900.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/4w51i1257979900.tab") > > system("convert tmp/1j0dn1257979900.ps tmp/1j0dn1257979900.png") > system("convert tmp/2a5c11257979900.ps tmp/2a5c11257979900.png") > system("convert tmp/3bs4f1257979900.ps tmp/3bs4f1257979900.png") > > > proc.time() user system elapsed 0.790 0.549 1.252