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(96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6) > x <- c(92.9,107.7,103.5,91.1,79.8,71.9,82.9,90.1,100.7,90.7,108.8,44.1,93.6,107.4,96.5,93.6,76.5,76.7,84,103.3,88.5,99,105.9,44.7,94,107.1,104.8,102.5,77.7,85.2,91.3,106.5,92.4,97.5,107,51.1,98.6,102.2,114.3,99.4,72.5,92.3,99.4,85.9,109.4,97.6,104.7,56.9,86.7,108.5,103.4,86.2,71,75.9,87.1,102,88.5,87.8,100.8,50.6) > #'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.7349495 0.7354452 0.7359410 0.7364368 0.7369328 0.7374288 0.7379248 [8] 0.7384209 0.7389171 0.7394133 0.7399095 0.7404057 0.7409020 0.7413983 [15] 0.7418946 0.7423909 0.7428872 0.7433834 0.7438797 0.7443759 0.7448721 [22] 0.7453682 0.7458643 0.7463603 0.7468562 0.7473521 0.7478479 0.7483436 [29] 0.7488392 0.7493347 0.7498301 0.7503254 0.7508206 0.7513156 0.7518104 [36] 0.7523052 0.7527997 0.7532942 0.7537884 0.7542824 0.7547763 0.7552700 [43] 0.7557635 0.7562567 0.7567498 0.7572426 0.7577352 0.7582276 0.7587197 [50] 0.7592115 0.7597031 0.7601944 0.7606855 0.7611762 0.7616667 0.7621568 [57] 0.7626467 0.7631362 0.7636254 0.7641143 0.7646028 0.7650910 0.7655788 [64] 0.7660663 0.7665534 0.7670401 0.7675264 0.7680124 0.7684979 0.7689830 [71] 0.7694677 0.7699520 0.7704358 0.7709192 0.7714022 0.7718847 0.7723667 [78] 0.7728482 0.7733293 0.7738099 0.7742900 0.7747696 0.7752486 0.7757272 [85] 0.7762052 0.7766827 0.7771596 0.7776360 0.7781118 0.7785871 0.7790618 [92] 0.7795359 0.7800094 0.7804823 0.7809547 0.7814264 0.7818974 0.7823679 [99] 0.7828377 0.7833069 0.7837754 0.7842433 0.7847105 0.7851770 0.7856428 [106] 0.7861080 0.7865724 0.7870362 0.7874992 0.7879616 0.7884232 0.7888840 [113] 0.7893441 0.7898035 0.7902621 0.7907200 0.7911771 0.7916334 0.7920889 [120] 0.7925436 0.7929975 0.7934506 0.7939029 0.7943544 0.7948051 0.7952549 [127] 0.7957039 0.7961520 0.7965993 0.7970457 0.7974912 0.7979358 0.7983796 [134] 0.7988225 0.7992645 0.7997055 0.8001457 0.8005849 0.8010232 0.8014606 [141] 0.8018971 0.8023326 0.8027671 0.8032007 0.8036333 0.8040649 0.8044956 [148] 0.8049253 0.8053540 0.8057817 0.8062084 0.8066340 0.8070587 0.8074823 [155] 0.8079049 0.8083265 0.8087470 0.8091665 0.8095849 0.8100023 0.8104186 [162] 0.8108338 0.8112480 0.8116611 0.8120730 0.8124839 0.8128937 0.8133024 [169] 0.8137099 0.8141164 0.8145217 0.8149259 0.8153290 0.8157309 0.8161317 [176] 0.8165313 0.8169298 0.8173271 0.8177232 0.8181182 0.8185120 0.8189046 [183] 0.8192961 0.8196863 0.8200753 0.8204632 0.8208498 0.8212353 0.8216195 [190] 0.8220025 0.8223842 0.8227648 0.8231441 0.8235222 0.8238990 0.8242746 [197] 0.8246489 0.8250220 0.8253938 0.8257644 0.8261336 0.8265017 0.8268684 [204] 0.8272339 0.8275980 0.8279609 0.8283225 0.8286828 0.8290418 0.8293995 [211] 0.8297559 0.8301110 0.8304648 0.8308172 0.8311684 0.8315182 0.8318667 [218] 0.8322138 0.8325597 0.8329042 0.8332473 0.8335891 0.8339296 0.8342687 [225] 0.8346065 0.8349429 0.8352779 0.8356116 0.8359440 0.8362749 0.8366045 [232] 0.8369328 0.8372597 0.8375851 0.8379093 0.8382320 0.8385534 0.8388733 [239] 0.8391919 0.8395091 0.8398249 0.8401394 0.8404524 0.8407640 0.8410743 [246] 0.8413831 0.8416905 0.8419966 0.8423012 0.8426044 0.8429063 0.8432067 [253] 0.8435057 0.8438033 0.8440995 0.8443942 0.8446876 0.8449795 0.8452701 [260] 0.8455592 0.8458469 0.8461331 0.8464180 0.8467014 0.8469834 0.8472640 [267] 0.8475432 0.8478210 0.8480973 0.8483722 0.8486456 0.8489177 0.8491883 [274] 0.8494575 0.8497253 0.8499916 0.8502565 0.8505200 0.8507821 0.8510427 [281] 0.8513019 0.8515597 0.8518161 0.8520710 0.8523245 0.8525766 0.8528272 [288] 0.8530765 0.8533243 0.8535706 0.8538156 0.8540591 0.8543012 0.8545419 [295] 0.8547812 0.8550190 0.8552554 0.8554905 0.8557240 0.8559562 0.8561870 [302] 0.8564163 0.8566442 0.8568707 0.8570958 0.8573195 0.8575418 0.8577627 [309] 0.8579821 0.8582002 0.8584168 0.8586321 0.8588459 0.8590584 0.8592694 [316] 0.8594791 0.8596873 0.8598942 0.8600997 0.8603037 0.8605064 0.8607077 [323] 0.8609077 0.8611062 0.8613033 0.8614991 0.8616935 0.8618865 0.8620782 [330] 0.8622684 0.8624573 0.8626449 0.8628310 0.8630158 0.8631993 0.8633814 [337] 0.8635621 0.8637415 0.8639195 0.8640962 0.8642715 0.8644455 0.8646181 [344] 0.8647894 0.8649594 0.8651280 0.8652953 0.8654613 0.8656259 0.8657892 [351] 0.8659512 0.8661119 0.8662713 0.8664293 0.8665860 0.8667415 0.8668956 [358] 0.8670484 0.8671999 0.8673502 0.8674991 0.8676468 0.8677931 0.8679382 [365] 0.8680820 0.8682245 0.8683657 0.8685057 0.8686444 0.8687818 0.8689180 [372] 0.8690529 0.8691866 0.8693190 0.8694501 0.8695800 0.8697087 0.8698361 [379] 0.8699623 0.8700873 0.8702110 0.8703335 0.8704548 0.8705749 0.8706937 [386] 0.8708113 0.8709278 0.8710430 0.8711570 0.8712698 0.8713814 0.8714919 [393] 0.8716011 0.8717092 0.8718160 0.8719217 0.8720263 0.8721296 0.8722318 [400] 0.8723328 0.8724327 > mx [1] 0.8724327 > 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/1xeva1258362817.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/20wo01258362817.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/3ki2l1258362817.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/4ky9m1258362817.tab") > > system("convert tmp/1xeva1258362817.ps tmp/1xeva1258362817.png") > system("convert tmp/20wo01258362817.ps tmp/20wo01258362817.png") > system("convert tmp/3ki2l1258362817.ps tmp/3ki2l1258362817.png") > > > proc.time() user system elapsed 0.774 0.497 1.293