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(1.6,1.8,1.6,1.5,1.5,1.3,1.4,1.4,1.3,1.3,1.2,1.1,1.4,1.2,1.5,1.1,1.3,1.5,1.1,1.4,1.3,1.5,1.6,1.7,1.1,1.6,1.3,1.7,1.6,1.7,1.9,1.8,1.9,1.6,1.5,1.6,1.6,1.7,2,2,1.9,1.7,1.8,1.9,1.7,2,2.1,2.4,2.5,2.5,2.6,2.2,2.5,2.8,2.8,2.9,3,3.1,2.9,2.7) > x <- c(8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.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.6908283 -0.6908756 -0.6909226 -0.6909694 -0.6910159 -0.6910621 [7] -0.6911081 -0.6911537 -0.6911991 -0.6912443 -0.6912891 -0.6913337 [13] -0.6913780 -0.6914220 -0.6914657 -0.6915092 -0.6915524 -0.6915953 [19] -0.6916380 -0.6916804 -0.6917225 -0.6917643 -0.6918058 -0.6918471 [25] -0.6918881 -0.6919288 -0.6919693 -0.6920095 -0.6920494 -0.6920890 [31] -0.6921283 -0.6921674 -0.6922062 -0.6922447 -0.6922830 -0.6923210 [37] -0.6923587 -0.6923961 -0.6924333 -0.6924701 -0.6925068 -0.6925431 [43] -0.6925791 -0.6926149 -0.6926504 -0.6926857 -0.6927206 -0.6927553 [49] -0.6927897 -0.6928239 -0.6928577 -0.6928913 -0.6929246 -0.6929577 [55] -0.6929904 -0.6930229 -0.6930552 -0.6930871 -0.6931188 -0.6931502 [61] -0.6931813 -0.6932121 -0.6932427 -0.6932730 -0.6933031 -0.6933328 [67] -0.6933623 -0.6933915 -0.6934204 -0.6934491 -0.6934775 -0.6935056 [73] -0.6935334 -0.6935610 -0.6935883 -0.6936153 -0.6936421 -0.6936686 [79] -0.6936948 -0.6937207 -0.6937463 -0.6937717 -0.6937968 -0.6938217 [85] -0.6938462 -0.6938705 -0.6938946 -0.6939183 -0.6939418 -0.6939650 [91] -0.6939879 -0.6940106 -0.6940330 -0.6940551 -0.6940769 -0.6940985 [97] -0.6941198 -0.6941408 -0.6941616 -0.6941821 -0.6942023 -0.6942222 [103] -0.6942419 -0.6942613 -0.6942804 -0.6942992 -0.6943178 -0.6943361 [109] -0.6943542 -0.6943719 -0.6943894 -0.6944067 -0.6944236 -0.6944403 [115] -0.6944567 -0.6944729 -0.6944887 -0.6945043 -0.6945197 -0.6945347 [121] -0.6945495 -0.6945640 -0.6945783 -0.6945923 -0.6946060 -0.6946194 [127] -0.6946326 -0.6946455 -0.6946581 -0.6946705 -0.6946825 -0.6946944 [133] -0.6947059 -0.6947172 -0.6947282 -0.6947389 -0.6947494 -0.6947596 [139] -0.6947696 -0.6947792 -0.6947886 -0.6947977 -0.6948066 -0.6948152 [145] -0.6948235 -0.6948316 -0.6948394 -0.6948469 -0.6948541 -0.6948611 [151] -0.6948678 -0.6948743 -0.6948804 -0.6948864 -0.6948920 -0.6948974 [157] -0.6949025 -0.6949073 -0.6949119 -0.6949162 -0.6949202 -0.6949240 [163] -0.6949275 -0.6949308 -0.6949337 -0.6949364 -0.6949389 -0.6949410 [169] -0.6949429 -0.6949446 -0.6949460 -0.6949471 -0.6949479 -0.6949485 [175] -0.6949488 -0.6949488 -0.6949486 -0.6949481 -0.6949474 -0.6949464 [181] -0.6949451 -0.6949435 -0.6949417 -0.6949397 -0.6949373 -0.6949347 [187] -0.6949318 -0.6949287 -0.6949253 -0.6949216 -0.6949177 -0.6949135 [193] -0.6949091 -0.6949044 -0.6948994 -0.6948941 -0.6948886 -0.6948828 [199] -0.6948768 -0.6948705 -0.6948640 -0.6948571 -0.6948500 -0.6948427 [205] -0.6948351 -0.6948272 -0.6948191 -0.6948107 -0.6948020 -0.6947931 [211] -0.6947839 -0.6947745 -0.6947648 -0.6947548 -0.6947446 -0.6947341 [217] -0.6947233 -0.6947123 -0.6947011 -0.6946895 -0.6946777 -0.6946657 [223] -0.6946534 -0.6946408 -0.6946280 -0.6946149 -0.6946015 -0.6945879 [229] -0.6945740 -0.6945599 -0.6945455 -0.6945309 -0.6945159 -0.6945008 [235] -0.6944854 -0.6944697 -0.6944537 -0.6944375 -0.6944211 -0.6944043 [241] -0.6943874 -0.6943701 -0.6943526 -0.6943349 -0.6943169 -0.6942986 [247] -0.6942801 -0.6942613 -0.6942423 -0.6942230 -0.6942034 -0.6941836 [253] -0.6941636 -0.6941433 -0.6941227 -0.6941019 -0.6940808 -0.6940594 [259] -0.6940378 -0.6940160 -0.6939939 -0.6939715 -0.6939489 -0.6939260 [265] -0.6939029 -0.6938795 -0.6938559 -0.6938320 -0.6938078 -0.6937834 [271] -0.6937588 -0.6937339 -0.6937087 -0.6936833 -0.6936577 -0.6936317 [277] -0.6936056 -0.6935791 -0.6935525 -0.6935255 -0.6934983 -0.6934709 [283] -0.6934432 -0.6934153 -0.6933871 -0.6933587 -0.6933300 -0.6933010 [289] -0.6932718 -0.6932424 -0.6932127 -0.6931827 -0.6931525 -0.6931221 [295] -0.6930914 -0.6930604 -0.6930292 -0.6929978 -0.6929661 -0.6929341 [301] -0.6929019 -0.6928695 -0.6928368 -0.6928038 -0.6927707 -0.6927372 [307] -0.6927035 -0.6926696 -0.6926354 -0.6926010 -0.6925663 -0.6925313 [313] -0.6924962 -0.6924607 -0.6924251 -0.6923891 -0.6923530 -0.6923166 [319] -0.6922799 -0.6922430 -0.6922058 -0.6921684 -0.6921308 -0.6920929 [325] -0.6920548 -0.6920164 -0.6919778 -0.6919389 -0.6918998 -0.6918604 [331] -0.6918208 -0.6917810 -0.6917409 -0.6917005 -0.6916599 -0.6916191 [337] -0.6915780 -0.6915367 -0.6914952 -0.6914534 -0.6914113 -0.6913690 [343] -0.6913265 -0.6912837 -0.6912407 -0.6911975 -0.6911540 -0.6911102 [349] -0.6910663 -0.6910220 -0.6909776 -0.6909329 -0.6908879 -0.6908427 [355] -0.6907973 -0.6907516 -0.6907057 -0.6906596 -0.6906132 -0.6905666 [361] -0.6905197 -0.6904726 -0.6904253 -0.6903777 -0.6903299 -0.6902818 [367] -0.6902335 -0.6901850 -0.6901362 -0.6900872 -0.6900379 -0.6899884 [373] -0.6899387 -0.6898887 -0.6898385 -0.6897881 -0.6897374 -0.6896865 [379] -0.6896354 -0.6895840 -0.6895324 -0.6894805 -0.6894284 -0.6893761 [385] -0.6893235 -0.6892707 -0.6892177 -0.6891644 -0.6891109 -0.6890572 [391] -0.6890032 -0.6889490 -0.6888946 -0.6888399 -0.6887850 -0.6887299 [397] -0.6886745 -0.6886189 -0.6885631 -0.6885070 -0.6884507 > mx [1] 0.6949488 > mxli [1] -0.25 > 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/1ha3z1257693058.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/2rzu41257693058.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/3blo11257693058.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/4zihe1257693058.tab") > > system("convert tmp/1ha3z1257693058.ps tmp/1ha3z1257693058.png") > system("convert tmp/2rzu41257693058.ps tmp/2rzu41257693058.png") > system("convert tmp/3blo11257693058.ps tmp/3blo11257693058.png") > > > proc.time() user system elapsed 1.221 0.813 1.358