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(99.5,98.2,108.9,100.0,105.0,108.4,96.7,100.5,115.6,114.9,110.7,107.7,113.5,106.9,119.6,109.4,106.9,118.7,108.9,113.1,125.1,126.5,122.7,127.5,107.1,112.0,122.1,111.5,113.2,128.2,115.1,117.4,132.0,130.8,128.0,132.7,117.0,110.9,123.5,117.4,122.7,123.5,111.5,113.8,131.2,127.0,126.2,121.2,118.8,117.9,135.2,120.7,126.4,129.6,113.4,120.5,135.5,137.6,130.6,133.1,121.5,120.5,136.9,123.7,128.5,135.0,120.9,121.1,132.2,134.5,133.6,136.1,124.5,124.6,133.5,132.3,125.3,135.5,121.2,117.5,135.9) > x <- c(98.5,97.0,103.3,99.6,100.1,102.9,95.9,94.5,107.4,116.0,102.8,99.8,109.6,103.0,111.6,106.3,97.9,108.8,103.9,101.2,122.9,123.9,111.7,120.9,99.6,103.3,119.4,106.5,101.9,124.6,106.5,107.8,127.4,120.1,118.5,127.7,107.7,104.5,118.8,110.3,109.6,119.1,96.5,106.7,126.3,116.2,118.8,115.2,110.0,111.4,129.6,108.1,117.8,122.9,100.6,111.8,127.0,128.6,124.8,118.5,114.7,112.6,128.7,111.0,115.8,126.0,111.1,113.2,120.1,130.6,124.0,119.4,116.7,116.5,119.6,126.5,111.3,123.5,114.2,103.7,129.5) > #'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.9403065 0.9403153 0.9403239 0.9403324 0.9403407 0.9403488 0.9403567 [8] 0.9403645 0.9403721 0.9403796 0.9403868 0.9403939 0.9404008 0.9404076 [15] 0.9404142 0.9404206 0.9404268 0.9404329 0.9404388 0.9404445 0.9404500 [22] 0.9404554 0.9404606 0.9404657 0.9404705 0.9404752 0.9404798 0.9404841 [29] 0.9404883 0.9404923 0.9404961 0.9404998 0.9405033 0.9405066 0.9405098 [36] 0.9405128 0.9405156 0.9405182 0.9405207 0.9405230 0.9405251 0.9405270 [43] 0.9405288 0.9405304 0.9405319 0.9405331 0.9405342 0.9405351 0.9405359 [50] 0.9405365 0.9405369 0.9405371 0.9405372 0.9405371 0.9405368 0.9405363 [57] 0.9405357 0.9405349 0.9405340 0.9405328 0.9405315 0.9405300 0.9405284 [64] 0.9405266 0.9405246 0.9405224 0.9405201 0.9405176 0.9405149 0.9405120 [71] 0.9405090 0.9405058 0.9405024 0.9404989 0.9404952 0.9404913 0.9404873 [78] 0.9404830 0.9404786 0.9404741 0.9404693 0.9404644 0.9404593 0.9404541 [85] 0.9404487 0.9404431 0.9404373 0.9404314 0.9404253 0.9404190 0.9404125 [92] 0.9404059 0.9403991 0.9403921 0.9403850 0.9403777 0.9403702 0.9403626 [99] 0.9403548 0.9403468 0.9403386 0.9403303 0.9403218 0.9403131 0.9403042 [106] 0.9402952 0.9402860 0.9402767 0.9402671 0.9402574 0.9402476 0.9402375 [113] 0.9402273 0.9402169 0.9402064 0.9401956 0.9401847 0.9401737 0.9401624 [120] 0.9401510 0.9401394 0.9401277 0.9401157 0.9401037 0.9400914 0.9400790 [127] 0.9400663 0.9400536 0.9400406 0.9400275 0.9400142 0.9400008 0.9399871 [134] 0.9399733 0.9399594 0.9399452 0.9399309 0.9399164 0.9399018 0.9398870 [141] 0.9398720 0.9398568 0.9398415 0.9398260 0.9398103 0.9397945 0.9397785 [148] 0.9397623 0.9397459 0.9397294 0.9397127 0.9396959 0.9396789 0.9396617 [155] 0.9396443 0.9396268 0.9396090 0.9395912 0.9395731 0.9395549 0.9395365 [162] 0.9395180 0.9394992 0.9394804 0.9394613 0.9394421 0.9394227 0.9394031 [169] 0.9393834 0.9393635 0.9393434 0.9393231 0.9393027 0.9392821 0.9392614 [176] 0.9392405 0.9392194 0.9391981 0.9391767 0.9391551 0.9391333 0.9391114 [183] 0.9390893 0.9390670 0.9390446 0.9390220 0.9389992 0.9389763 0.9389532 [190] 0.9389299 0.9389065 0.9388828 0.9388591 0.9388351 0.9388110 0.9387867 [197] 0.9387623 0.9387376 0.9387128 0.9386879 0.9386628 0.9386375 0.9386120 [204] 0.9385864 0.9385606 0.9385347 0.9385085 0.9384822 0.9384558 0.9384291 [211] 0.9384024 0.9383754 0.9383483 0.9383210 0.9382935 0.9382659 0.9382381 [218] 0.9382101 0.9381820 0.9381537 0.9381253 0.9380966 0.9380678 0.9380389 [225] 0.9380098 0.9379805 0.9379510 0.9379214 0.9378916 0.9378616 0.9378315 [232] 0.9378012 0.9377708 0.9377402 0.9377094 0.9376785 0.9376473 0.9376161 [239] 0.9375846 0.9375530 0.9375213 0.9374893 0.9374572 0.9374249 0.9373925 [246] 0.9373599 0.9373272 0.9372942 0.9372612 0.9372279 0.9371945 0.9371609 [253] 0.9371272 0.9370932 0.9370592 0.9370249 0.9369905 0.9369560 0.9369212 [260] 0.9368863 0.9368513 0.9368161 0.9367807 0.9367451 0.9367094 0.9366736 [267] 0.9366375 0.9366013 0.9365650 0.9365284 0.9364918 0.9364549 0.9364179 [274] 0.9363807 0.9363434 0.9363059 0.9362682 0.9362304 0.9361924 0.9361543 [281] 0.9361160 0.9360775 0.9360389 0.9360001 0.9359611 0.9359220 0.9358827 [288] 0.9358433 0.9358037 0.9357639 0.9357240 0.9356839 0.9356437 0.9356032 [295] 0.9355627 0.9355219 0.9354811 0.9354400 0.9353988 0.9353574 0.9353159 [302] 0.9352742 0.9352324 0.9351904 0.9351482 0.9351059 0.9350634 0.9350207 [309] 0.9349779 0.9349349 0.9348918 0.9348485 0.9348051 0.9347615 0.9347177 [316] 0.9346738 0.9346297 0.9345855 0.9345411 0.9344965 0.9344518 0.9344069 [323] 0.9343619 0.9343167 0.9342714 0.9342259 0.9341802 0.9341344 0.9340884 [330] 0.9340423 0.9339960 0.9339495 0.9339029 0.9338561 0.9338092 0.9337621 [337] 0.9337149 0.9336675 0.9336200 0.9335723 0.9335244 0.9334764 0.9334282 [344] 0.9333799 0.9333314 0.9332828 0.9332340 0.9331850 0.9331359 0.9330866 [351] 0.9330372 0.9329876 0.9329379 0.9328880 0.9328380 0.9327878 0.9327375 [358] 0.9326870 0.9326363 0.9325855 0.9325345 0.9324834 0.9324321 0.9323807 [365] 0.9323291 0.9322774 0.9322255 0.9321734 0.9321212 0.9320689 0.9320164 [372] 0.9319637 0.9319109 0.9318580 0.9318048 0.9317516 0.9316982 0.9316446 [379] 0.9315909 0.9315370 0.9314830 0.9314288 0.9313744 0.9313200 0.9312653 [386] 0.9312105 0.9311556 0.9311005 0.9310453 0.9309899 0.9309343 0.9308786 [393] 0.9308228 0.9307668 0.9307107 0.9306544 0.9305979 0.9305413 0.9304846 [400] 0.9304277 0.9303706 > mx [1] 0.9405372 > mxli [1] -1.48 > 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/1vzwc1228923257.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/2in071228923257.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/39kni1228923257.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/4bxcr1228923257.tab") > > system("convert tmp/1vzwc1228923257.ps tmp/1vzwc1228923257.png") > system("convert tmp/2in071228923257.ps tmp/2in071228923257.png") > system("convert tmp/39kni1228923257.ps tmp/39kni1228923257.png") > > > proc.time() user system elapsed 1.262 0.843 2.001