R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(577.992,565.464,547.344,554.788,562.325,560.854,555.332,543.599,536.662,542.722,593.530,610.763,612.613,611.324,594.167,595.454,590.865,589.379,584.428,573.100,567.456,569.028,620.735,628.884,628.232,612.117,595.404,597.141,593.408,590.072,579.799,574.205,572.775,572.942,619.567,625.809,619.916,587.625,565.742,557.274,560.576,548.854,531.673,525.919,511.038,498.662,555.362,564.591,541.657,527.070,509.846,514.258,516.922,507.561,492.622,490.243,469.357,477.580,528.379,533.590) > x <- c(308.347,298.427,289.231,291.975,294.912,293.488,290.555,284.736,281.818,287.854,316.263,325.412,326.011,328.282,317.480,317.539,313.737,312.276,309.391,302.950,300.316,304.035,333.476,337.698,335.932,323.931,313.927,314.485,313.218,309.664,302.963,298.989,298.423,301.631,329.765,335.083,327.616,309.119,295.916,291.413,291.542,284.678,276.475,272.566,264.981,263.290,296.806,303.598,286.994,276.427,266.424,267.153,268.381,262.522,255.542,253.158,243.803,250.741,280.445,285.257) > #'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.9878748 0.9879278 0.9879805 0.9880330 0.9880853 0.9881374 0.9881893 [8] 0.9882410 0.9882924 0.9883437 0.9883947 0.9884456 0.9884962 0.9885466 [15] 0.9885968 0.9886468 0.9886965 0.9887461 0.9887955 0.9888446 0.9888935 [22] 0.9889423 0.9889908 0.9890391 0.9890871 0.9891350 0.9891827 0.9892301 [29] 0.9892774 0.9893244 0.9893712 0.9894178 0.9894642 0.9895104 0.9895564 [36] 0.9896021 0.9896477 0.9896930 0.9897381 0.9897830 0.9898277 0.9898722 [43] 0.9899165 0.9899605 0.9900044 0.9900480 0.9900914 0.9901346 0.9901776 [50] 0.9902204 0.9902630 0.9903053 0.9903475 0.9903894 0.9904311 0.9904726 [57] 0.9905139 0.9905550 0.9905958 0.9906365 0.9906769 0.9907172 0.9907572 [64] 0.9907970 0.9908366 0.9908759 0.9909151 0.9909540 0.9909928 0.9910313 [71] 0.9910696 0.9911077 0.9911456 0.9911833 0.9912207 0.9912580 0.9912950 [78] 0.9913318 0.9913684 0.9914048 0.9914410 0.9914769 0.9915127 0.9915482 [85] 0.9915835 0.9916186 0.9916535 0.9916882 0.9917227 0.9917569 0.9917909 [92] 0.9918248 0.9918584 0.9918918 0.9919250 0.9919579 0.9919907 0.9920232 [99] 0.9920556 0.9920877 0.9921196 0.9921512 0.9921827 0.9922140 0.9922450 [106] 0.9922759 0.9923065 0.9923369 0.9923671 0.9923970 0.9924268 0.9924563 [113] 0.9924857 0.9925148 0.9925437 0.9925724 0.9926009 0.9926291 0.9926572 [120] 0.9926850 0.9927126 0.9927400 0.9927672 0.9927942 0.9928210 0.9928475 [127] 0.9928739 0.9929000 0.9929259 0.9929516 0.9929771 0.9930023 0.9930274 [134] 0.9930522 0.9930769 0.9931013 0.9931255 0.9931495 0.9931732 0.9931968 [141] 0.9932201 0.9932433 0.9932662 0.9932889 0.9933114 0.9933337 0.9933557 [148] 0.9933776 0.9933992 0.9934206 0.9934418 0.9934628 0.9934836 0.9935042 [155] 0.9935245 0.9935446 0.9935646 0.9935843 0.9936038 0.9936231 0.9936421 [162] 0.9936610 0.9936796 0.9936981 0.9937163 0.9937343 0.9937521 0.9937697 [169] 0.9937870 0.9938042 0.9938211 0.9938378 0.9938543 0.9938706 0.9938867 [176] 0.9939026 0.9939182 0.9939337 0.9939489 0.9939639 0.9939788 0.9939933 [183] 0.9940077 0.9940219 0.9940359 0.9940496 0.9940631 0.9940764 0.9940895 [190] 0.9941024 0.9941151 0.9941276 0.9941398 0.9941519 0.9941637 0.9941753 [197] 0.9941867 0.9941979 0.9942089 0.9942197 0.9942302 0.9942406 0.9942507 [204] 0.9942606 0.9942703 0.9942798 0.9942891 0.9942982 0.9943070 0.9943157 [211] 0.9943241 0.9943324 0.9943404 0.9943482 0.9943558 0.9943631 0.9943703 [218] 0.9943773 0.9943840 0.9943905 0.9943969 0.9944030 0.9944089 0.9944146 [225] 0.9944200 0.9944253 0.9944304 0.9944352 0.9944398 0.9944443 0.9944485 [232] 0.9944525 0.9944563 0.9944599 0.9944632 0.9944664 0.9944694 0.9944721 [239] 0.9944746 0.9944769 0.9944791 0.9944810 0.9944826 0.9944841 0.9944854 [246] 0.9944865 0.9944873 0.9944880 0.9944884 0.9944886 0.9944886 0.9944884 [253] 0.9944880 0.9944874 0.9944866 0.9944856 0.9944843 0.9944829 0.9944812 [260] 0.9944793 0.9944773 0.9944750 0.9944725 0.9944698 0.9944669 0.9944638 [267] 0.9944604 0.9944569 0.9944532 0.9944492 0.9944451 0.9944407 0.9944361 [274] 0.9944313 0.9944264 0.9944212 0.9944158 0.9944101 0.9944043 0.9943983 [281] 0.9943921 0.9943856 0.9943790 0.9943721 0.9943651 0.9943578 0.9943503 [288] 0.9943427 0.9943348 0.9943267 0.9943184 0.9943099 0.9943012 0.9942923 [295] 0.9942831 0.9942738 0.9942643 0.9942545 0.9942446 0.9942344 0.9942241 [302] 0.9942135 0.9942028 0.9941918 0.9941806 0.9941692 0.9941576 0.9941459 [309] 0.9941339 0.9941217 0.9941093 0.9940967 0.9940838 0.9940708 0.9940576 [316] 0.9940442 0.9940306 0.9940167 0.9940027 0.9939885 0.9939740 0.9939594 [323] 0.9939445 0.9939295 0.9939142 0.9938988 0.9938831 0.9938672 0.9938512 [330] 0.9938349 0.9938184 0.9938018 0.9937849 0.9937678 0.9937505 0.9937331 [337] 0.9937154 0.9936975 0.9936794 0.9936611 0.9936427 0.9936240 0.9936051 [344] 0.9935860 0.9935667 0.9935472 0.9935275 0.9935076 0.9934875 0.9934672 [351] 0.9934467 0.9934261 0.9934052 0.9933841 0.9933628 0.9933413 0.9933196 [358] 0.9932977 0.9932756 0.9932533 0.9932308 0.9932082 0.9931853 0.9931622 [365] 0.9931389 0.9931154 0.9930918 0.9930679 0.9930438 0.9930195 0.9929951 [372] 0.9929704 0.9929455 0.9929205 0.9928952 0.9928698 0.9928441 0.9928183 [379] 0.9927922 0.9927660 0.9927395 0.9927129 0.9926861 0.9926590 0.9926318 [386] 0.9926044 0.9925768 0.9925490 0.9925209 0.9924927 0.9924644 0.9924358 [393] 0.9924070 0.9923780 0.9923488 0.9923194 0.9922899 0.9922601 0.9922302 [400] 0.9922000 0.9921697 > mx [1] 0.9944886 > mxli [1] 0.5 > 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/freestat/rcomp/tmp/195f01226422448.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/freestat/rcomp/tmp/2zzrf1226422448.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/freestat/rcomp/tmp/35mg91226422448.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/4q6w41226422448.tab") > > system("convert tmp/195f01226422448.ps tmp/195f01226422448.png") > system("convert tmp/2zzrf1226422448.ps tmp/2zzrf1226422448.png") > system("convert tmp/35mg91226422448.ps tmp/35mg91226422448.png") > > > proc.time() user system elapsed 1.189 0.788 1.511