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(98.6,98,106.8,96.6,100.1,107.7,91.5,97.8,107.4,117.5,105.6,97.4,99.5,98,104.3,100.6,101.1,103.9,96.9,95.5,108.4,117,103.8,100.8,110.6,104,112.6,107.3,98.9,109.8,104.9,102.2,123.9,124.9,112.7,121.9,100.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5,115.7,113.6,129.7,112,116.8,127,112.1,114.2,121.1,131.6,125,120.4,117.7) > x <- c(98.1,101.1,111.1,93.3,100,108,70.4,75.4,105.5,112.3,102.5,93.5,86.7,95.2,103.8,97,95.5,101,67.5,64,106.7,100.6,101.2,93.1,84.2,85.8,91.8,92.4,80.3,79.7,62.5,57.1,100.8,100.7,86.2,83.2,71.7,77.5,89.8,80.3,78.7,93.8,57.6,60.6,91,85.3,77.4,77.3,68.3,69.9,81.7,75.1,69.9,84,54.3,60,89.9,77,85.3,77.6,69.2,75.5,85.7,72.2,79.9,85.3,52.2,61.2,82.4,85.4,78.2,70.2,70.2,69.3,77.5,66.1,69,79.2,56.2,63.3,77.8,92,78.1,65.1,71.1) > #'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.138778443 0.138486008 0.138193147 0.137899859 0.137606148 0.137312013 [7] 0.137017457 0.136722482 0.136427088 0.136131277 0.135835051 0.135538411 [13] 0.135241359 0.134943896 0.134646024 0.134347744 0.134049058 0.133749967 [19] 0.133450473 0.133150577 0.132850282 0.132549588 0.132248497 0.131947012 [25] 0.131645132 0.131342861 0.131040199 0.130737149 0.130433711 0.130129888 [31] 0.129825681 0.129521091 0.129216121 0.128910773 0.128605047 0.128298945 [37] 0.127992469 0.127685621 0.127378403 0.127070816 0.126762862 0.126454542 [43] 0.126145858 0.125836813 0.125527407 0.125217642 0.124907521 0.124597045 [49] 0.124286215 0.123975034 0.123663503 0.123351624 0.123039399 0.122726829 [55] 0.122413917 0.122100664 0.121787071 0.121473142 0.121158876 0.120844277 [61] 0.120529347 0.120214086 0.119898497 0.119582581 0.119266341 0.118949779 [67] 0.118632895 0.118315693 0.117998173 0.117680338 0.117362190 0.117043730 [73] 0.116724961 0.116405884 0.116086501 0.115766814 0.115446825 0.115126535 [79] 0.114805948 0.114485064 0.114163886 0.113842416 0.113520654 0.113198605 [85] 0.112876268 0.112553647 0.112230743 0.111907559 0.111584095 0.111260354 [91] 0.110936339 0.110612051 0.110287491 0.109962663 0.109637567 0.109312207 [97] 0.108986583 0.108660699 0.108334555 0.108008154 0.107681499 0.107354590 [103] 0.107027430 0.106700021 0.106372365 0.106044464 0.105716321 0.105387936 [109] 0.105059312 0.104730452 0.104401357 0.104072029 0.103742471 0.103412684 [115] 0.103082670 0.102752432 0.102421971 0.102091290 0.101760390 0.101429275 [121] 0.101097945 0.100766403 0.100434651 0.100102691 0.099770525 0.099438156 [127] 0.099105585 0.098772814 0.098439846 0.098106682 0.097773326 0.097439778 [133] 0.097106041 0.096772117 0.096438008 0.096103716 0.095769244 0.095434593 [139] 0.095099766 0.094764765 0.094429592 0.094094248 0.093758737 0.093423060 [145] 0.093087220 0.092751218 0.092415056 0.092078738 0.091742264 0.091405637 [151] 0.091068860 0.090731934 0.090394862 0.090057645 0.089720286 0.089382787 [157] 0.089045150 0.088707377 0.088369471 0.088031434 0.087693267 0.087354973 [163] 0.087016554 0.086678012 0.086339350 0.086000569 0.085661672 0.085322660 [169] 0.084983537 0.084644304 0.084304963 0.083965516 0.083625967 0.083286316 [175] 0.082946566 0.082606719 0.082266778 0.081926744 0.081586620 0.081246408 [181] 0.080906109 0.080565727 0.080225263 0.079884720 0.079544099 0.079203403 [187] 0.078862634 0.078521795 0.078180886 0.077839912 0.077498873 0.077157771 [193] 0.076816610 0.076475391 0.076134116 0.075792788 0.075451408 0.075109979 [199] 0.074768504 0.074426983 0.074085420 0.073743816 0.073402174 0.073060495 [205] 0.072718783 0.072377039 0.072035265 0.071693463 0.071351636 0.071009785 [211] 0.070667914 0.070326024 0.069984116 0.069642194 0.069300260 0.068958315 [217] 0.068616362 0.068274403 0.067932440 0.067590475 0.067248510 0.066906548 [223] 0.066564590 0.066222639 0.065880697 0.065538766 0.065196848 0.064854946 [229] 0.064513060 0.064171194 0.063829350 0.063487529 0.063145735 0.062803968 [235] 0.062462231 0.062120526 0.061778856 0.061437222 0.061095626 0.060754071 [241] 0.060412558 0.060071091 0.059729670 0.059388298 0.059046977 0.058705709 [247] 0.058364496 0.058023341 0.057682245 0.057341210 0.057000239 0.056659333 [253] 0.056318495 0.055977726 0.055637030 0.055296406 0.054955859 0.054615390 [259] 0.054275000 0.053934693 0.053594469 0.053254332 0.052914282 0.052574323 [265] 0.052234456 0.051894683 0.051555005 0.051215427 0.050875948 0.050536571 [271] 0.050197299 0.049858133 0.049519075 0.049180127 0.048841292 0.048502570 [277] 0.048163965 0.047825478 0.047487111 0.047148866 0.046810745 0.046472749 [283] 0.046134882 0.045797145 0.045459540 0.045122068 0.044784733 0.044447534 [289] 0.044110476 0.043773559 0.043436786 0.043100157 0.042763677 0.042427345 [295] 0.042091165 0.041755137 0.041419265 0.041083549 0.040747993 0.040412596 [301] 0.040077363 0.039742293 0.039407390 0.039072655 0.038738090 0.038403697 [307] 0.038069478 0.037735434 0.037401567 0.037067880 0.036734374 0.036401051 [313] 0.036067912 0.035734960 0.035402196 0.035069623 0.034737242 0.034405054 [319] 0.034073062 0.033741267 0.033409672 0.033078277 0.032747085 0.032416098 [325] 0.032085317 0.031754744 0.031424381 0.031094229 0.030764291 0.030434567 [331] 0.030105061 0.029775773 0.029446705 0.029117859 0.028789237 0.028460840 [337] 0.028132670 0.027804729 0.027477018 0.027149540 0.026822295 0.026495286 [343] 0.026168514 0.025841981 0.025515689 0.025189639 0.024863832 0.024538271 [349] 0.024212957 0.023887892 0.023563077 0.023238514 0.022914205 0.022590151 [355] 0.022266353 0.021942815 0.021619536 0.021296519 0.020973764 0.020651275 [361] 0.020329052 0.020007097 0.019685412 0.019363997 0.019042855 0.018721987 [367] 0.018401395 0.018081080 0.017761043 0.017441287 0.017121812 0.016802621 [373] 0.016483714 0.016165094 0.015846761 0.015528718 0.015210965 0.014893505 [379] 0.014576338 0.014259466 0.013942890 0.013626613 0.013310635 0.012994957 [385] 0.012679582 0.012364511 0.012049745 0.011735285 0.011421134 0.011107291 [391] 0.010793759 0.010480540 0.010167634 0.009855043 0.009542768 0.009230810 [397] 0.008919172 0.008607853 0.008296857 0.007986183 0.007675834 > mx [1] 0.1387784 > 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/12o6a1226435260.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/26jhb1226435260.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/3oeh21226435260.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/4jphn1226435260.tab") > > system("convert tmp/12o6a1226435260.ps tmp/12o6a1226435260.png") > system("convert tmp/26jhb1226435260.ps tmp/26jhb1226435260.png") > system("convert tmp/3oeh21226435260.ps tmp/3oeh21226435260.png") > > > proc.time() user system elapsed 1.247 0.835 2.021