R version 2.7.2 (2008-08-25) 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(3219.2,3552.3,3787.7,3392.7,3550,3681.9,3519.1,4283.2,4046.2,3824.9,4793.1,3977.7,3983.4,4152.9,4286.1,4348.1,3949.3,4166.7,4217.9,4528.2,4232.2,4470.9,5121.2,4170.8,4398.6,4491.4,4251.8,4901.9,4745.2,4666.9,4210.4,5273.6,4095.3,4610.1,4718.1,4185.5,4314.7,4422.6,5059.2,5043.6,4436.6,4922.6,4454.8,5058.7,4768.9,5171.8,4989.3,5202.1,4838.4,4876.5,5845.3,5686.3,4753.8,6620.4,5597.2,5643.5,6357.3,5909.1,6165.8,6321.6) > x <- c(8638.7,11063.7,11855.7,10684.5,11337.4,10478,11123.9,12909.3,11339.9,10462.2,12733.5,10519.2,10414.9,12476.8,12384.6,12266.7,12919.9,11497.3,12142,13919.4,12656.8,12034.1,13199.7,10881.3,11301.2,13643.9,12517,13981.1,14275.7,13435,13565.7,16216.3,12970,14079.9,14235,12213.4,12581,14130.4,14210.8,14378.5,13142.8,13714.7,13621.9,15379.8,13306.3,14391.2,14909.9,14025.4,12951.2,14344.3,16213.3,15544.5,14750.6,17292.7,17568.5,17930.8,18644.7,16694.8,17242.8,16979.9) > #'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.8508967 0.8513001 0.8517023 0.8521035 0.8525035 0.8529025 0.8533003 [8] 0.8536970 0.8540927 0.8544872 0.8548806 0.8552729 0.8556641 0.8560542 [15] 0.8564432 0.8568310 0.8572177 0.8576034 0.8579879 0.8583712 0.8587535 [22] 0.8591346 0.8595146 0.8598935 0.8602713 0.8606479 0.8610234 0.8613978 [29] 0.8617710 0.8621431 0.8625141 0.8628839 0.8632526 0.8636202 0.8639866 [36] 0.8643519 0.8647161 0.8650791 0.8654409 0.8658017 0.8661612 0.8665197 [43] 0.8668770 0.8672331 0.8675881 0.8679420 0.8682947 0.8686462 0.8689966 [50] 0.8693459 0.8696940 0.8700409 0.8703867 0.8707313 0.8710748 0.8714171 [57] 0.8717583 0.8720983 0.8724371 0.8727748 0.8731113 0.8734467 0.8737809 [64] 0.8741139 0.8744458 0.8747765 0.8751061 0.8754345 0.8757617 0.8760877 [71] 0.8764126 0.8767363 0.8770589 0.8773802 0.8777004 0.8780195 0.8783373 [78] 0.8786540 0.8789696 0.8792839 0.8795971 0.8799091 0.8802199 0.8805296 [85] 0.8808381 0.8811454 0.8814515 0.8817565 0.8820603 0.8823629 0.8826643 [92] 0.8829646 0.8832636 0.8835615 0.8838582 0.8841538 0.8844481 0.8847413 [99] 0.8850333 0.8853242 0.8856138 0.8859023 0.8861895 0.8864756 0.8867606 [106] 0.8870443 0.8873269 0.8876082 0.8878884 0.8881675 0.8884453 0.8887219 [113] 0.8889974 0.8892717 0.8895448 0.8898167 0.8900875 0.8903570 0.8906254 [120] 0.8908926 0.8911586 0.8914234 0.8916871 0.8919495 0.8922108 0.8924709 [127] 0.8927298 0.8929875 0.8932441 0.8934995 0.8937536 0.8940066 0.8942585 [134] 0.8945091 0.8947586 0.8950068 0.8952539 0.8954998 0.8957446 0.8959881 [141] 0.8962305 0.8964717 0.8967117 0.8969505 0.8971881 0.8974246 0.8976599 [148] 0.8978940 0.8981269 0.8983587 0.8985892 0.8988186 0.8990468 0.8992739 [155] 0.8994997 0.8997244 0.8999479 0.9001702 0.9003914 0.9006113 0.9008301 [162] 0.9010478 0.9012642 0.9014795 0.9016936 0.9019065 0.9021183 0.9023289 [169] 0.9025383 0.9027465 0.9029536 0.9031595 0.9033642 0.9035678 0.9037701 [176] 0.9039714 0.9041714 0.9043703 0.9045680 0.9047646 0.9049600 0.9051542 [183] 0.9053472 0.9055391 0.9057299 0.9059194 0.9061078 0.9062951 0.9064812 [190] 0.9066661 0.9068498 0.9070324 0.9072139 0.9073942 0.9075733 0.9077513 [197] 0.9079281 0.9081038 0.9082783 0.9084517 0.9086239 0.9087949 0.9089648 [204] 0.9091336 0.9093012 0.9094676 0.9096329 0.9097971 0.9099601 0.9101220 [211] 0.9102827 0.9104423 0.9106007 0.9107580 0.9109142 0.9110692 0.9112231 [218] 0.9113758 0.9115274 0.9116779 0.9118272 0.9119754 0.9121225 0.9122684 [225] 0.9124132 0.9125569 0.9126994 0.9128409 0.9129811 0.9131203 0.9132583 [232] 0.9133952 0.9135310 0.9136657 0.9137992 0.9139316 0.9140629 0.9141931 [239] 0.9143221 0.9144501 0.9145769 0.9147026 0.9148272 0.9149507 0.9150731 [246] 0.9151944 0.9153145 0.9154336 0.9155515 0.9156683 0.9157841 0.9158987 [253] 0.9160122 0.9161247 0.9162360 0.9163462 0.9164554 0.9165634 0.9166703 [260] 0.9167762 0.9168810 0.9169846 0.9170872 0.9171887 0.9172891 0.9173884 [267] 0.9174866 0.9175838 0.9176798 0.9177748 0.9178687 0.9179615 0.9180533 [274] 0.9181440 0.9182336 0.9183221 0.9184095 0.9184959 0.9185812 0.9186655 [281] 0.9187486 0.9188308 0.9189118 0.9189918 0.9190707 0.9191486 0.9192254 [288] 0.9193011 0.9193758 0.9194495 0.9195221 0.9195936 0.9196641 0.9197335 [295] 0.9198019 0.9198693 0.9199356 0.9200008 0.9200651 0.9201282 0.9201904 [302] 0.9202515 0.9203116 0.9203706 0.9204286 0.9204856 0.9205415 0.9205964 [309] 0.9206503 0.9207032 0.9207551 0.9208059 0.9208557 0.9209045 0.9209522 [316] 0.9209990 0.9210447 0.9210895 0.9211332 0.9211759 0.9212176 0.9212583 [323] 0.9212980 0.9213367 0.9213743 0.9214110 0.9214467 0.9214814 0.9215151 [330] 0.9215478 0.9215795 0.9216103 0.9216400 0.9216687 0.9216965 0.9217233 [337] 0.9217491 0.9217739 0.9217978 0.9218206 0.9218425 0.9218634 0.9218834 [344] 0.9219024 0.9219204 0.9219374 0.9219535 0.9219686 0.9219828 0.9219960 [351] 0.9220082 0.9220195 0.9220298 0.9220392 0.9220476 0.9220551 0.9220616 [358] 0.9220672 0.9220719 0.9220756 0.9220783 0.9220802 0.9220810 0.9220810 [365] 0.9220800 0.9220781 0.9220752 0.9220715 0.9220668 0.9220611 0.9220546 [372] 0.9220471 0.9220388 0.9220295 0.9220192 0.9220081 0.9219961 0.9219831 [379] 0.9219693 0.9219545 0.9219388 0.9219223 0.9219048 0.9218864 0.9218671 [386] 0.9218470 0.9218259 0.9218040 0.9217811 0.9217574 0.9217328 0.9217073 [393] 0.9216810 0.9216537 0.9216256 0.9215966 0.9215667 0.9215359 0.9215043 [400] 0.9214718 0.9214384 > mx [1] 0.922081 > mxli [1] 1.62 > 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/1i7q91226421215.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/2i9041226421215.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/3it8s1226421215.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/4m09b1226421215.tab") > > system("convert tmp/1i7q91226421215.ps tmp/1i7q91226421215.png") > system("convert tmp/2i9041226421215.ps tmp/2i9041226421215.png") > system("convert tmp/3it8s1226421215.ps tmp/3it8s1226421215.png") > > > proc.time() user system elapsed 0.995 0.517 1.191