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(100.00,100.28,100.00,98.62,98.35,98.35,104.68,104.13,103.58,104.68,104.41,105.79,107.99,108.54,107.99,109.09,107.99,109.09,115.43,115.98,115.70,115.15,112.95,115.15,117.36,117.91,118.46,116.80,116.53,117.63,121.49,123.69,124.52,127.27,125.34,127.00,127.00,127.55,127.27,125.62,125.34,125.62,130.03,130.03,129.75,128.10,126.45,128.10,128.93,128.65,127.55,126.72,127.27,127.00,131.13,131.13,129.75,124.79,122.04,121.76,100.00,100.28,100.00,98.62,98.35,98.35,104.68,104.13,103.58,104.68,104.41,105.79,107.99,108.54,107.99,109.09,107.99,109.09,115.43,115.98,115.70,115.15,112.95,115.15,117.36,117.91,118.46,116.80,116.53,117.63,121.49,123.69,124.52,127.27,125.34,127.00,127.00,127.55,127.27,125.62,125.34,125.62,130.03,130.03,129.75,128.10,126.45,128.10,128.93,128.65,127.55,126.72,127.27,127.00,131.13,131.13,129.75,124.79,122.04,121.76) > x <- c(100.00,106.54,127.63,141.72,147.95,142.16,147.95,155.82,164.13,159.16,147.14,159.16,178.85,200.44,189.43,160.16,157.02,168.91,173.19,175.83,158.78,166.96,171.24,179.55,191.00,196.41,206.80,208.94,224.86,217.31,229.96,252.36,255.25,290.37,269.67,240.53,252.86,265.51,299.31,297.42,277.09,313.59,335.75,370.67,375.33,358.65,334.80,335.05,364.07,350.47,350.16,393.46,405.29,406.86,426.12,422.97,373.63,335.18,329.89,346.32,100.00,106.54,127.63,141.72,147.95,142.16,147.95,155.82,164.13,159.16,147.14,159.16,178.85,200.44,189.43,160.16,157.02,168.91,173.19,175.83,158.78,166.96,171.24,179.55,191.00,196.41,206.80,208.94,224.86,217.31,229.96,252.36,255.25,290.37,269.67,240.53,252.86,265.51,299.31,297.42,277.09,313.59,335.75,370.67,375.33,358.65,334.80,335.05,364.07,350.47,350.16,393.46,405.29,406.86,426.12,422.97,373.63,335.18,329.89,346.32) > #'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.8809981 0.8816886 0.8823748 0.8830564 0.8837336 0.8844063 0.8850744 [8] 0.8857380 0.8863970 0.8870515 0.8877014 0.8883466 0.8889873 0.8896232 [15] 0.8902546 0.8908812 0.8915032 0.8921205 0.8927331 0.8933409 0.8939440 [22] 0.8945423 0.8951358 0.8957246 0.8963085 0.8968877 0.8974620 0.8980315 [29] 0.8985961 0.8991559 0.8997108 0.9002608 0.9008059 0.9013461 0.9018814 [36] 0.9024118 0.9029373 0.9034578 0.9039733 0.9044839 0.9049896 0.9054902 [43] 0.9059859 0.9064766 0.9069623 0.9074429 0.9079186 0.9083892 0.9088549 [50] 0.9093154 0.9097710 0.9102215 0.9106670 0.9111074 0.9115428 0.9119731 [57] 0.9123983 0.9128185 0.9132336 0.9136437 0.9140486 0.9144485 0.9148433 [64] 0.9152331 0.9156177 0.9159973 0.9163718 0.9167412 0.9171055 0.9174648 [71] 0.9178189 0.9181680 0.9185120 0.9188509 0.9191847 0.9195135 0.9198372 [78] 0.9201558 0.9204693 0.9207778 0.9210812 0.9213795 0.9216728 0.9219610 [85] 0.9222442 0.9225223 0.9227954 0.9230635 0.9233265 0.9235845 0.9238375 [92] 0.9240854 0.9243284 0.9245663 0.9247992 0.9250272 0.9252502 0.9254682 [99] 0.9256812 0.9258892 0.9260924 0.9262905 0.9264837 0.9266720 0.9268554 [106] 0.9270339 0.9272074 0.9273761 0.9275399 0.9276988 0.9278529 0.9280021 [113] 0.9281464 0.9282860 0.9284207 0.9285505 0.9286756 0.9287959 0.9289115 [120] 0.9290222 0.9291282 0.9292295 0.9293260 0.9294179 0.9295050 0.9295874 [127] 0.9296652 0.9297383 0.9298067 0.9298705 0.9299297 0.9299842 0.9300342 [134] 0.9300796 0.9301204 0.9301566 0.9301883 0.9302155 0.9302382 0.9302564 [141] 0.9302701 0.9302793 0.9302841 0.9302845 0.9302804 0.9302719 0.9302591 [148] 0.9302418 0.9302202 0.9301943 0.9301641 0.9301295 0.9300906 0.9300475 [155] 0.9300001 0.9299485 0.9298926 0.9298326 0.9297683 0.9296999 0.9296273 [162] 0.9295506 0.9294698 0.9293848 0.9292958 0.9292027 0.9291055 0.9290043 [169] 0.9288991 0.9287899 0.9286768 0.9285596 0.9284385 0.9283135 0.9281846 [176] 0.9280518 0.9279151 0.9277746 0.9276302 0.9274820 0.9273300 0.9271743 [183] 0.9270148 0.9268515 0.9266845 0.9265138 0.9263395 0.9261614 0.9259798 [190] 0.9257944 0.9256055 0.9254130 0.9252169 0.9250173 0.9248141 0.9246074 [197] 0.9243972 0.9241836 0.9239665 0.9237459 0.9235219 0.9232945 0.9230638 [204] 0.9228297 0.9225922 0.9223514 0.9221073 0.9218599 0.9216093 0.9213554 [211] 0.9210983 0.9208379 0.9205744 0.9203077 0.9200379 0.9197649 0.9194888 [218] 0.9192096 0.9189273 0.9186420 0.9183537 0.9180623 0.9177679 0.9174705 [225] 0.9171702 0.9168670 0.9165608 0.9162517 0.9159397 0.9156248 0.9153071 [232] 0.9149866 0.9146633 0.9143371 0.9140082 0.9136766 0.9133422 0.9130051 [239] 0.9126652 0.9123227 0.9119776 0.9116298 0.9112793 0.9109263 0.9105707 [246] 0.9102125 0.9098517 0.9094884 0.9091226 0.9087543 0.9083835 0.9080103 [253] 0.9076346 0.9072565 0.9068760 0.9064930 0.9061078 0.9057201 0.9053301 [260] 0.9049378 0.9045432 0.9041463 0.9037472 0.9033458 0.9029421 0.9025363 [267] 0.9021282 0.9017180 0.9013056 0.9008910 0.9004743 0.9000556 0.8996347 [274] 0.8992117 0.8987867 0.8983596 0.8979305 0.8974994 0.8970663 0.8966312 [281] 0.8961941 0.8957551 0.8953142 0.8948713 0.8944266 0.8939800 0.8935315 [288] 0.8930812 0.8926290 0.8921750 0.8917192 0.8912616 0.8908023 0.8903412 [295] 0.8898783 0.8894138 0.8889475 0.8884795 0.8880099 0.8875385 0.8870656 [302] 0.8865910 0.8861148 0.8856370 0.8851576 0.8846766 0.8841941 0.8837100 [309] 0.8832244 0.8827373 0.8822487 0.8817586 0.8812670 0.8807740 0.8802796 [316] 0.8797837 0.8792864 0.8787877 0.8782876 0.8777861 0.8772833 0.8767791 [323] 0.8762736 0.8757668 0.8752587 0.8747493 0.8742386 0.8737267 0.8732135 [330] 0.8726991 0.8721834 0.8716666 0.8711485 0.8706293 0.8701089 0.8695873 [337] 0.8690646 0.8685407 0.8680158 0.8674897 0.8669625 0.8664343 0.8659049 [344] 0.8653746 0.8648431 0.8643107 0.8637772 0.8632427 0.8627072 0.8621708 [351] 0.8616333 0.8610949 0.8605556 0.8600153 0.8594741 0.8589319 0.8583889 [358] 0.8578450 0.8573002 0.8567545 0.8562080 0.8556606 0.8551124 0.8545634 [365] 0.8540135 0.8534629 0.8529114 0.8523592 0.8518062 0.8512524 0.8506979 [372] 0.8501427 0.8495867 0.8490300 0.8484726 0.8479145 0.8473558 0.8467963 [379] 0.8462362 0.8456754 0.8451140 0.8445519 0.8439893 0.8434260 0.8428621 [386] 0.8422976 0.8417325 0.8411668 0.8406006 0.8400338 0.8394664 0.8388985 [393] 0.8383301 0.8377612 0.8371918 0.8366218 0.8360514 0.8354804 0.8349090 [400] 0.8343372 0.8337648 > mx [1] 0.9302845 > mxli [1] -0.57 > 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/1eaqe1257944457.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/2uszk1257944457.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/37tij1257944457.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/451v51257944457.tab") > > system("convert tmp/1eaqe1257944457.ps tmp/1eaqe1257944457.png") > system("convert tmp/2uszk1257944457.ps tmp/2uszk1257944457.png") > system("convert tmp/37tij1257944457.ps tmp/37tij1257944457.png") > > > proc.time() user system elapsed 0.782 0.500 0.950