R version 2.7.0 (2008-04-22) 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(72.5,72.0,98.8,75.2,81.2,88.0,54.6,68.6,101.5,93.4,84.5,91.4,64.5,64.5,117.3,73.5,79.7,102.6,57.9,73.1,102.4,82.3,89.1,84.7,81.4,67.5,113.9,83.8,73.9,103.9,67.9,62.5,125.4,79.1,106.3,96.2,94.3,85.6,117.4,88.5,124.2,119.3,76.8,70.6,122.1,109.5,119.9,102.3,79.6,78.2,103.6,77.8,99.1,105.7,84.1,88.7,108.0,98.1,101.0,82.0) > x <- c(93.0,99.2,112.2,112.1,103.3,108.2,90.4,72.8,111.0,117.9,111.3,110.5,94.8,100.4,132.1,114.6,101.9,130.2,84.0,86.4,122.3,120.9,110.2,112.6,102.0,105.0,130.5,115.5,103.7,130.9,89.1,93.8,123.8,111.9,118.3,116.9,103.6,116.6,141.3,107.0,125.2,136.4,91.6,95.3,132.3,130.6,131.9,118.6,114.3,111.3,126.5,112.1,119.3,142.4,101.1,97.4,129.1,136.9,129.8,123.9) > #'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.7591451 0.7595213 0.7598965 0.7602707 0.7606439 0.7610161 0.7613873 [8] 0.7617575 0.7621266 0.7624948 0.7628620 0.7632282 0.7635934 0.7639575 [15] 0.7643207 0.7646828 0.7650440 0.7654041 0.7657632 0.7661213 0.7664785 [22] 0.7668345 0.7671896 0.7675437 0.7678967 0.7682488 0.7685998 0.7689498 [29] 0.7692988 0.7696468 0.7699937 0.7703397 0.7706846 0.7710285 0.7713714 [36] 0.7717133 0.7720541 0.7723939 0.7727328 0.7730706 0.7734073 0.7737431 [43] 0.7740778 0.7744115 0.7747442 0.7750758 0.7754065 0.7757361 0.7760647 [50] 0.7763923 0.7767188 0.7770443 0.7773688 0.7776923 0.7780147 0.7783362 [57] 0.7786566 0.7789759 0.7792943 0.7796116 0.7799279 0.7802432 0.7805574 [64] 0.7808706 0.7811828 0.7814940 0.7818041 0.7821132 0.7824213 0.7827284 [71] 0.7830344 0.7833394 0.7836434 0.7839463 0.7842482 0.7845491 0.7848490 [78] 0.7851479 0.7854457 0.7857425 0.7860382 0.7863330 0.7866267 0.7869194 [85] 0.7872110 0.7875017 0.7877913 0.7880799 0.7883674 0.7886540 0.7889395 [92] 0.7892240 0.7895074 0.7897899 0.7900713 0.7903516 0.7906310 0.7909094 [99] 0.7911867 0.7914630 0.7917382 0.7920125 0.7922857 0.7925579 0.7928291 [106] 0.7930993 0.7933684 0.7936365 0.7939036 0.7941697 0.7944348 0.7946988 [113] 0.7949618 0.7952238 0.7954848 0.7957448 0.7960038 0.7962617 0.7965186 [120] 0.7967745 0.7970294 0.7972833 0.7975362 0.7977880 0.7980388 0.7982887 [127] 0.7985375 0.7987853 0.7990321 0.7992778 0.7995226 0.7997664 0.8000091 [134] 0.8002508 0.8004916 0.8007313 0.8009700 0.8012077 0.8014444 0.8016801 [141] 0.8019148 0.8021485 0.8023812 0.8026129 0.8028436 0.8030733 0.8033019 [148] 0.8035296 0.8037563 0.8039820 0.8042067 0.8044304 0.8046531 0.8048748 [155] 0.8050955 0.8053152 0.8055339 0.8057516 0.8059684 0.8061841 0.8063989 [162] 0.8066126 0.8068254 0.8070372 0.8072480 0.8074578 0.8076667 0.8078745 [169] 0.8080814 0.8082872 0.8084921 0.8086960 0.8088990 0.8091009 0.8093019 [176] 0.8095019 0.8097009 0.8098990 0.8100960 0.8102921 0.8104872 0.8106814 [183] 0.8108746 0.8110668 0.8112580 0.8114483 0.8116376 0.8118259 0.8120133 [190] 0.8121997 0.8123851 0.8125696 0.8127531 0.8129356 0.8131172 0.8132979 [197] 0.8134775 0.8136562 0.8138340 0.8140108 0.8141866 0.8143615 0.8145355 [204] 0.8147085 0.8148805 0.8150516 0.8152217 0.8153909 0.8155592 0.8157265 [211] 0.8158929 0.8160583 0.8162227 0.8163863 0.8165489 0.8167105 0.8168712 [218] 0.8170310 0.8171899 0.8173478 0.8175048 0.8176608 0.8178159 0.8179701 [225] 0.8181234 0.8182757 0.8184271 0.8185776 0.8187271 0.8188758 0.8190235 [232] 0.8191703 0.8193161 0.8194611 0.8196051 0.8197482 0.8198904 0.8200317 [239] 0.8201721 0.8203116 0.8204501 0.8205878 0.8207245 0.8208603 0.8209953 [246] 0.8211293 0.8212624 0.8213946 0.8215259 0.8216563 0.8217859 0.8219145 [253] 0.8220422 0.8221690 0.8222950 0.8224200 0.8225442 0.8226674 0.8227898 [260] 0.8229113 0.8230319 0.8231516 0.8232704 0.8233884 0.8235054 0.8236216 [267] 0.8237370 0.8238514 0.8239649 0.8240776 0.8241894 0.8243004 0.8244104 [274] 0.8245196 0.8246280 0.8247354 0.8248420 0.8249478 0.8250526 0.8251566 [281] 0.8252598 0.8253621 0.8254635 0.8255641 0.8256638 0.8257627 0.8258607 [288] 0.8259578 0.8260542 0.8261496 0.8262442 0.8263380 0.8264309 0.8265230 [295] 0.8266142 0.8267046 0.8267942 0.8268829 0.8269708 0.8270579 0.8271441 [302] 0.8272295 0.8273140 0.8273977 0.8274806 0.8275627 0.8276439 0.8277243 [309] 0.8278039 0.8278827 0.8279606 0.8280378 0.8281141 0.8281896 0.8282642 [316] 0.8283381 0.8284112 0.8284834 0.8285548 0.8286255 0.8286953 0.8287643 [323] 0.8288325 0.8288999 0.8289665 0.8290323 0.8290973 0.8291615 0.8292249 [330] 0.8292875 0.8293493 0.8294104 0.8294706 0.8295301 0.8295887 0.8296466 [337] 0.8297037 0.8297600 0.8298155 0.8298703 0.8299242 0.8299774 0.8300298 [344] 0.8300815 0.8301323 0.8301824 0.8302317 0.8302803 0.8303280 0.8303751 [351] 0.8304213 0.8304668 0.8305115 0.8305555 0.8305987 0.8306411 0.8306828 [358] 0.8307237 0.8307639 0.8308033 0.8308419 0.8308799 0.8309170 0.8309534 [365] 0.8309891 0.8310240 0.8310582 0.8310917 0.8311244 0.8311563 0.8311876 [372] 0.8312181 0.8312478 0.8312768 0.8313051 0.8313327 0.8313595 0.8313856 [379] 0.8314110 0.8314356 0.8314595 0.8314827 0.8315052 0.8315270 0.8315480 [386] 0.8315684 0.8315880 0.8316069 0.8316251 0.8316425 0.8316593 0.8316753 [393] 0.8316907 0.8317053 0.8317193 0.8317325 0.8317450 0.8317569 0.8317680 [400] 0.8317784 0.8317882 > mx [1] 0.8317882 > 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/1mxm41228487196.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/2egn71228487196.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/3s7z41228487196.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/4endg1228487196.tab") > > system("convert tmp/1mxm41228487196.ps tmp/1mxm41228487196.png") > system("convert tmp/2egn71228487196.ps tmp/2egn71228487196.png") > system("convert tmp/3s7z41228487196.ps tmp/3s7z41228487196.png") > > > proc.time() user system elapsed 1.879 0.837 1.989