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(89.6,92.8,107.6,104.6,103.0,106.9,56.3,93.4,109.1,113.8,97.4,72.5,82.7,88.9,105.9,100.8,94.0,105.0,58.5,87.6,113.1,112.5,89.6,74.5,82.7,90.1,109.4,96.0,89.2,109.1,49.1,92.9,107.7,103.5,91.1,79.8,71.9,82.9,90.1,100.7,90.7,108.8,44.1,93.6,107.4,96.5,93.6,76.5,76.7,84.0,103.3,88.5,99.0,105.9,44.7,94.0,107.1,104.8,102.5,77.7,85.2,91.3,106.5,92.4,97.5,107.0,51.1,98.6,102.2,114.3,99.4,72.5,92.3,99.4,85.9,109.4,97.6,104.7,56.5) > x <- c(97.6,96.9,105.6,102.8,101.7,104.2,92.7,91.9,106.5,112.3,102.8,96.5,101.0,98.9,105.1,103.0,99.0,104.3,94.6,90.4,108.9,111.4,100.8,102.5,98.2,98.7,113.3,104.6,99.3,111.8,97.3,97.7,115.6,111.9,107.0,107.1,100.6,99.2,108.4,103.0,99.8,115.0,90.8,95.9,114.4,108.2,112.6,109.1,105.0,105.0,118.5,103.7,112.5,116.6,96.6,101.9,116.5,119.3,115.4,108.5,111.5,108.8,121.8,109.6,112.2,119.6,104.1,105.3,115.0,124.1,116.8,107.5,115.6,116.2,116.3,119.0,111.9,118.6,106.7) > #'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.5866325 0.5866279 0.5866232 0.5866184 0.5866135 0.5866085 0.5866034 [8] 0.5865983 0.5865930 0.5865876 0.5865822 0.5865766 0.5865709 0.5865652 [15] 0.5865594 0.5865534 0.5865474 0.5865413 0.5865351 0.5865288 0.5865224 [22] 0.5865159 0.5865093 0.5865026 0.5864959 0.5864890 0.5864820 0.5864750 [29] 0.5864678 0.5864606 0.5864533 0.5864458 0.5864383 0.5864307 0.5864230 [36] 0.5864152 0.5864073 0.5863993 0.5863913 0.5863831 0.5863748 0.5863665 [43] 0.5863580 0.5863495 0.5863408 0.5863321 0.5863233 0.5863144 0.5863054 [50] 0.5862963 0.5862871 0.5862778 0.5862684 0.5862590 0.5862494 0.5862398 [57] 0.5862300 0.5862202 0.5862102 0.5862002 0.5861901 0.5861799 0.5861696 [64] 0.5861592 0.5861487 0.5861381 0.5861275 0.5861167 0.5861059 0.5860949 [71] 0.5860839 0.5860728 0.5860615 0.5860502 0.5860388 0.5860273 0.5860158 [78] 0.5860041 0.5859923 0.5859804 0.5859685 0.5859565 0.5859443 0.5859321 [85] 0.5859198 0.5859074 0.5858949 0.5858823 0.5858696 0.5858568 0.5858440 [92] 0.5858310 0.5858179 0.5858048 0.5857916 0.5857783 0.5857649 0.5857514 [99] 0.5857378 0.5857241 0.5857103 0.5856964 0.5856825 0.5856684 0.5856543 [106] 0.5856401 0.5856258 0.5856114 0.5855969 0.5855823 0.5855676 0.5855528 [113] 0.5855380 0.5855230 0.5855080 0.5854928 0.5854776 0.5854623 0.5854469 [120] 0.5854314 0.5854159 0.5854002 0.5853844 0.5853686 0.5853526 0.5853366 [127] 0.5853205 0.5853043 0.5852880 0.5852716 0.5852551 0.5852386 0.5852219 [134] 0.5852052 0.5851883 0.5851714 0.5851544 0.5851373 0.5851201 0.5851028 [141] 0.5850855 0.5850680 0.5850505 0.5850328 0.5850151 0.5849973 0.5849794 [148] 0.5849614 0.5849433 0.5849252 0.5849069 0.5848886 0.5848702 0.5848516 [155] 0.5848330 0.5848143 0.5847955 0.5847767 0.5847577 0.5847387 0.5847195 [162] 0.5847003 0.5846810 0.5846616 0.5846421 0.5846225 0.5846029 0.5845831 [169] 0.5845633 0.5845433 0.5845233 0.5845032 0.5844830 0.5844628 0.5844424 [176] 0.5844219 0.5844014 0.5843808 0.5843601 0.5843393 0.5843184 0.5842974 [183] 0.5842763 0.5842552 0.5842340 0.5842126 0.5841912 0.5841697 0.5841482 [190] 0.5841265 0.5841047 0.5840829 0.5840610 0.5840389 0.5840168 0.5839947 [197] 0.5839724 0.5839500 0.5839276 0.5839050 0.5838824 0.5838597 0.5838369 [204] 0.5838141 0.5837911 0.5837680 0.5837449 0.5837217 0.5836984 0.5836750 [211] 0.5836515 0.5836280 0.5836043 0.5835806 0.5835568 0.5835329 0.5835089 [218] 0.5834848 0.5834606 0.5834364 0.5834121 0.5833876 0.5833631 0.5833386 [225] 0.5833139 0.5832891 0.5832643 0.5832394 0.5832144 0.5831893 0.5831641 [232] 0.5831388 0.5831135 0.5830881 0.5830626 0.5830370 0.5830113 0.5829855 [239] 0.5829597 0.5829337 0.5829077 0.5828816 0.5828554 0.5828292 0.5828028 [246] 0.5827764 0.5827498 0.5827232 0.5826965 0.5826698 0.5826429 0.5826160 [253] 0.5825890 0.5825619 0.5825347 0.5825074 0.5824800 0.5824526 0.5824251 [260] 0.5823975 0.5823698 0.5823420 0.5823142 0.5822862 0.5822582 0.5822301 [267] 0.5822020 0.5821737 0.5821453 0.5821169 0.5820884 0.5820598 0.5820311 [274] 0.5820024 0.5819735 0.5819446 0.5819156 0.5818865 0.5818574 0.5818281 [281] 0.5817988 0.5817694 0.5817399 0.5817103 0.5816806 0.5816509 0.5816211 [288] 0.5815912 0.5815612 0.5815311 0.5815010 0.5814708 0.5814405 0.5814101 [295] 0.5813796 0.5813491 0.5813184 0.5812877 0.5812569 0.5812260 0.5811951 [302] 0.5811641 0.5811329 0.5811018 0.5810705 0.5810391 0.5810077 0.5809762 [309] 0.5809446 0.5809129 0.5808812 0.5808493 0.5808174 0.5807854 0.5807533 [316] 0.5807212 0.5806889 0.5806566 0.5806242 0.5805918 0.5805592 0.5805266 [323] 0.5804939 0.5804611 0.5804282 0.5803953 0.5803622 0.5803291 0.5802960 [330] 0.5802627 0.5802294 0.5801959 0.5801624 0.5801289 0.5800952 0.5800615 [337] 0.5800277 0.5799938 0.5799598 0.5799258 0.5798916 0.5798574 0.5798231 [344] 0.5797888 0.5797543 0.5797198 0.5796852 0.5796506 0.5796158 0.5795810 [351] 0.5795461 0.5795111 0.5794760 0.5794409 0.5794057 0.5793704 0.5793350 [358] 0.5792996 0.5792641 0.5792285 0.5791928 0.5791570 0.5791212 0.5790853 [365] 0.5790493 0.5790133 0.5789771 0.5789409 0.5789046 0.5788683 0.5788318 [372] 0.5787953 0.5787587 0.5787220 0.5786853 0.5786485 0.5786116 0.5785746 [379] 0.5785376 0.5785004 0.5784632 0.5784260 0.5783886 0.5783512 0.5783137 [386] 0.5782761 0.5782384 0.5782007 0.5781629 0.5781250 0.5780871 0.5780491 [393] 0.5780109 0.5779728 0.5779345 0.5778962 0.5778578 0.5778193 0.5777808 [400] 0.5777421 0.5777034 > mx [1] 0.5866325 > 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/freestat/rcomp/tmp/1wag01226417579.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/freestat/rcomp/tmp/2gdnh1226417579.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/freestat/rcomp/tmp/3olcd1226417579.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/49gah1226417579.tab") > > system("convert tmp/1wag01226417579.ps tmp/1wag01226417579.png") > system("convert tmp/2gdnh1226417579.ps tmp/2gdnh1226417579.png") > system("convert tmp/3olcd1226417579.ps tmp/3olcd1226417579.png") > > > proc.time() user system elapsed 1.251 0.849 1.469