R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(128.6,128.9,129.06,129.23,129.27,129.33,129.35,129.31,129.4,129.49,129.47,129.46,129.45,129.28,129.2,129.25,129.14,129.11,129.02,129.08,128.99,129.11,129.08,129.19,129.23,129.25,129.31,129.33,129.39,129.55,129.43,129.45,129.57,129.76,129.92,130.08,130.41,130.84,131.24,131.49,131.74,132.34,133.5,134.43,136.5,137.41,138.02,138.15,138.24,138.2,138.31,138.65,139.3,139.8,140.52,141.57,141.77,141.66,141.36,141.17) > x <- c(131.6,132.05,132.4,132.57,133.02,133.47,133.66,133.96,134.19,134.93,134.9,135.05,135.16,135.23,135.15,135.12,137.29,137.41,137.44,137.62,137.78,137.98,138.06,138.16,138.28,138.33,138.43,138.44,138.41,138.55,138.64,138.72,138.9,139.02,139.04,139.15,139.3,140.73,141.84,141.95,142.1,142.36,142.58,142.75,142.85,143.03,143.19,143.62,143.89,144.69,147.51,147.78,148.04,148.21,148.29,148.34,148.33,148.38,148.37,148.37) > #'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.8869391 0.8870053 0.8870716 0.8871377 0.8872039 0.8872700 0.8873361 [8] 0.8874021 0.8874682 0.8875341 0.8876001 0.8876660 0.8877319 0.8877977 [15] 0.8878636 0.8879293 0.8879951 0.8880608 0.8881265 0.8881921 0.8882577 [22] 0.8883233 0.8883889 0.8884544 0.8885199 0.8885853 0.8886507 0.8887161 [29] 0.8887814 0.8888468 0.8889120 0.8889773 0.8890425 0.8891077 0.8891728 [36] 0.8892379 0.8893030 0.8893680 0.8894330 0.8894980 0.8895630 0.8896279 [43] 0.8896927 0.8897576 0.8898224 0.8898871 0.8899519 0.8900166 0.8900813 [50] 0.8901459 0.8902105 0.8902751 0.8903396 0.8904041 0.8904686 0.8905330 [57] 0.8905974 0.8906618 0.8907261 0.8907904 0.8908546 0.8909189 0.8909831 [64] 0.8910472 0.8911114 0.8911754 0.8912395 0.8913035 0.8913675 0.8914315 [71] 0.8914954 0.8915593 0.8916231 0.8916870 0.8917507 0.8918145 0.8918782 [78] 0.8919419 0.8920055 0.8920692 0.8921327 0.8921963 0.8922598 0.8923233 [85] 0.8923867 0.8924501 0.8925135 0.8925769 0.8926402 0.8927034 0.8927667 [92] 0.8928299 0.8928930 0.8929562 0.8930193 0.8930823 0.8931454 0.8932084 [99] 0.8932713 0.8933343 0.8933972 0.8934600 0.8935229 0.8935856 0.8936484 [106] 0.8937111 0.8937738 0.8938365 0.8938991 0.8939617 0.8940242 0.8940868 [113] 0.8941492 0.8942117 0.8942741 0.8943365 0.8943988 0.8944611 0.8945234 [120] 0.8945856 0.8946479 0.8947100 0.8947722 0.8948343 0.8948963 0.8949584 [127] 0.8950204 0.8950823 0.8951443 0.8952062 0.8952680 0.8953299 0.8953916 [134] 0.8954534 0.8955151 0.8955768 0.8956385 0.8957001 0.8957617 0.8958232 [141] 0.8958847 0.8959462 0.8960077 0.8960691 0.8961304 0.8961918 0.8962531 [148] 0.8963144 0.8963756 0.8964368 0.8964980 0.8965591 0.8966202 0.8966813 [155] 0.8967423 0.8968033 0.8968643 0.8969252 0.8969861 0.8970469 0.8971077 [162] 0.8971685 0.8972293 0.8972900 0.8973507 0.8974113 0.8974719 0.8975325 [169] 0.8975930 0.8976536 0.8977140 0.8977745 0.8978349 0.8978952 0.8979556 [176] 0.8980159 0.8980761 0.8981363 0.8981965 0.8982567 0.8983168 0.8983769 [183] 0.8984370 0.8984970 0.8985570 0.8986169 0.8986768 0.8987367 0.8987965 [190] 0.8988563 0.8989161 0.8989759 0.8990356 0.8990952 0.8991549 0.8992144 [197] 0.8992740 0.8993335 0.8993930 0.8994525 0.8995119 0.8995713 0.8996306 [204] 0.8996900 0.8997492 0.8998085 0.8998677 0.8999269 0.8999860 0.9000451 [211] 0.9001042 0.9001632 0.9002222 0.9002812 0.9003401 0.9003990 0.9004579 [218] 0.9005167 0.9005755 0.9006342 0.9006929 0.9007516 0.9008103 0.9008689 [225] 0.9009275 0.9009860 0.9010445 0.9011030 0.9011614 0.9012198 0.9012782 [232] 0.9013365 0.9013948 0.9014531 0.9015113 0.9015695 0.9016276 0.9016857 [239] 0.9017438 0.9018019 0.9018599 0.9019179 0.9019758 0.9020337 0.9020916 [246] 0.9021494 0.9022072 0.9022650 0.9023227 0.9023804 0.9024380 0.9024957 [253] 0.9025533 0.9026108 0.9026683 0.9027258 0.9027832 0.9028407 0.9028980 [260] 0.9029554 0.9030127 0.9030699 0.9031272 0.9031844 0.9032415 0.9032986 [267] 0.9033557 0.9034128 0.9034698 0.9035268 0.9035837 0.9036407 0.9036975 [274] 0.9037544 0.9038112 0.9038679 0.9039247 0.9039814 0.9040380 0.9040947 [281] 0.9041513 0.9042078 0.9042643 0.9043208 0.9043773 0.9044337 0.9044901 [288] 0.9045464 0.9046027 0.9046590 0.9047152 0.9047714 0.9048276 0.9048837 [295] 0.9049398 0.9049959 0.9050519 0.9051079 0.9051638 0.9052197 0.9052756 [302] 0.9053315 0.9053873 0.9054430 0.9054988 0.9055545 0.9056101 0.9056658 [309] 0.9057214 0.9057769 0.9058324 0.9058879 0.9059434 0.9059988 0.9060542 [316] 0.9061095 0.9061648 0.9062201 0.9062753 0.9063305 0.9063857 0.9064408 [323] 0.9064959 0.9065510 0.9066060 0.9066610 0.9067159 0.9067708 0.9068257 [330] 0.9068806 0.9069354 0.9069901 0.9070449 0.9070996 0.9071542 0.9072089 [337] 0.9072634 0.9073180 0.9073725 0.9074270 0.9074815 0.9075359 0.9075902 [344] 0.9076446 0.9076989 0.9077532 0.9078074 0.9078616 0.9079157 0.9079699 [351] 0.9080240 0.9080780 0.9081320 0.9081860 0.9082399 0.9082939 0.9083477 [358] 0.9084016 0.9084554 0.9085091 0.9085629 0.9086166 0.9086702 0.9087238 [365] 0.9087774 0.9088310 0.9088845 0.9089380 0.9089914 0.9090448 0.9090982 [372] 0.9091515 0.9092048 0.9092581 0.9093113 0.9093645 0.9094176 0.9094707 [379] 0.9095238 0.9095769 0.9096299 0.9096829 0.9097358 0.9097887 0.9098416 [386] 0.9098944 0.9099472 0.9099999 0.9100527 0.9101053 0.9101580 0.9102106 [393] 0.9102632 0.9103157 0.9103682 0.9104207 0.9104731 0.9105255 0.9105779 [400] 0.9106302 0.9106825 > mx [1] 0.9106825 > 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/1vdsh1257514405.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/27sv81257514405.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/3camd1257514405.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/4s2cs1257514405.tab") > > system("convert tmp/1vdsh1257514405.ps tmp/1vdsh1257514405.png") > system("convert tmp/27sv81257514405.ps tmp/27sv81257514405.png") > system("convert tmp/3camd1257514405.ps tmp/3camd1257514405.png") > > > proc.time() user system elapsed 0.744 0.487 0.939