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(119.5,125,145,105.3,116.9,120.1,88.9,78.4,114.6,113.3,117,99.6,99.4,101.9,115.2,108.5,113.8,121,92.2,90.2,101.5,126.6,93.9,89.8,93.4,101.5,110.4,105.9,108.4,113.9,86.1,69.4,101.2,100.5,98,106.6,90.1,96.9,125.9,112,100,123.9,79.8,83.4,113.6,112.9,104,109.9,99,106.3,128.9,111.1,102.9,130,87,87.5,117.6,103.4,110.8,112.6,102.5,112.4,135.6,105.1,127.7,137,91,90.5,122.4,123.3,124.3,120,118.1,119,142.7,123.6,129.6,151.6,110.4,99.2,130.5,136.2,129.7,128,121.6,135.8,143.8,147.5,136.2,156.6,123.3,100.4) > x <- c(103.1,100.6,103.1,95.5,90.5,90.9,88.8,90.7,94.3,104.6,111.1,110.8,107.2,99,99,91,96.2,96.9,96.2,100.1,99,115.4,106.9,107.1,99.3,99.2,108.3,105.6,99.5,107.4,93.1,88.1,110.7,113.1,99.6,93.6,98.6,99.6,114.3,107.8,101.2,112.5,100.5,93.9,116.2,112,106.4,95.7,96,95.8,103,102.2,98.4,111.4,86.6,91.3,107.9,101.8,104.4,93.4,100.1,98.5,112.9,101.4,107.1,110.8,90.3,95.5,111.4,113,107.5,95.9,106.3,105.2,117.2,106.9,108.2,113,97.2,99.9,108.1,118.1,109.1,93.3,112.1,111.8,112.5,116.3,110.3,117.1,103.4,96.2) > #'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.6254075 0.6254637 0.6255197 0.6255757 0.6256316 0.6256874 0.6257432 [8] 0.6257989 0.6258545 0.6259101 0.6259656 0.6260210 0.6260764 0.6261317 [15] 0.6261869 0.6262420 0.6262971 0.6263521 0.6264071 0.6264619 0.6265167 [22] 0.6265715 0.6266261 0.6266807 0.6267352 0.6267897 0.6268441 0.6268984 [29] 0.6269526 0.6270068 0.6270609 0.6271149 0.6271689 0.6272228 0.6272766 [36] 0.6273304 0.6273841 0.6274377 0.6274912 0.6275447 0.6275981 0.6276514 [43] 0.6277047 0.6277579 0.6278110 0.6278641 0.6279170 0.6279700 0.6280228 [50] 0.6280756 0.6281283 0.6281809 0.6282335 0.6282860 0.6283384 0.6283907 [57] 0.6284430 0.6284952 0.6285473 0.6285994 0.6286514 0.6287033 0.6287552 [64] 0.6288070 0.6288587 0.6289103 0.6289619 0.6290134 0.6290648 0.6291162 [71] 0.6291675 0.6292187 0.6292698 0.6293209 0.6293719 0.6294228 0.6294737 [78] 0.6295245 0.6295752 0.6296258 0.6296764 0.6297269 0.6297774 0.6298277 [85] 0.6298780 0.6299282 0.6299784 0.6300284 0.6300785 0.6301284 0.6301782 [92] 0.6302280 0.6302778 0.6303274 0.6303770 0.6304265 0.6304759 0.6305253 [99] 0.6305746 0.6306238 0.6306729 0.6307220 0.6307710 0.6308199 0.6308688 [106] 0.6309176 0.6309663 0.6310150 0.6310635 0.6311120 0.6311605 0.6312088 [113] 0.6312571 0.6313053 0.6313534 0.6314015 0.6314495 0.6314974 0.6315453 [120] 0.6315931 0.6316408 0.6316884 0.6317360 0.6317835 0.6318309 0.6318782 [127] 0.6319255 0.6319727 0.6320198 0.6320669 0.6321139 0.6321608 0.6322076 [134] 0.6322544 0.6323011 0.6323477 0.6323943 0.6324408 0.6324872 0.6325335 [141] 0.6325798 0.6326260 0.6326721 0.6327181 0.6327641 0.6328100 0.6328558 [148] 0.6329016 0.6329473 0.6329929 0.6330384 0.6330839 0.6331293 0.6331746 [155] 0.6332198 0.6332650 0.6333101 0.6333551 0.6334001 0.6334450 0.6334898 [162] 0.6335345 0.6335792 0.6336238 0.6336683 0.6337127 0.6337571 0.6338014 [169] 0.6338456 0.6338898 0.6339339 0.6339779 0.6340218 0.6340657 0.6341094 [176] 0.6341532 0.6341968 0.6342404 0.6342839 0.6343273 0.6343706 0.6344139 [183] 0.6344571 0.6345002 0.6345433 0.6345863 0.6346292 0.6346720 0.6347148 [190] 0.6347575 0.6348001 0.6348427 0.6348851 0.6349275 0.6349698 0.6350121 [197] 0.6350543 0.6350964 0.6351384 0.6351804 0.6352223 0.6352641 0.6353058 [204] 0.6353475 0.6353891 0.6354306 0.6354720 0.6355134 0.6355547 0.6355959 [211] 0.6356371 0.6356781 0.6357191 0.6357601 0.6358009 0.6358417 0.6358824 [218] 0.6359231 0.6359636 0.6360041 0.6360445 0.6360849 0.6361251 0.6361653 [225] 0.6362055 0.6362455 0.6362855 0.6363254 0.6363652 0.6364050 0.6364446 [232] 0.6364842 0.6365238 0.6365632 0.6366026 0.6366419 0.6366812 0.6367203 [239] 0.6367594 0.6367984 0.6368374 0.6368762 0.6369150 0.6369538 0.6369924 [246] 0.6370310 0.6370695 0.6371079 0.6371463 0.6371845 0.6372227 0.6372609 [253] 0.6372989 0.6373369 0.6373748 0.6374127 0.6374504 0.6374881 0.6375257 [260] 0.6375633 0.6376007 0.6376381 0.6376754 0.6377127 0.6377499 0.6377870 [267] 0.6378240 0.6378609 0.6378978 0.6379346 0.6379713 0.6380080 0.6380446 [274] 0.6380811 0.6381175 0.6381539 0.6381902 0.6382264 0.6382625 0.6382986 [281] 0.6383345 0.6383705 0.6384063 0.6384421 0.6384778 0.6385134 0.6385489 [288] 0.6385844 0.6386198 0.6386551 0.6386904 0.6387255 0.6387606 0.6387957 [295] 0.6388306 0.6388655 0.6389003 0.6389350 0.6389697 0.6390043 0.6390388 [302] 0.6390732 0.6391076 0.6391419 0.6391761 0.6392102 0.6392443 0.6392783 [309] 0.6393122 0.6393461 0.6393798 0.6394135 0.6394471 0.6394807 0.6395142 [316] 0.6395476 0.6395809 0.6396141 0.6396473 0.6396804 0.6397135 0.6397464 [323] 0.6397793 0.6398121 0.6398448 0.6398775 0.6399101 0.6399426 0.6399750 [330] 0.6400074 0.6400397 0.6400719 0.6401041 0.6401361 0.6401681 0.6402000 [337] 0.6402319 0.6402637 0.6402954 0.6403270 0.6403585 0.6403900 0.6404214 [344] 0.6404527 0.6404840 0.6405152 0.6405463 0.6405773 0.6406083 0.6406392 [351] 0.6406700 0.6407007 0.6407314 0.6407620 0.6407925 0.6408229 0.6408533 [358] 0.6408836 0.6409138 0.6409440 0.6409740 0.6410040 0.6410340 0.6410638 [365] 0.6410936 0.6411233 0.6411529 0.6411825 0.6412120 0.6412414 0.6412707 [372] 0.6413000 0.6413292 0.6413583 0.6413873 0.6414163 0.6414452 0.6414740 [379] 0.6415027 0.6415314 0.6415600 0.6415885 0.6416170 0.6416454 0.6416737 [386] 0.6417019 0.6417301 0.6417581 0.6417861 0.6418141 0.6418419 0.6418697 [393] 0.6418974 0.6419251 0.6419526 0.6419801 0.6420076 0.6420349 0.6420622 [400] 0.6420894 0.6421165 > mx [1] 0.6421165 > 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/1u3dc1226508168.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/2hcwv1226508168.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/3scau1226508168.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/4rwfj1226508168.tab") > > system("convert tmp/1u3dc1226508168.ps tmp/1u3dc1226508168.png") > system("convert tmp/2hcwv1226508168.ps tmp/2hcwv1226508168.png") > system("convert tmp/3scau1226508168.ps tmp/3scau1226508168.png") > > > proc.time() user system elapsed 1.021 0.525 1.295