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(80.6,104.1,108.2,93.4,71.9,94.1,94.9,96.4,91.1,84.4,86.4,88,75.1,109.7,103,82.1,68,96.4,94.3,90,88,76.1,82.5,81.4,66.5,97.2,94.1,80.7,70.5,87.8,89.5,99.6,84.2,75.1,92,80.8,73.1,99.8,90,83.1,72.4,78.8,87.3,91,80.1,73.6,86.4,74.5,71.2,92.4,81.5,85.3,69.9,84.2,90.7,100.3,79.4,84.8,92.9,81.6,76,98.7,89.1,88.7,67.1,93.6,97,100.8,80.1,80.7,89.4,81.5,73.6,90.9,97.3,84.3,65.6,87.3,90.5,82.4,80.4) > x <- c(107.2,107,119,110.4,101.7,102.4,98.8,105.6,104.4,106.3,107.2,108.5,106.9,114.2,125.9,110.6,110.5,106.7,104.7,107.4,109.8,103.4,114.8,114.3,109.6,118.3,127.3,112.3,114.9,108.2,105.4,122.1,113.5,110,125.3,114.3,115.6,127.1,123,122.2,126.4,112.7,105.8,120.9,116.3,115.7,127.9,108.3,121.1,128.6,123.1,127.7,126.6,118.4,110,129.6,115.8,125.9,128.4,114,125.6,128.5,136.6,133.1,124.6,123.5,117.2,135.5,124.8,127.8,133.1,125.7,128.4,131.9,146.3,140.6,129.5,132.4,125.9,126.9,135.8) > #'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.06369024 0.06376653 0.06384283 0.06391912 0.06399541 0.06407170 [7] 0.06414799 0.06422428 0.06430057 0.06437685 0.06445313 0.06452941 [13] 0.06460569 0.06468197 0.06475824 0.06483451 0.06491079 0.06498705 [19] 0.06506332 0.06513958 0.06521585 0.06529211 0.06536836 0.06544462 [25] 0.06552087 0.06559712 0.06567337 0.06574961 0.06582586 0.06590210 [31] 0.06597833 0.06605457 0.06613080 0.06620703 0.06628325 0.06635948 [37] 0.06643570 0.06651191 0.06658813 0.06666434 0.06674054 0.06681675 [43] 0.06689295 0.06696915 0.06704534 0.06712153 0.06719772 0.06727390 [49] 0.06735008 0.06742626 0.06750243 0.06757860 0.06765476 0.06773092 [55] 0.06780708 0.06788323 0.06795938 0.06803553 0.06811167 0.06818781 [61] 0.06826394 0.06834007 0.06841619 0.06849231 0.06856843 0.06864454 [67] 0.06872064 0.06879674 0.06887284 0.06894893 0.06902502 0.06910110 [73] 0.06917718 0.06925326 0.06932932 0.06940539 0.06948145 0.06955750 [79] 0.06963355 0.06970959 0.06978563 0.06986166 0.06993769 0.07001371 [85] 0.07008972 0.07016574 0.07024174 0.07031774 0.07039373 0.07046972 [91] 0.07054571 0.07062168 0.07069765 0.07077362 0.07084958 0.07092553 [97] 0.07100148 0.07107742 0.07115335 0.07122928 0.07130520 0.07138112 [103] 0.07145703 0.07153293 0.07160883 0.07168472 0.07176060 0.07183648 [109] 0.07191235 0.07198821 0.07206407 0.07213992 0.07221576 0.07229160 [115] 0.07236743 0.07244325 0.07251907 0.07259487 0.07267067 0.07274647 [121] 0.07282225 0.07289803 0.07297380 0.07304957 0.07312532 0.07320107 [127] 0.07327681 0.07335255 0.07342827 0.07350399 0.07357970 0.07365540 [133] 0.07373110 0.07380678 0.07388246 0.07395813 0.07403379 0.07410944 [139] 0.07418509 0.07426073 0.07433635 0.07441197 0.07448759 0.07456319 [145] 0.07463878 0.07471437 0.07478994 0.07486551 0.07494107 0.07501662 [151] 0.07509216 0.07516770 0.07524322 0.07531873 0.07539424 0.07546973 [157] 0.07554522 0.07562070 0.07569617 0.07577163 0.07584707 0.07592251 [163] 0.07599794 0.07607336 0.07614877 0.07622418 0.07629957 0.07637495 [169] 0.07645032 0.07652568 0.07660103 0.07667637 0.07675170 0.07682702 [175] 0.07690233 0.07697763 0.07705292 0.07712820 0.07720347 0.07727873 [181] 0.07735398 0.07742922 0.07750444 0.07757966 0.07765486 0.07773006 [187] 0.07780524 0.07788041 0.07795557 0.07803072 0.07810586 0.07818099 [193] 0.07825611 0.07833121 0.07840630 0.07848139 0.07855646 0.07863152 [199] 0.07870656 0.07878160 0.07885662 0.07893164 0.07900664 0.07908162 [205] 0.07915660 0.07923157 0.07930652 0.07938146 0.07945639 0.07953130 [211] 0.07960621 0.07968110 0.07975598 0.07983084 0.07990570 0.07998054 [217] 0.08005537 0.08013018 0.08020499 0.08027978 0.08035455 0.08042932 [223] 0.08050407 0.08057881 0.08065354 0.08072825 0.08080295 0.08087763 [229] 0.08095231 0.08102696 0.08110161 0.08117624 0.08125086 0.08132547 [235] 0.08140006 0.08147464 0.08154920 0.08162375 0.08169829 0.08177281 [241] 0.08184732 0.08192181 0.08199629 0.08207075 0.08214521 0.08221964 [247] 0.08229407 0.08236847 0.08244287 0.08251725 0.08259161 0.08266596 [253] 0.08274030 0.08281462 0.08288892 0.08296321 0.08303749 0.08311175 [259] 0.08318599 0.08326022 0.08333444 0.08340864 0.08348282 0.08355699 [265] 0.08363115 0.08370528 0.08377941 0.08385351 0.08392761 0.08400168 [271] 0.08407574 0.08414978 0.08422381 0.08429782 0.08437182 0.08444580 [277] 0.08451976 0.08459371 0.08466764 0.08474156 0.08481545 0.08488934 [283] 0.08496320 0.08503705 0.08511088 0.08518470 0.08525850 0.08533228 [289] 0.08540604 0.08547979 0.08555352 0.08562723 0.08570093 0.08577461 [295] 0.08584827 0.08592192 0.08599554 0.08606915 0.08614275 0.08621632 [301] 0.08628988 0.08636342 0.08643694 0.08651044 0.08658393 0.08665740 [307] 0.08673085 0.08680428 0.08687769 0.08695109 0.08702447 0.08709783 [313] 0.08717117 0.08724449 0.08731779 0.08739108 0.08746435 0.08753760 [319] 0.08761082 0.08768404 0.08775723 0.08783040 0.08790355 0.08797669 [325] 0.08804980 0.08812290 0.08819598 0.08826904 0.08834208 0.08841509 [331] 0.08848809 0.08856107 0.08863404 0.08870698 0.08877990 0.08885280 [337] 0.08892568 0.08899854 0.08907138 0.08914421 0.08921701 0.08928979 [343] 0.08936255 0.08943529 0.08950801 0.08958071 0.08965339 0.08972605 [349] 0.08979869 0.08987131 0.08994390 0.09001648 0.09008903 0.09016157 [355] 0.09023408 0.09030657 0.09037905 0.09045150 0.09052393 0.09059633 [361] 0.09066872 0.09074108 0.09081343 0.09088575 0.09095805 0.09103033 [367] 0.09110258 0.09117482 0.09124703 0.09131922 0.09139139 0.09146354 [373] 0.09153566 0.09160777 0.09167985 0.09175191 0.09182394 0.09189595 [379] 0.09196795 0.09203991 0.09211186 0.09218378 0.09225568 0.09232756 [385] 0.09239941 0.09247125 0.09254305 0.09261484 0.09268660 0.09275834 [391] 0.09283006 0.09290175 0.09297342 0.09304506 0.09311668 0.09318828 [397] 0.09325986 0.09333141 0.09340293 0.09347444 0.09354592 > mx [1] 0.09354592 > 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/17vbi1226317478.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/2gmrf1226317478.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/3dwfq1226317478.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/45o9h1226317478.tab") > > system("convert tmp/17vbi1226317478.ps tmp/17vbi1226317478.png") > system("convert tmp/2gmrf1226317478.ps tmp/2gmrf1226317478.png") > system("convert tmp/3dwfq1226317478.ps tmp/3dwfq1226317478.png") > > > proc.time() user system elapsed 1.525 0.811 2.202