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(41,35,34,36,39,40,30,33,30,32,41,40,41,40,39,34,34,46,45,44,40,39,37,39,35,26,26,33,27,30,26,27,18,19,13,14,41,21,16,17,9,14,14,16,11,10,6,9,5,7,2,0,8,13,11,19,23,23,43,59) > x <- c(49,46,45,49,47,45,48,51,48,49,51,54,52,52,53,51,55,53,51,52,54,58,57,52,50,53,50,50,51,53,49,54,57,58,56,60,55,54,52,55,56,54,53,59,62,63,64,75,77,79,77,82,83,81,78,79,79,73,72,67) > #'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.5767051 -0.5767644 -0.5768234 -0.5768820 -0.5769403 -0.5769982 [7] -0.5770557 -0.5771128 -0.5771696 -0.5772260 -0.5772821 -0.5773378 [13] -0.5773931 -0.5774481 -0.5775027 -0.5775569 -0.5776108 -0.5776643 [19] -0.5777174 -0.5777702 -0.5778226 -0.5778747 -0.5779264 -0.5779777 [25] -0.5780287 -0.5780793 -0.5781295 -0.5781794 -0.5782290 -0.5782781 [31] -0.5783269 -0.5783754 -0.5784235 -0.5784712 -0.5785186 -0.5785656 [37] -0.5786122 -0.5786585 -0.5787044 -0.5787500 -0.5787952 -0.5788401 [43] -0.5788846 -0.5789287 -0.5789725 -0.5790159 -0.5790590 -0.5791017 [49] -0.5791441 -0.5791861 -0.5792278 -0.5792691 -0.5793100 -0.5793506 [55] -0.5793908 -0.5794307 -0.5794703 -0.5795094 -0.5795483 -0.5795867 [61] -0.5796249 -0.5796626 -0.5797001 -0.5797371 -0.5797738 -0.5798102 [67] -0.5798462 -0.5798819 -0.5799172 -0.5799522 -0.5799869 -0.5800211 [73] -0.5800551 -0.5800887 -0.5801219 -0.5801548 -0.5801874 -0.5802196 [79] -0.5802514 -0.5802829 -0.5803141 -0.5803449 -0.5803754 -0.5804056 [85] -0.5804354 -0.5804648 -0.5804940 -0.5805227 -0.5805512 -0.5805793 [91] -0.5806071 -0.5806345 -0.5806616 -0.5806883 -0.5807147 -0.5807408 [97] -0.5807665 -0.5807919 -0.5808170 -0.5808417 -0.5808661 -0.5808902 [103] -0.5809139 -0.5809373 -0.5809603 -0.5809831 -0.5810055 -0.5810275 [109] -0.5810492 -0.5810706 -0.5810917 -0.5811125 -0.5811329 -0.5811530 [115] -0.5811727 -0.5811922 -0.5812113 -0.5812300 -0.5812485 -0.5812666 [121] -0.5812844 -0.5813019 -0.5813191 -0.5813359 -0.5813524 -0.5813686 [127] -0.5813844 -0.5814000 -0.5814152 -0.5814301 -0.5814447 -0.5814590 [133] -0.5814729 -0.5814866 -0.5814999 -0.5815129 -0.5815256 -0.5815379 [139] -0.5815500 -0.5815617 -0.5815732 -0.5815843 -0.5815951 -0.5816056 [145] -0.5816157 -0.5816256 -0.5816352 -0.5816444 -0.5816534 -0.5816620 [151] -0.5816703 -0.5816784 -0.5816861 -0.5816935 -0.5817006 -0.5817074 [157] -0.5817139 -0.5817201 -0.5817260 -0.5817315 -0.5817368 -0.5817418 [163] -0.5817465 -0.5817509 -0.5817550 -0.5817588 -0.5817623 -0.5817655 [169] -0.5817684 -0.5817710 -0.5817733 -0.5817753 -0.5817770 -0.5817785 [175] -0.5817796 -0.5817804 -0.5817810 -0.5817813 -0.5817813 -0.5817809 [181] -0.5817803 -0.5817795 -0.5817783 -0.5817768 -0.5817751 -0.5817730 [187] -0.5817707 -0.5817681 -0.5817653 -0.5817621 -0.5817587 -0.5817549 [193] -0.5817509 -0.5817466 -0.5817421 -0.5817373 -0.5817321 -0.5817267 [199] -0.5817211 -0.5817151 -0.5817089 -0.5817024 -0.5816957 -0.5816886 [205] -0.5816813 -0.5816737 -0.5816659 -0.5816578 -0.5816494 -0.5816407 [211] -0.5816318 -0.5816226 -0.5816132 -0.5816035 -0.5815935 -0.5815832 [217] -0.5815727 -0.5815620 -0.5815509 -0.5815396 -0.5815281 -0.5815163 [223] -0.5815042 -0.5814919 -0.5814793 -0.5814665 -0.5814534 -0.5814400 [229] -0.5814264 -0.5814126 -0.5813984 -0.5813841 -0.5813695 -0.5813546 [235] -0.5813395 -0.5813241 -0.5813085 -0.5812927 -0.5812766 -0.5812602 [241] -0.5812436 -0.5812268 -0.5812097 -0.5811924 -0.5811748 -0.5811570 [247] -0.5811390 -0.5811207 -0.5811021 -0.5810834 -0.5810644 -0.5810451 [253] -0.5810257 -0.5810060 -0.5809860 -0.5809658 -0.5809454 -0.5809248 [259] -0.5809039 -0.5808828 -0.5808615 -0.5808399 -0.5808181 -0.5807961 [265] -0.5807738 -0.5807514 -0.5807287 -0.5807057 -0.5806826 -0.5806592 [271] -0.5806356 -0.5806118 -0.5805878 -0.5805635 -0.5805391 -0.5805144 [277] -0.5804895 -0.5804644 -0.5804390 -0.5804135 -0.5803877 -0.5803617 [283] -0.5803355 -0.5803091 -0.5802825 -0.5802556 -0.5802286 -0.5802014 [289] -0.5801739 -0.5801462 -0.5801184 -0.5800903 -0.5800620 -0.5800335 [295] -0.5800048 -0.5799759 -0.5799468 -0.5799175 -0.5798881 -0.5798584 [301] -0.5798285 -0.5797984 -0.5797681 -0.5797376 -0.5797069 -0.5796760 [307] -0.5796450 -0.5796137 -0.5795822 -0.5795506 -0.5795187 -0.5794867 [313] -0.5794545 -0.5794221 -0.5793895 -0.5793567 -0.5793237 -0.5792906 [319] -0.5792572 -0.5792237 -0.5791900 -0.5791561 -0.5791220 -0.5790878 [325] -0.5790533 -0.5790187 -0.5789839 -0.5789489 -0.5789138 -0.5788785 [331] -0.5788430 -0.5788073 -0.5787714 -0.5787354 -0.5786992 -0.5786628 [337] -0.5786263 -0.5785896 -0.5785527 -0.5785157 -0.5784784 -0.5784411 [343] -0.5784035 -0.5783658 -0.5783279 -0.5782899 -0.5782517 -0.5782133 [349] -0.5781747 -0.5781361 -0.5780972 -0.5780582 -0.5780190 -0.5779797 [355] -0.5779402 -0.5779005 -0.5778607 -0.5778208 -0.5777807 -0.5777404 [361] -0.5777000 -0.5776594 -0.5776187 -0.5775778 -0.5775368 -0.5774956 [367] -0.5774543 -0.5774128 -0.5773712 -0.5773294 -0.5772875 -0.5772455 [373] -0.5772033 -0.5771609 -0.5771184 -0.5770758 -0.5770330 -0.5769901 [379] -0.5769471 -0.5769039 -0.5768606 -0.5768171 -0.5767735 -0.5767298 [385] -0.5766859 -0.5766419 -0.5765978 -0.5765535 -0.5765091 -0.5764646 [391] -0.5764199 -0.5763751 -0.5763302 -0.5762851 -0.5762399 -0.5761946 [397] -0.5761492 -0.5761036 -0.5760579 -0.5760121 -0.5759662 > mx [1] 0.5817813 > mxli [1] -0.23 > 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/1d9d21228769869.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/2nzn91228769869.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/38e5t1228769869.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/4e2io1228769869.tab") > > system("convert tmp/1d9d21228769869.ps tmp/1d9d21228769869.png") > system("convert tmp/2nzn91228769869.ps tmp/2nzn91228769869.png") > system("convert tmp/38e5t1228769869.ps tmp/38e5t1228769869.png") > > > proc.time() user system elapsed 0.823 0.516 0.984