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(85.0,95.9,108.9,96.2,100.1,105.7,64.5,66.8,110.3,96.1,102.5,97.6,83.6,86.5,96.0,91.1,87.2,84.5,59.2,61.5,98.8,97.9,92.7,84.2,74.5,79.7,86.8,79.8,87.0,91.4,58.7,62.8,87.9,90.4,80.6,73.5,71.4,70.6,78.3,76.0,77.4,80.9,63.4,58.1,88.2,81.2,84.9,76.4,71.5,76.1,82.9,78.0,82.0,84.7,55.7,59.5,83.2,87.6,76.2,76.4,68.3,70.0,76.3,70.9,72.4,80.1,57.4,62.7,82.6,88.9,80.4,72.0,69.4,69.2,77.3,79.4,78.6,76.1,61.8,59.4,78.1) > 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.07696398 0.07701849 0.07707302 0.07712757 0.07718215 0.07723675 [7] 0.07729136 0.07734600 0.07740067 0.07745535 0.07751005 0.07756477 [13] 0.07761952 0.07767429 0.07772907 0.07778388 0.07783871 0.07789356 [19] 0.07794842 0.07800331 0.07805822 0.07811315 0.07816810 0.07822307 [25] 0.07827806 0.07833307 0.07838809 0.07844314 0.07849821 0.07855330 [31] 0.07860840 0.07866353 0.07871867 0.07877383 0.07882901 0.07888421 [37] 0.07893943 0.07899467 0.07904993 0.07910520 0.07916049 0.07921581 [43] 0.07927114 0.07932648 0.07938185 0.07943723 0.07949263 0.07954805 [49] 0.07960349 0.07965894 0.07971441 0.07976990 0.07982540 0.07988093 [55] 0.07993646 0.07999202 0.08004759 0.08010318 0.08015879 0.08021441 [61] 0.08027005 0.08032571 0.08038138 0.08043707 0.08049277 0.08054849 [67] 0.08060423 0.08065998 0.08071575 0.08077153 0.08082733 0.08088314 [73] 0.08093897 0.08099482 0.08105067 0.08110655 0.08116244 0.08121834 [79] 0.08127426 0.08133019 0.08138614 0.08144211 0.08149808 0.08155407 [85] 0.08161008 0.08166610 0.08172213 0.08177818 0.08183424 0.08189031 [91] 0.08194640 0.08200250 0.08205862 0.08211475 0.08217089 0.08222704 [97] 0.08228321 0.08233939 0.08239558 0.08245179 0.08250801 0.08256424 [103] 0.08262048 0.08267674 0.08273301 0.08278929 0.08284558 0.08290189 [109] 0.08295820 0.08301453 0.08307087 0.08312722 0.08318358 0.08323996 [115] 0.08329634 0.08335274 0.08340915 0.08346557 0.08352200 0.08357844 [121] 0.08363489 0.08369135 0.08374782 0.08380431 0.08386080 0.08391730 [127] 0.08397382 0.08403034 0.08408687 0.08414342 0.08419997 0.08425653 [133] 0.08431310 0.08436969 0.08442628 0.08448288 0.08453949 0.08459611 [139] 0.08465273 0.08470937 0.08476602 0.08482267 0.08487933 0.08493600 [145] 0.08499268 0.08504937 0.08510607 0.08516277 0.08521949 0.08527621 [151] 0.08533293 0.08538967 0.08544641 0.08550317 0.08555992 0.08561669 [157] 0.08567346 0.08573024 0.08578703 0.08584383 0.08590063 0.08595744 [163] 0.08601425 0.08607107 0.08612790 0.08618473 0.08624157 0.08629842 [169] 0.08635527 0.08641213 0.08646900 0.08652587 0.08658275 0.08663963 [175] 0.08669652 0.08675341 0.08681031 0.08686721 0.08692412 0.08698103 [181] 0.08703795 0.08709488 0.08715180 0.08720874 0.08726568 0.08732262 [187] 0.08737956 0.08743652 0.08749347 0.08755043 0.08760739 0.08766436 [193] 0.08772133 0.08777831 0.08783528 0.08789227 0.08794925 0.08800624 [199] 0.08806323 0.08812023 0.08817723 0.08823423 0.08829123 0.08834824 [205] 0.08840525 0.08846226 0.08851927 0.08857629 0.08863331 0.08869033 [211] 0.08874735 0.08880438 0.08886141 0.08891844 0.08897547 0.08903250 [217] 0.08908953 0.08914657 0.08920361 0.08926064 0.08931768 0.08937472 [223] 0.08943176 0.08948881 0.08954585 0.08960289 0.08965994 0.08971698 [229] 0.08977403 0.08983107 0.08988812 0.08994516 0.09000221 0.09005925 [235] 0.09011630 0.09017334 0.09023039 0.09028743 0.09034448 0.09040152 [241] 0.09045856 0.09051560 0.09057264 0.09062968 0.09068672 0.09074376 [247] 0.09080079 0.09085783 0.09091486 0.09097189 0.09102892 0.09108595 [253] 0.09114297 0.09120000 0.09125702 0.09131404 0.09137106 0.09142807 [259] 0.09148508 0.09154209 0.09159910 0.09165611 0.09171311 0.09177011 [265] 0.09182710 0.09188410 0.09194109 0.09199807 0.09205506 0.09211204 [271] 0.09216901 0.09222598 0.09228295 0.09233992 0.09239688 0.09245383 [277] 0.09251079 0.09256774 0.09262468 0.09268162 0.09273855 0.09279549 [283] 0.09285241 0.09290933 0.09296625 0.09302316 0.09308007 0.09313697 [289] 0.09319386 0.09325076 0.09330764 0.09336452 0.09342139 0.09347826 [295] 0.09353513 0.09359198 0.09364883 0.09370568 0.09376252 0.09381935 [301] 0.09387617 0.09393299 0.09398981 0.09404661 0.09410341 0.09416021 [307] 0.09421699 0.09427377 0.09433054 0.09438731 0.09444407 0.09450082 [313] 0.09455756 0.09461429 0.09467102 0.09472774 0.09478445 0.09484116 [319] 0.09489785 0.09495454 0.09501122 0.09506789 0.09512456 0.09518121 [325] 0.09523786 0.09529450 0.09535113 0.09540775 0.09546436 0.09552096 [331] 0.09557755 0.09563414 0.09569071 0.09574728 0.09580384 0.09586038 [337] 0.09591692 0.09597345 0.09602997 0.09608647 0.09614297 0.09619946 [343] 0.09625594 0.09631240 0.09636886 0.09642531 0.09648174 0.09653817 [349] 0.09659459 0.09665099 0.09670738 0.09676377 0.09682014 0.09687650 [355] 0.09693285 0.09698918 0.09704551 0.09710183 0.09715813 0.09721442 [361] 0.09727070 0.09732697 0.09738323 0.09743947 0.09749570 0.09755192 [367] 0.09760813 0.09766433 0.09772051 0.09777668 0.09783284 0.09788898 [373] 0.09794512 0.09800123 0.09805734 0.09811344 0.09816952 0.09822558 [379] 0.09828164 0.09833768 0.09839370 0.09844972 0.09850572 0.09856170 [385] 0.09861768 0.09867364 0.09872958 0.09878551 0.09884143 0.09889733 [391] 0.09895322 0.09900909 0.09906495 0.09912079 0.09917662 0.09923244 [397] 0.09928824 0.09934402 0.09939979 0.09945555 0.09951129 > mx [1] 0.09951129 > 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/1eyu91228922961.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/2ek0z1228922961.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/3j3ql1228922961.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/4puoz1228922961.tab") > > system("convert tmp/1eyu91228922961.ps tmp/1eyu91228922961.png") > system("convert tmp/2ek0z1228922961.ps tmp/2ek0z1228922961.png") > system("convert tmp/3j3ql1228922961.ps tmp/3j3ql1228922961.png") > > > proc.time() user system elapsed 0.805 0.530 1.261