R version 2.8.0 (2008-10-20) 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(99.3,98.7,107.9,101.0,97.6,103.0,94.1,94.1,115.1,116.5,103.4,112.5,95.6,97.5,119.3,100.9,97.7,115.3,92.8,99.2,118.7,110.1,110.3,112.9,102.2,99.4,116.1,103.8,101.8,113.7,89.7,99.5,122.9,108.6,114.4,110.5,104.1,103.6,121.6,101.1,116.0,120.1,96.0,105.0,124.7,123.9,123.6,114.8,108.8,106.1,123.2,106.2,115.2,120.6,109.5,114.4,121.4,129.5,124.3,112.6) > x <- 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) > #'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.8360927 0.8364103 0.8367265 0.8370414 0.8373549 0.8376671 0.8379780 [8] 0.8382875 0.8385956 0.8389024 0.8392079 0.8395120 0.8398147 0.8401160 [15] 0.8404160 0.8407147 0.8410119 0.8413078 0.8416023 0.8418954 0.8421872 [22] 0.8424776 0.8427666 0.8430542 0.8433404 0.8436252 0.8439087 0.8441907 [29] 0.8444714 0.8447506 0.8450285 0.8453049 0.8455800 0.8458536 0.8461259 [36] 0.8463967 0.8466662 0.8469342 0.8472008 0.8474660 0.8477298 0.8479921 [43] 0.8482531 0.8485126 0.8487707 0.8490274 0.8492826 0.8495364 0.8497888 [50] 0.8500398 0.8502894 0.8505375 0.8507841 0.8510294 0.8512732 0.8515155 [57] 0.8517564 0.8519959 0.8522340 0.8524706 0.8527057 0.8529394 0.8531717 [64] 0.8534025 0.8536319 0.8538598 0.8540863 0.8543113 0.8545348 0.8547569 [71] 0.8549776 0.8551968 0.8554145 0.8556308 0.8558456 0.8560590 0.8562709 [78] 0.8564814 0.8566903 0.8568979 0.8571039 0.8573085 0.8575116 0.8577133 [85] 0.8579135 0.8581122 0.8583095 0.8585053 0.8586996 0.8588925 0.8590839 [92] 0.8592738 0.8594622 0.8596492 0.8598347 0.8600187 0.8602013 0.8603824 [99] 0.8605620 0.8607401 0.8609168 0.8610920 0.8612657 0.8614380 0.8616087 [106] 0.8617780 0.8619459 0.8621122 0.8622771 0.8624405 0.8626024 0.8627628 [113] 0.8629218 0.8630793 0.8632353 0.8633898 0.8635429 0.8636945 0.8638446 [120] 0.8639933 0.8641404 0.8642861 0.8644303 0.8645731 0.8647143 0.8648541 [127] 0.8649924 0.8651293 0.8652646 0.8653985 0.8655310 0.8656619 0.8657914 [134] 0.8659194 0.8660459 0.8661710 0.8662946 0.8664167 0.8665374 0.8666565 [141] 0.8667743 0.8668905 0.8670053 0.8671186 0.8672305 0.8673408 0.8674498 [148] 0.8675572 0.8676632 0.8677677 0.8678708 0.8679724 0.8680726 0.8681712 [155] 0.8682685 0.8683642 0.8684585 0.8685514 0.8686428 0.8687327 0.8688212 [162] 0.8689083 0.8689939 0.8690780 0.8691607 0.8692419 0.8693217 0.8694001 [169] 0.8694770 0.8695524 0.8696264 0.8696990 0.8697701 0.8698398 0.8699081 [176] 0.8699749 0.8700403 0.8701042 0.8701667 0.8702278 0.8702875 0.8703457 [183] 0.8704025 0.8704578 0.8705118 0.8705643 0.8706154 0.8706650 0.8707133 [190] 0.8707601 0.8708055 0.8708495 0.8708921 0.8709333 0.8709730 0.8710114 [197] 0.8710483 0.8710839 0.8711180 0.8711507 0.8711820 0.8712120 0.8712405 [204] 0.8712676 0.8712934 0.8713177 0.8713406 0.8713622 0.8713824 0.8714012 [211] 0.8714186 0.8714346 0.8714492 0.8714625 0.8714744 0.8714849 0.8714940 [218] 0.8715018 0.8715082 0.8715132 0.8715169 0.8715192 0.8715201 0.8715197 [225] 0.8715179 0.8715147 0.8715102 0.8715044 0.8714972 0.8714887 0.8714788 [232] 0.8714675 0.8714550 0.8714411 0.8714258 0.8714092 0.8713913 0.8713720 [239] 0.8713515 0.8713296 0.8713063 0.8712818 0.8712559 0.8712287 0.8712002 [246] 0.8711704 0.8711393 0.8711068 0.8710731 0.8710380 0.8710017 0.8709640 [253] 0.8709251 0.8708849 0.8708433 0.8708005 0.8707564 0.8707110 0.8706643 [260] 0.8706164 0.8705671 0.8705166 0.8704648 0.8704118 0.8703574 0.8703019 [267] 0.8702450 0.8701869 0.8701275 0.8700669 0.8700050 0.8699419 0.8698775 [274] 0.8698119 0.8697450 0.8696769 0.8696075 0.8695370 0.8694651 0.8693921 [281] 0.8693178 0.8692423 0.8691656 0.8690877 0.8690085 0.8689282 0.8688466 [288] 0.8687638 0.8686798 0.8685946 0.8685082 0.8684206 0.8683318 0.8682418 [295] 0.8681506 0.8680583 0.8679647 0.8678700 0.8677741 0.8676770 0.8675788 [302] 0.8674793 0.8673787 0.8672770 0.8671741 0.8670700 0.8669647 0.8668583 [309] 0.8667508 0.8666421 0.8665323 0.8664213 0.8663092 0.8661959 0.8660816 [316] 0.8659660 0.8658494 0.8657316 0.8656127 0.8654927 0.8653716 0.8652494 [323] 0.8651260 0.8650016 0.8648760 0.8647493 0.8646216 0.8644927 0.8643628 [330] 0.8642317 0.8640996 0.8639664 0.8638321 0.8636967 0.8635603 0.8634228 [337] 0.8632842 0.8631445 0.8630038 0.8628620 0.8627192 0.8625753 0.8624304 [344] 0.8622844 0.8621374 0.8619893 0.8618402 0.8616900 0.8615388 0.8613866 [351] 0.8612334 0.8610791 0.8609238 0.8607676 0.8606102 0.8604519 0.8602926 [358] 0.8601322 0.8599709 0.8598086 0.8596452 0.8594809 0.8593156 0.8591493 [365] 0.8589820 0.8588137 0.8586444 0.8584742 0.8583030 0.8581309 0.8579577 [372] 0.8577836 0.8576086 0.8574326 0.8572556 0.8570777 0.8568988 0.8567190 [379] 0.8565383 0.8563566 0.8561740 0.8559904 0.8558060 0.8556206 0.8554343 [386] 0.8552470 0.8550589 0.8548698 0.8546798 0.8544889 0.8542971 0.8541044 [393] 0.8539109 0.8537164 0.8535210 0.8533247 0.8531276 0.8529296 0.8527307 [400] 0.8525309 0.8523302 > mx [1] 0.8715201 > mxli [1] 0.22 > 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/freestat/rcomp/tmp/1npkk1228487738.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/freestat/rcomp/tmp/200qz1228487738.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/freestat/rcomp/tmp/34q8o1228487738.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/47x3a1228487738.tab") > > system("convert tmp/1npkk1228487738.ps tmp/1npkk1228487738.png") > system("convert tmp/200qz1228487738.ps tmp/200qz1228487738.png") > system("convert tmp/34q8o1228487738.ps tmp/34q8o1228487738.png") > > > proc.time() user system elapsed 1.246 0.843 1.477