R version 2.7.0 (2008-04-22) 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(0,9,1,4,6,21,24,23,22,21,20,16,18,18,24,16,15,24,18,15,4,3,6,5,12,12,12,14,12,17,12,20,21,15,22,19,19,26,25,19,20,30,31,35,33,26,25,17,14,8,12,7,4,10,8,16,14,20,9,10) > 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.05610085 -0.05645145 -0.05680206 -0.05715269 -0.05750333 -0.05785398 [7] -0.05820464 -0.05855531 -0.05890599 -0.05925667 -0.05960736 -0.05995805 [13] -0.06030874 -0.06065943 -0.06101012 -0.06136082 -0.06171150 -0.06206219 [19] -0.06241287 -0.06276354 -0.06311420 -0.06346486 -0.06381550 -0.06416614 [25] -0.06451676 -0.06486737 -0.06521796 -0.06556853 -0.06591909 -0.06626962 [31] -0.06662014 -0.06697064 -0.06732111 -0.06767156 -0.06802198 -0.06837238 [37] -0.06872274 -0.06907308 -0.06942339 -0.06977367 -0.07012391 -0.07047412 [43] -0.07082430 -0.07117443 -0.07152453 -0.07187460 -0.07222462 -0.07257460 [49] -0.07292453 -0.07327442 -0.07362427 -0.07397407 -0.07432382 -0.07467353 [55] -0.07502318 -0.07537278 -0.07572233 -0.07607182 -0.07642126 -0.07677065 [61] -0.07711997 -0.07746924 -0.07781844 -0.07816759 -0.07851667 -0.07886569 [67] -0.07921464 -0.07956353 -0.07991235 -0.08026110 -0.08060978 -0.08095839 [73] -0.08130693 -0.08165539 -0.08200378 -0.08235209 -0.08270033 -0.08304849 [79] -0.08339656 -0.08374456 -0.08409248 -0.08444031 -0.08478805 -0.08513571 [85] -0.08548329 -0.08583077 -0.08617817 -0.08652547 -0.08687269 -0.08721981 [91] -0.08756684 -0.08791377 -0.08826060 -0.08860734 -0.08895398 -0.08930052 [97] -0.08964695 -0.08999329 -0.09033952 -0.09068564 -0.09103166 -0.09137758 [103] -0.09172338 -0.09206908 -0.09241466 -0.09276013 -0.09310549 -0.09345073 [109] -0.09379586 -0.09414088 -0.09448577 -0.09483055 -0.09517520 -0.09551974 [115] -0.09586415 -0.09620844 -0.09655260 -0.09689664 -0.09724055 -0.09758433 [121] -0.09792799 -0.09827151 -0.09861490 -0.09895816 -0.09930129 -0.09964427 [127] -0.09998713 -0.10032985 -0.10067242 -0.10101486 -0.10135716 -0.10169932 [133] -0.10204133 -0.10238320 -0.10272492 -0.10306650 -0.10340793 -0.10374921 [139] -0.10409034 -0.10443133 -0.10477216 -0.10511283 -0.10545336 -0.10579372 [145] -0.10613394 -0.10647399 -0.10681389 -0.10715362 -0.10749320 -0.10783261 [151] -0.10817187 -0.10851095 -0.10884988 -0.10918863 -0.10952722 -0.10986565 [157] -0.11020390 -0.11054198 -0.11087989 -0.11121763 -0.11155520 -0.11189259 [163] -0.11222980 -0.11256684 -0.11290371 -0.11324039 -0.11357689 -0.11391321 [169] -0.11424936 -0.11458531 -0.11492109 -0.11525668 -0.11559208 -0.11592730 [175] -0.11626233 -0.11659717 -0.11693182 -0.11726628 -0.11760054 -0.11793462 [181] -0.11826850 -0.11860218 -0.11893567 -0.11926896 -0.11960206 -0.11993495 [187] -0.12026765 -0.12060014 -0.12093244 -0.12126452 -0.12159641 -0.12192809 [193] -0.12225957 -0.12259083 -0.12292190 -0.12325275 -0.12358339 -0.12391382 [199] -0.12424404 -0.12457405 -0.12490384 -0.12523342 -0.12556279 -0.12589194 [205] -0.12622087 -0.12654958 -0.12687807 -0.12720635 -0.12753440 -0.12786223 [211] -0.12818984 -0.12851722 -0.12884438 -0.12917132 -0.12949802 -0.12982450 [217] -0.13015076 -0.13047678 -0.13080257 -0.13112814 -0.13145347 -0.13177856 [223] -0.13210343 -0.13242806 -0.13275245 -0.13307661 -0.13340053 -0.13372422 [229] -0.13404766 -0.13437087 -0.13469383 -0.13501656 -0.13533904 -0.13566128 [235] -0.13598327 -0.13630502 -0.13662652 -0.13694778 -0.13726879 -0.13758956 [241] -0.13791007 -0.13823033 -0.13855035 -0.13887011 -0.13918962 -0.13950888 [247] -0.13982788 -0.14014663 -0.14046512 -0.14078336 -0.14110134 -0.14141907 [253] -0.14173653 -0.14205374 -0.14237068 -0.14268737 -0.14300379 -0.14331995 [259] -0.14363585 -0.14395148 -0.14426685 -0.14458196 -0.14489680 -0.14521137 [265] -0.14552567 -0.14583970 -0.14615347 -0.14646697 -0.14678019 -0.14709315 [271] -0.14740583 -0.14771824 -0.14803038 -0.14834224 -0.14865383 -0.14896514 [277] -0.14927617 -0.14958693 -0.14989741 -0.15020761 -0.15051754 -0.15082718 [283] -0.15113655 -0.15144563 -0.15175443 -0.15206295 -0.15237118 -0.15267913 [289] -0.15298680 -0.15329418 -0.15360128 -0.15390809 -0.15421461 -0.15452084 [295] -0.15482679 -0.15513245 -0.15543782 -0.15574289 -0.15604768 -0.15635218 [301] -0.15665638 -0.15696029 -0.15726391 -0.15756723 -0.15787026 -0.15817299 [307] -0.15847543 -0.15877757 -0.15907942 -0.15938096 -0.15968221 -0.15998316 [313] -0.16028381 -0.16058417 -0.16088422 -0.16118397 -0.16148341 -0.16178256 [319] -0.16208140 -0.16237994 -0.16267818 -0.16297611 -0.16327374 -0.16357106 [325] -0.16386807 -0.16416478 -0.16446119 -0.16475728 -0.16505307 -0.16534854 [331] -0.16564371 -0.16593857 -0.16623312 -0.16652736 -0.16682128 -0.16711490 [337] -0.16740820 -0.16770119 -0.16799387 -0.16828623 -0.16857828 -0.16887002 [343] -0.16916144 -0.16945254 -0.16974333 -0.17003380 -0.17032396 -0.17061379 [349] -0.17090331 -0.17119251 -0.17148140 -0.17176996 -0.17205820 -0.17234613 [355] -0.17263373 -0.17292101 -0.17320797 -0.17349461 -0.17378092 -0.17406692 [361] -0.17435259 -0.17463794 -0.17492296 -0.17520766 -0.17549203 -0.17577608 [367] -0.17605980 -0.17634320 -0.17662627 -0.17690902 -0.17719143 -0.17747352 [373] -0.17775529 -0.17803672 -0.17831783 -0.17859860 -0.17887905 -0.17915917 [379] -0.17943895 -0.17971841 -0.17999754 -0.18027633 -0.18055480 -0.18083293 [385] -0.18111073 -0.18138819 -0.18166533 -0.18194213 -0.18221860 -0.18249473 [391] -0.18277053 -0.18304600 -0.18332113 -0.18359593 -0.18387039 -0.18414452 [397] -0.18441830 -0.18469176 -0.18496488 -0.18523766 -0.18551010 > mx [1] 0.1855101 > mxli [1] 2 > 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/1q2171228770131.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/2hwvc1228770132.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/3uhye1228770132.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/436w41228770132.tab") > > system("convert tmp/1q2171228770131.ps tmp/1q2171228770131.png") > system("convert tmp/2hwvc1228770132.ps tmp/2hwvc1228770132.png") > system("convert tmp/3uhye1228770132.ps tmp/3uhye1228770132.png") > > > proc.time() user system elapsed 1.898 0.850 2.010