R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(91.25,91.5,91.68,91.81,91.84,91.93,92.08,92.11,92.26,92.28,92.39,92.46,92.82,93.16,93.33,93.51,93.56,93.67,93.76,93.88,94.01,94.21,94.31,94.4,94.9,95.31,95.52,95.68,95.91,95.97,96.15,96.34,96.42,96.54,96.72,96.81,97.19,97.5,97.71,97.86,98.04,98.2,98.25,98.41,98.56,98.62,98.75,98.71,99.05,99.52,99.71,99.8,100.01,99.99,100.12,100.15,100.27,100.42,100.43,100.5,100.95,101.26,101.42,101.68,101.75,101.89,102.07,102.22,102.45,102.62,102.67,102.86,104.78,104.87,105.06,105.14,105.32,105.54,105.68,105.77,106.07,106.03,106.13,106.28,106.61,106.74,107.01,107.1,107.28,107.4,107.59,107.69,107.78) > x <- c(90.49,90.65,90.95,91.19,91.07,91.15,91.81,91.95,91.62,91.27,91.4,91.76,91.99,92.34,92.3,92.85,92.94,93.26,94.21,94.08,93.98,94.23,94.93,95.09,95.37,96.23,96.2,95.43,95.63,95.96,96.51,96.65,96.21,95.54,95.96,96.41,96.32,96.94,96.97,97.63,97.33,97.66,98.18,98.22,97.91,97.93,98.4,98.78,98.73,99.4,99.04,99.68,99.62,99.8,100.65,100.59,100.46,100.57,100.75,100.7,101.44,101.77,101.79,101.52,101.83,102.23,103.04,102.81,102.48,102.81,103.21,103.21,102.92,103.48,103.18,103.39,103.5,103.73,104.42,104.53,104.09,104.23,104.23,104.54,104.65,105.48,105.61,105.74,105.86,105.81,106.49,106.43,105.73) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Linearity Plot (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxlin.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.9812971 0.9813287 0.9813603 0.9813918 0.9814232 0.9814546 0.9814860 [8] 0.9815173 0.9815486 0.9815799 0.9816111 0.9816422 0.9816733 0.9817044 [15] 0.9817354 0.9817664 0.9817973 0.9818282 0.9818591 0.9818899 0.9819207 [22] 0.9819514 0.9819821 0.9820127 0.9820433 0.9820739 0.9821044 0.9821348 [29] 0.9821653 0.9821956 0.9822260 0.9822563 0.9822865 0.9823167 0.9823469 [36] 0.9823770 0.9824071 0.9824371 0.9824671 0.9824971 0.9825270 0.9825568 [43] 0.9825866 0.9826164 0.9826461 0.9826758 0.9827055 0.9827351 0.9827646 [50] 0.9827941 0.9828236 0.9828530 0.9828824 0.9829117 0.9829410 0.9829703 [57] 0.9829995 0.9830287 0.9830578 0.9830869 0.9831159 0.9831449 0.9831738 [64] 0.9832027 0.9832316 0.9832604 0.9832892 0.9833179 0.9833466 0.9833752 [71] 0.9834038 0.9834324 0.9834609 0.9834894 0.9835178 0.9835462 0.9835745 [78] 0.9836028 0.9836310 0.9836592 0.9836874 0.9837155 0.9837436 0.9837716 [85] 0.9837996 0.9838276 0.9838555 0.9838833 0.9839111 0.9839389 0.9839666 [92] 0.9839943 0.9840219 0.9840495 0.9840771 0.9841046 0.9841320 0.9841595 [99] 0.9841868 0.9842142 0.9842414 0.9842687 0.9842959 0.9843230 0.9843501 [106] 0.9843772 0.9844042 0.9844312 0.9844581 0.9844850 0.9845119 0.9845387 [113] 0.9845654 0.9845921 0.9846188 0.9846454 0.9846720 0.9846986 0.9847251 [120] 0.9847515 0.9847779 0.9848043 0.9848306 0.9848569 0.9848831 0.9849093 [127] 0.9849354 0.9849615 0.9849876 0.9850136 0.9850395 0.9850655 0.9850913 [134] 0.9851172 0.9851430 0.9851687 0.9851944 0.9852201 0.9852457 0.9852712 [141] 0.9852968 0.9853222 0.9853477 0.9853731 0.9853984 0.9854237 0.9854490 [148] 0.9854742 0.9854994 0.9855245 0.9855496 0.9855746 0.9855996 0.9856245 [155] 0.9856494 0.9856743 0.9856991 0.9857239 0.9857486 0.9857733 0.9857979 [162] 0.9858225 0.9858471 0.9858716 0.9858961 0.9859205 0.9859448 0.9859692 [169] 0.9859935 0.9860177 0.9860419 0.9860660 0.9860901 0.9861142 0.9861382 [176] 0.9861622 0.9861861 0.9862100 0.9862339 0.9862577 0.9862814 0.9863051 [183] 0.9863288 0.9863524 0.9863760 0.9863995 0.9864230 0.9864464 0.9864698 [190] 0.9864932 0.9865165 0.9865397 0.9865630 0.9865861 0.9866093 0.9866323 [197] 0.9866554 0.9866784 0.9867013 0.9867242 0.9867471 0.9867699 0.9867927 [204] 0.9868154 0.9868381 0.9868607 0.9868833 0.9869059 0.9869284 0.9869508 [211] 0.9869733 0.9869956 0.9870180 0.9870402 0.9870625 0.9870847 0.9871068 [218] 0.9871289 0.9871510 0.9871730 0.9871950 0.9872169 0.9872388 0.9872606 [225] 0.9872824 0.9873042 0.9873259 0.9873475 0.9873691 0.9873907 0.9874122 [232] 0.9874337 0.9874551 0.9874765 0.9874979 0.9875192 0.9875404 0.9875617 [239] 0.9875828 0.9876039 0.9876250 0.9876461 0.9876670 0.9876880 0.9877089 [246] 0.9877297 0.9877505 0.9877713 0.9877920 0.9878127 0.9878333 0.9878539 [253] 0.9878745 0.9878950 0.9879154 0.9879358 0.9879562 0.9879765 0.9879968 [260] 0.9880170 0.9880372 0.9880573 0.9880774 0.9880975 0.9881175 0.9881374 [267] 0.9881573 0.9881772 0.9881970 0.9882168 0.9882366 0.9882562 0.9882759 [274] 0.9882955 0.9883150 0.9883346 0.9883540 0.9883735 0.9883928 0.9884122 [281] 0.9884314 0.9884507 0.9884699 0.9884890 0.9885082 0.9885272 0.9885462 [288] 0.9885652 0.9885841 0.9886030 0.9886219 0.9886407 0.9886594 0.9886781 [295] 0.9886968 0.9887154 0.9887340 0.9887525 0.9887710 0.9887894 0.9888078 [302] 0.9888261 0.9888444 0.9888627 0.9888809 0.9888991 0.9889172 0.9889353 [309] 0.9889533 0.9889713 0.9889892 0.9890071 0.9890250 0.9890428 0.9890606 [316] 0.9890783 0.9890960 0.9891136 0.9891312 0.9891487 0.9891662 0.9891836 [323] 0.9892011 0.9892184 0.9892357 0.9892530 0.9892702 0.9892874 0.9893045 [330] 0.9893216 0.9893387 0.9893557 0.9893726 0.9893895 0.9894064 0.9894232 [337] 0.9894400 0.9894567 0.9894734 0.9894901 0.9895067 0.9895232 0.9895397 [344] 0.9895562 0.9895726 0.9895890 0.9896053 0.9896216 0.9896378 0.9896540 [351] 0.9896702 0.9896863 0.9897023 0.9897183 0.9897343 0.9897502 0.9897661 [358] 0.9897819 0.9897977 0.9898135 0.9898292 0.9898448 0.9898604 0.9898760 [365] 0.9898915 0.9899070 0.9899224 0.9899378 0.9899531 0.9899684 0.9899837 [372] 0.9899989 0.9900141 0.9900292 0.9900442 0.9900593 0.9900742 0.9900892 [379] 0.9901041 0.9901189 0.9901337 0.9901485 0.9901632 0.9901779 0.9901925 [386] 0.9902071 0.9902216 0.9902361 0.9902505 0.9902649 0.9902793 0.9902936 [393] 0.9903078 0.9903221 0.9903362 0.9903504 0.9903644 0.9903785 0.9903925 [400] 0.9904064 0.9904203 > mx [1] 0.9904203 > 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/16k2v1194253695.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/28zk01194253695.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/3sdgw1194253695.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 > 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/4vwpi1194253696.tab") > > system("convert tmp/16k2v1194253695.ps tmp/16k2v1194253695.png") > system("convert tmp/28zk01194253695.ps tmp/28zk01194253695.png") > system("convert tmp/3sdgw1194253695.ps tmp/3sdgw1194253695.png") > > > proc.time() user system elapsed 1.850 0.818 1.964