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(64.5,57.9,72.5,82.9,62.7,66.6,70.9,56.3,81.2,67.8,57.2,62.8,51.2,66.5,71.5,67.8,56.9,90.6,64.1,65.7,77.9,84.2,81.7,65.9,76.1,80.1,74.3,86.5,70.9,91.5,93.7,77.5,100.3,85.7,95,73.7,87.6,87.6,92.9,80.7,74,87.7,68.2,117.4,100.1,97.7,101.1,87.6,83.2,85.9,118,87.3,79.5,93.2,99.2,66.6,83.9,100.4,73.5,60.8) > x <- c(744.8,672.1,666.6,760.8,756,604.4,883.9,527.9,756.2,812.9,655.6,707.6,612.6,659.2,833.4,727.8,797.2,753,762,613.7,759.2,816.4,736.8,680.1,736.5,637.2,801.9,772.3,897.3,792.1,826.8,666.8,906.6,871.4,891,739.2,833.6,715.6,871.6,751.6,1005.5,681.2,837.3,674.7,806.3,860.2,689.8,691.6,682.6,800.1,1023.7,733.5,875.3,770.2,1005.7,982.3,742.9,974.2,822.3,773.2) > #'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.4148218 0.4148364 0.4148507 0.4148648 0.4148785 0.4148920 0.4149052 [8] 0.4149181 0.4149308 0.4149431 0.4149552 0.4149670 0.4149785 0.4149897 [15] 0.4150007 0.4150114 0.4150218 0.4150319 0.4150417 0.4150513 0.4150606 [22] 0.4150696 0.4150784 0.4150868 0.4150950 0.4151029 0.4151106 0.4151180 [29] 0.4151250 0.4151319 0.4151384 0.4151447 0.4151507 0.4151564 0.4151619 [36] 0.4151671 0.4151720 0.4151767 0.4151811 0.4151852 0.4151891 0.4151926 [43] 0.4151960 0.4151990 0.4152018 0.4152043 0.4152066 0.4152086 0.4152103 [50] 0.4152118 0.4152130 0.4152139 0.4152146 0.4152150 0.4152151 0.4152150 [57] 0.4152147 0.4152140 0.4152131 0.4152120 0.4152106 0.4152089 0.4152070 [64] 0.4152048 0.4152024 0.4151997 0.4151967 0.4151935 0.4151901 0.4151863 [71] 0.4151824 0.4151781 0.4151737 0.4151689 0.4151640 0.4151587 0.4151532 [78] 0.4151475 0.4151415 0.4151353 0.4151288 0.4151221 0.4151151 0.4151079 [85] 0.4151004 0.4150927 0.4150847 0.4150765 0.4150681 0.4150594 0.4150504 [92] 0.4150412 0.4150318 0.4150221 0.4150122 0.4150020 0.4149916 0.4149810 [99] 0.4149701 0.4149590 0.4149476 0.4149361 0.4149242 0.4149121 0.4148998 [106] 0.4148873 0.4148745 0.4148615 0.4148482 0.4148347 0.4148210 0.4148071 [113] 0.4147929 0.4147785 0.4147638 0.4147489 0.4147338 0.4147185 0.4147029 [120] 0.4146871 0.4146711 0.4146548 0.4146383 0.4146216 0.4146047 0.4145875 [127] 0.4145701 0.4145525 0.4145346 0.4145166 0.4144983 0.4144797 0.4144610 [134] 0.4144421 0.4144229 0.4144035 0.4143838 0.4143640 0.4143439 0.4143237 [141] 0.4143032 0.4142824 0.4142615 0.4142404 0.4142190 0.4141974 0.4141756 [148] 0.4141536 0.4141314 0.4141089 0.4140863 0.4140634 0.4140403 0.4140170 [155] 0.4139935 0.4139698 0.4139459 0.4139218 0.4138974 0.4138729 0.4138481 [162] 0.4138232 0.4137980 0.4137726 0.4137470 0.4137212 0.4136952 0.4136690 [169] 0.4136426 0.4136160 0.4135892 0.4135622 0.4135350 0.4135076 0.4134800 [176] 0.4134522 0.4134242 0.4133960 0.4133676 0.4133390 0.4133102 0.4132812 [183] 0.4132520 0.4132226 0.4131930 0.4131632 0.4131332 0.4131031 0.4130727 [190] 0.4130422 0.4130114 0.4129805 0.4129493 0.4129180 0.4128865 0.4128548 [197] 0.4128229 0.4127909 0.4127586 0.4127262 0.4126935 0.4126607 0.4126277 [204] 0.4125945 0.4125611 0.4125276 0.4124938 0.4124599 0.4124258 0.4123915 [211] 0.4123570 0.4123224 0.4122875 0.4122525 0.4122173 0.4121819 0.4121464 [218] 0.4121107 0.4120748 0.4120387 0.4120024 0.4119660 0.4119294 0.4118926 [225] 0.4118556 0.4118185 0.4117812 0.4117437 0.4117061 0.4116682 0.4116303 [232] 0.4115921 0.4115538 0.4115153 0.4114766 0.4114378 0.4113987 0.4113596 [239] 0.4113202 0.4112807 0.4112411 0.4112012 0.4111612 0.4111210 0.4110807 [246] 0.4110402 0.4109996 0.4109588 0.4109178 0.4108766 0.4108353 0.4107939 [253] 0.4107522 0.4107105 0.4106685 0.4106264 0.4105842 0.4105418 0.4104992 [260] 0.4104565 0.4104136 0.4103706 0.4103274 0.4102840 0.4102405 0.4101969 [267] 0.4101531 0.4101091 0.4100650 0.4100208 0.4099763 0.4099318 0.4098871 [274] 0.4098422 0.4097972 0.4097521 0.4097068 0.4096613 0.4096157 0.4095700 [281] 0.4095241 0.4094781 0.4094319 0.4093856 0.4093391 0.4092925 0.4092458 [288] 0.4091989 0.4091518 0.4091047 0.4090574 0.4090099 0.4089623 0.4089146 [295] 0.4088667 0.4088187 0.4087706 0.4087223 0.4086739 0.4086253 0.4085766 [302] 0.4085278 0.4084788 0.4084297 0.4083805 0.4083311 0.4082816 0.4082320 [309] 0.4081823 0.4081324 0.4080823 0.4080322 0.4079819 0.4079315 0.4078810 [316] 0.4078303 0.4077795 0.4077286 0.4076775 0.4076263 0.4075750 0.4075236 [323] 0.4074721 0.4074204 0.4073686 0.4073166 0.4072646 0.4072124 0.4071601 [330] 0.4071077 0.4070552 0.4070025 0.4069497 0.4068968 0.4068438 0.4067907 [337] 0.4067374 0.4066841 0.4066306 0.4065770 0.4065232 0.4064694 0.4064154 [344] 0.4063614 0.4063072 0.4062529 0.4061985 0.4061439 0.4060893 0.4060345 [351] 0.4059797 0.4059247 0.4058696 0.4058144 0.4057591 0.4057037 0.4056481 [358] 0.4055925 0.4055367 0.4054809 0.4054249 0.4053689 0.4053127 0.4052564 [365] 0.4052000 0.4051435 0.4050869 0.4050302 0.4049734 0.4049165 0.4048595 [372] 0.4048024 0.4047451 0.4046878 0.4046304 0.4045729 0.4045152 0.4044575 [379] 0.4043997 0.4043418 0.4042837 0.4042256 0.4041674 0.4041091 0.4040507 [386] 0.4039922 0.4039336 0.4038749 0.4038161 0.4037572 0.4036982 0.4036391 [393] 0.4035799 0.4035207 0.4034613 0.4034019 0.4033423 0.4032827 0.4032230 [400] 0.4031632 0.4031032 > mx [1] 0.4152151 > mxli [1] -1.46 > 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/12x2k1226347023.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/28rqa1226347023.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/3it8w1226347023.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/4e2xv1226347023.tab") > > system("convert tmp/12x2k1226347023.ps tmp/12x2k1226347023.png") > system("convert tmp/28rqa1226347023.ps tmp/28rqa1226347023.png") > system("convert tmp/3it8w1226347023.ps tmp/3it8w1226347023.png") > > > proc.time() user system elapsed 0.989 0.502 1.528