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(1.58,1.59,1.6,1.6,1.61,1.61,1.61,1.62,1.63,1.63,1.64,1.64,1.64,1.64,1.64,1.65,1.65,1.65,1.65,1.65,1.66,1.66,1.67,1.68,1.68,1.68,1.68,1.69,1.7,1.7,1.71,1.72,1.73,1.74,1.74,1.75,1.75,1.75,1.76,1.79,1.83,1.84,1.85,1.87,1.87,1.87,1.88,1.88,1.88,1.88,1.89,1.89,1.89,1.9,1.89,1.89,1.89,1.89,1.89,1.89) > x <- c(130.7,117.2,110.8,111.4,108.2,108.8,110.2,109.5,109.5,116,111.2,112.1,114,119.1,114.1,115.1,115.4,110.8,116,119.2,126.5,127.8,131.3,140.3,137.3,143,134.5,139.9,159.3,170.4,175,175.8,180.9,180.3,169.6,172.3,184.8,177.7,184.6,211.4,215.3,215.9,244.7,259.3,289,310.9,321,315.1,333.2,314.1,284.7,273.9,216,196.4,190.9,206.4,196.3,199.5,198.9,214.4) > #'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.9145406 0.9147304 0.9149190 0.9151066 0.9152930 0.9154783 0.9156625 [8] 0.9158455 0.9160274 0.9162081 0.9163876 0.9165660 0.9167431 0.9169190 [15] 0.9170938 0.9172673 0.9174395 0.9176105 0.9177803 0.9179487 0.9181159 [22] 0.9182819 0.9184465 0.9186098 0.9187718 0.9189324 0.9190918 0.9192497 [29] 0.9194063 0.9195616 0.9197154 0.9198679 0.9200190 0.9201686 0.9203168 [36] 0.9204636 0.9206090 0.9207529 0.9208953 0.9210362 0.9211757 0.9213137 [43] 0.9214501 0.9215850 0.9217184 0.9218503 0.9219806 0.9221093 0.9222365 [50] 0.9223621 0.9224860 0.9226084 0.9227292 0.9228483 0.9229658 0.9230816 [57] 0.9231957 0.9233082 0.9234190 0.9235281 0.9236355 0.9237412 0.9238452 [64] 0.9239474 0.9240478 0.9241465 0.9242434 0.9243385 0.9244319 0.9245234 [71] 0.9246131 0.9247010 0.9247870 0.9248712 0.9249535 0.9250339 0.9251125 [78] 0.9251891 0.9252639 0.9253367 0.9254076 0.9254765 0.9255435 0.9256085 [85] 0.9256716 0.9257326 0.9257917 0.9258487 0.9259037 0.9259567 0.9260077 [92] 0.9260566 0.9261034 0.9261482 0.9261908 0.9262314 0.9262698 0.9263062 [99] 0.9263404 0.9263724 0.9264023 0.9264301 0.9264556 0.9264790 0.9265002 [106] 0.9265192 0.9265359 0.9265504 0.9265627 0.9265727 0.9265805 0.9265860 [113] 0.9265892 0.9265901 0.9265887 0.9265850 0.9265790 0.9265706 0.9265599 [120] 0.9265469 0.9265314 0.9265136 0.9264934 0.9264708 0.9264458 0.9264184 [127] 0.9263886 0.9263563 0.9263216 0.9262844 0.9262447 0.9262026 0.9261580 [134] 0.9261109 0.9260613 0.9260092 0.9259545 0.9258973 0.9258376 0.9257753 [141] 0.9257105 0.9256431 0.9255731 0.9255005 0.9254253 0.9253476 0.9252672 [148] 0.9251842 0.9250985 0.9250102 0.9249193 0.9248257 0.9247295 0.9246305 [155] 0.9245289 0.9244246 0.9243176 0.9242079 0.9240955 0.9239804 0.9238626 [162] 0.9237420 0.9236186 0.9234926 0.9233637 0.9232321 0.9230977 0.9229606 [169] 0.9228207 0.9226779 0.9225324 0.9223841 0.9222329 0.9220790 0.9219222 [176] 0.9217626 0.9216002 0.9214349 0.9212668 0.9210958 0.9209220 0.9207453 [183] 0.9205657 0.9203832 0.9201979 0.9200097 0.9198186 0.9196247 0.9194278 [190] 0.9192280 0.9190253 0.9188197 0.9186112 0.9183998 0.9181854 0.9179682 [197] 0.9177480 0.9175248 0.9172988 0.9170697 0.9168378 0.9166029 0.9163651 [204] 0.9161243 0.9158805 0.9156338 0.9153842 0.9151315 0.9148760 0.9146174 [211] 0.9143559 0.9140914 0.9138240 0.9135536 0.9132802 0.9130038 0.9127245 [218] 0.9124422 0.9121569 0.9118687 0.9115775 0.9112833 0.9109861 0.9106860 [225] 0.9103829 0.9100768 0.9097677 0.9094557 0.9091407 0.9088227 0.9085018 [232] 0.9081779 0.9078510 0.9075212 0.9071884 0.9068526 0.9065139 0.9061722 [239] 0.9058276 0.9054800 0.9051295 0.9047760 0.9044196 0.9040602 0.9036979 [246] 0.9033327 0.9029646 0.9025935 0.9022195 0.9018426 0.9014627 0.9010800 [253] 0.9006944 0.9003058 0.8999144 0.8995201 0.8991229 0.8987228 0.8983198 [260] 0.8979140 0.8975053 0.8970937 0.8966793 0.8962621 0.8958420 0.8954191 [267] 0.8949933 0.8945648 0.8941334 0.8936992 0.8932622 0.8928225 0.8923799 [274] 0.8919346 0.8914865 0.8910356 0.8905820 0.8901257 0.8896666 0.8892048 [281] 0.8887403 0.8882730 0.8878031 0.8873305 0.8868552 0.8863772 0.8858965 [288] 0.8854132 0.8849273 0.8844387 0.8839475 0.8834537 0.8829573 0.8824583 [295] 0.8819567 0.8814525 0.8809457 0.8804365 0.8799246 0.8794103 0.8788934 [302] 0.8783740 0.8778521 0.8773278 0.8768009 0.8762716 0.8757399 0.8752057 [309] 0.8746691 0.8741301 0.8735887 0.8730449 0.8724987 0.8719502 0.8713993 [316] 0.8708460 0.8702905 0.8697326 0.8691725 0.8686100 0.8680453 0.8674784 [323] 0.8669092 0.8663377 0.8657641 0.8651882 0.8646102 0.8640299 0.8634476 [330] 0.8628630 0.8622764 0.8616876 0.8610967 0.8605038 0.8599087 0.8593117 [337] 0.8587125 0.8581114 0.8575082 0.8569030 0.8562958 0.8556867 0.8550756 [344] 0.8544626 0.8538477 0.8532308 0.8526121 0.8519915 0.8513690 0.8507447 [351] 0.8501185 0.8494906 0.8488608 0.8482293 0.8475960 0.8469609 0.8463241 [358] 0.8456856 0.8450454 0.8444035 0.8437599 0.8431147 0.8424679 0.8418194 [365] 0.8411693 0.8405177 0.8398644 0.8392096 0.8385533 0.8378955 0.8372361 [372] 0.8365753 0.8359130 0.8352492 0.8345840 0.8339174 0.8332493 0.8325799 [379] 0.8319091 0.8312370 0.8305635 0.8298887 0.8292126 0.8285352 0.8278565 [386] 0.8271766 0.8264954 0.8258130 0.8251295 0.8244447 0.8237587 0.8230716 [393] 0.8223834 0.8216940 0.8210036 0.8203120 0.8196194 0.8189258 0.8182310 [400] 0.8175353 0.8168386 > mx [1] 0.9265901 > mxli [1] -0.87 > 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/1vpsr1257423302.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/2z30e1257423302.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/3q1ae1257423302.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/4529t1257423303.tab") > > system("convert tmp/1vpsr1257423302.ps tmp/1vpsr1257423302.png") > system("convert tmp/2z30e1257423302.ps tmp/2z30e1257423302.png") > system("convert tmp/3q1ae1257423302.ps tmp/3q1ae1257423302.png") > > > proc.time() user system elapsed 0.772 0.494 1.178