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(562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141,593408,590072,579799,574205,572775,572942,619567,625809,619916,587625,565742,557274,560576,548854,531673,525919,511038,498662,555362,564591,541657,527070,509846,514258,516922,507561,492622,490243,469357,477580,528379,533590,517945,506174,501866,516141) > x <- c(8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.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.8525894 0.8526404 0.8526912 0.8527416 0.8527917 0.8528416 0.8528911 [8] 0.8529403 0.8529892 0.8530378 0.8530861 0.8531341 0.8531818 0.8532292 [15] 0.8532763 0.8533231 0.8533695 0.8534157 0.8534615 0.8535071 0.8535524 [22] 0.8535973 0.8536419 0.8536863 0.8537303 0.8537740 0.8538174 0.8538605 [29] 0.8539033 0.8539458 0.8539880 0.8540299 0.8540715 0.8541128 0.8541538 [36] 0.8541944 0.8542348 0.8542748 0.8543146 0.8543540 0.8543932 0.8544320 [43] 0.8544705 0.8545088 0.8545467 0.8545843 0.8546216 0.8546586 0.8546953 [50] 0.8547317 0.8547678 0.8548036 0.8548390 0.8548742 0.8549091 0.8549436 [57] 0.8549779 0.8550118 0.8550455 0.8550788 0.8551119 0.8551446 0.8551770 [64] 0.8552091 0.8552409 0.8552725 0.8553037 0.8553346 0.8553652 0.8553954 [71] 0.8554254 0.8554551 0.8554845 0.8555136 0.8555423 0.8555708 0.8555989 [78] 0.8556268 0.8556543 0.8556816 0.8557085 0.8557351 0.8557615 0.8557875 [85] 0.8558132 0.8558386 0.8558637 0.8558886 0.8559131 0.8559373 0.8559611 [92] 0.8559847 0.8560080 0.8560310 0.8560537 0.8560761 0.8560981 0.8561199 [99] 0.8561414 0.8561625 0.8561834 0.8562039 0.8562242 0.8562441 0.8562637 [106] 0.8562831 0.8563021 0.8563208 0.8563393 0.8563574 0.8563752 0.8563927 [113] 0.8564099 0.8564269 0.8564435 0.8564598 0.8564758 0.8564915 0.8565069 [120] 0.8565219 0.8565367 0.8565512 0.8565654 0.8565793 0.8565929 0.8566062 [127] 0.8566191 0.8566318 0.8566442 0.8566562 0.8566680 0.8566795 0.8566906 [134] 0.8567015 0.8567121 0.8567223 0.8567323 0.8567419 0.8567513 0.8567603 [141] 0.8567691 0.8567775 0.8567857 0.8567935 0.8568011 0.8568083 0.8568152 [148] 0.8568219 0.8568282 0.8568343 0.8568400 0.8568455 0.8568506 0.8568554 [155] 0.8568600 0.8568642 0.8568681 0.8568718 0.8568751 0.8568782 0.8568809 [162] 0.8568833 0.8568855 0.8568873 0.8568889 0.8568901 0.8568910 0.8568917 [169] 0.8568920 0.8568921 0.8568918 0.8568913 0.8568904 0.8568893 0.8568878 [176] 0.8568861 0.8568840 0.8568817 0.8568790 0.8568761 0.8568728 0.8568693 [183] 0.8568655 0.8568613 0.8568569 0.8568522 0.8568472 0.8568418 0.8568362 [190] 0.8568303 0.8568241 0.8568176 0.8568108 0.8568037 0.8567963 0.8567886 [197] 0.8567806 0.8567723 0.8567637 0.8567548 0.8567456 0.8567362 0.8567264 [204] 0.8567163 0.8567060 0.8566953 0.8566843 0.8566731 0.8566616 0.8566497 [211] 0.8566376 0.8566252 0.8566124 0.8565994 0.8565861 0.8565725 0.8565586 [218] 0.8565444 0.8565299 0.8565151 0.8565001 0.8564847 0.8564690 0.8564531 [225] 0.8564368 0.8564203 0.8564035 0.8563863 0.8563689 0.8563512 0.8563332 [232] 0.8563149 0.8562963 0.8562774 0.8562582 0.8562388 0.8562190 0.8561990 [239] 0.8561786 0.8561580 0.8561370 0.8561158 0.8560943 0.8560725 0.8560504 [246] 0.8560281 0.8560054 0.8559824 0.8559592 0.8559356 0.8559118 0.8558877 [253] 0.8558633 0.8558386 0.8558136 0.8557883 0.8557627 0.8557369 0.8557107 [260] 0.8556843 0.8556576 0.8556305 0.8556032 0.8555756 0.8555478 0.8555196 [267] 0.8554911 0.8554624 0.8554334 0.8554041 0.8553744 0.8553446 0.8553144 [274] 0.8552839 0.8552532 0.8552221 0.8551908 0.8551592 0.8551273 0.8550951 [281] 0.8550626 0.8550299 0.8549968 0.8549635 0.8549299 0.8548960 0.8548618 [288] 0.8548273 0.8547926 0.8547575 0.8547222 0.8546866 0.8546507 0.8546146 [295] 0.8545781 0.8545414 0.8545043 0.8544670 0.8544294 0.8543916 0.8543534 [302] 0.8543150 0.8542762 0.8542372 0.8541979 0.8541584 0.8541185 0.8540784 [309] 0.8540380 0.8539973 0.8539563 0.8539150 0.8538735 0.8538317 0.8537896 [316] 0.8537472 0.8537045 0.8536616 0.8536183 0.8535748 0.8535311 0.8534870 [323] 0.8534426 0.8533980 0.8533531 0.8533079 0.8532625 0.8532167 0.8531707 [330] 0.8531244 0.8530779 0.8530310 0.8529839 0.8529365 0.8528888 0.8528408 [337] 0.8527926 0.8527441 0.8526953 0.8526462 0.8525969 0.8525472 0.8524973 [344] 0.8524472 0.8523967 0.8523460 0.8522950 0.8522437 0.8521922 0.8521403 [351] 0.8520882 0.8520359 0.8519832 0.8519303 0.8518771 0.8518236 0.8517699 [358] 0.8517159 0.8516616 0.8516070 0.8515522 0.8514970 0.8514417 0.8513860 [365] 0.8513301 0.8512739 0.8512174 0.8511606 0.8511036 0.8510463 0.8509888 [372] 0.8509309 0.8508728 0.8508145 0.8507558 0.8506969 0.8506377 0.8505783 [379] 0.8505186 0.8504586 0.8503983 0.8503378 0.8502770 0.8502159 0.8501546 [386] 0.8500929 0.8500311 0.8499689 0.8499065 0.8498438 0.8497809 0.8497177 [393] 0.8496542 0.8495904 0.8495264 0.8494621 0.8493976 0.8493328 0.8492677 [400] 0.8492024 0.8491367 > mx [1] 0.856892 > 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/1he5a1260696856.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/2h51k1260696856.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/36fvn1260696856.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/4253z1260696856.tab") > > try(system("convert tmp/1he5a1260696856.ps tmp/1he5a1260696856.png",intern=TRUE)) character(0) > try(system("convert tmp/2h51k1260696856.ps tmp/2h51k1260696856.png",intern=TRUE)) character(0) > try(system("convert tmp/36fvn1260696856.ps tmp/36fvn1260696856.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.753 0.490 0.994