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(104.2,103.2,112.7,106.4,102.6,110.6,95.2,89.0,112.5,116.8,107.2,113.6,101.8,102.6,122.7,110.3,110.5,121.6,100.3,100.7,123.4,127.1,124.1,131.2,111.6,114.2,130.1,125.9,119.0,133.8,107.5,113.5,134.4,126.8,135.6,139.9,129.8,131.0,153.1,134.1,144.1,155.9,123.3,128.1,144.3,153.0,149.9,150.9,141.0,138.9,157.4,142.9,151.7,161.0,138.5,135.9,151.5,164.0,159.1,157.0,142.1,144.8,152.1,154.6,148.7,157.7,146.7) > x <- c(97.4,97.0,105.4,102.7,98.1,104.5,87.4,89.9,109.8,111.7,98.6,96.9,95.1,97.0,112.7,102.9,97.4,111.4,87.4,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.0,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102.0,106.0,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100.0,110.7,112.8,109.8,117.3,109.1,115.9,95.7) > #'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.6694698 0.6696132 0.6697562 0.6698990 0.6700415 0.6701837 0.6703257 [8] 0.6704674 0.6706088 0.6707499 0.6708908 0.6710314 0.6711717 0.6713118 [15] 0.6714516 0.6715911 0.6717303 0.6718693 0.6720080 0.6721464 0.6722846 [22] 0.6724225 0.6725601 0.6726974 0.6728345 0.6729713 0.6731078 0.6732440 [29] 0.6733800 0.6735157 0.6736512 0.6737863 0.6739212 0.6740558 0.6741902 [36] 0.6743243 0.6744581 0.6745916 0.6747249 0.6748578 0.6749906 0.6751230 [43] 0.6752552 0.6753871 0.6755187 0.6756501 0.6757812 0.6759120 0.6760425 [50] 0.6761728 0.6763028 0.6764325 0.6765620 0.6766912 0.6768201 0.6769487 [57] 0.6770771 0.6772052 0.6773330 0.6774606 0.6775879 0.6777149 0.6778417 [64] 0.6779681 0.6780943 0.6782203 0.6783459 0.6784713 0.6785965 0.6787213 [71] 0.6788459 0.6789702 0.6790943 0.6792180 0.6793415 0.6794648 0.6795877 [78] 0.6797104 0.6798328 0.6799550 0.6800769 0.6801985 0.6803198 0.6804409 [85] 0.6805617 0.6806822 0.6808025 0.6809225 0.6810422 0.6811616 0.6812808 [92] 0.6813997 0.6815184 0.6816368 0.6817549 0.6818727 0.6819903 0.6821076 [99] 0.6822246 0.6823414 0.6824579 0.6825741 0.6826901 0.6828058 0.6829212 [106] 0.6830363 0.6831512 0.6832659 0.6833802 0.6834943 0.6836081 0.6837217 [113] 0.6838349 0.6839480 0.6840607 0.6841732 0.6842854 0.6843973 0.6845090 [120] 0.6846204 0.6847316 0.6848425 0.6849531 0.6850634 0.6851735 0.6852833 [127] 0.6853929 0.6855022 0.6856112 0.6857199 0.6858284 0.6859367 0.6860446 [134] 0.6861523 0.6862597 0.6863669 0.6864738 0.6865804 0.6866868 0.6867929 [141] 0.6868987 0.6870043 0.6871096 0.6872147 0.6873195 0.6874240 0.6875282 [148] 0.6876322 0.6877360 0.6878394 0.6879426 0.6880456 0.6881483 0.6882507 [155] 0.6883528 0.6884547 0.6885564 0.6886577 0.6887588 0.6888597 0.6889603 [162] 0.6890606 0.6891606 0.6892604 0.6893600 0.6894593 0.6895583 0.6896570 [169] 0.6897555 0.6898538 0.6899517 0.6900494 0.6901469 0.6902441 0.6903410 [176] 0.6904377 0.6905341 0.6906303 0.6907262 0.6908218 0.6909172 0.6910123 [183] 0.6911072 0.6912018 0.6912961 0.6913902 0.6914840 0.6915776 0.6916709 [190] 0.6917640 0.6918568 0.6919493 0.6920416 0.6921336 0.6922254 0.6923169 [197] 0.6924082 0.6924992 0.6925899 0.6926804 0.6927707 0.6928607 0.6929504 [204] 0.6930399 0.6931291 0.6932180 0.6933067 0.6933952 0.6934834 0.6935713 [211] 0.6936590 0.6937465 0.6938337 0.6939206 0.6940073 0.6940937 0.6941799 [218] 0.6942658 0.6943514 0.6944369 0.6945220 0.6946069 0.6946916 0.6947760 [225] 0.6948602 0.6949441 0.6950277 0.6951111 0.6951943 0.6952772 0.6953598 [232] 0.6954422 0.6955244 0.6956063 0.6956879 0.6957693 0.6958505 0.6959314 [239] 0.6960121 0.6960925 0.6961726 0.6962525 0.6963322 0.6964116 0.6964908 [246] 0.6965697 0.6966484 0.6967268 0.6968050 0.6968829 0.6969606 0.6970381 [253] 0.6971153 0.6971922 0.6972689 0.6973454 0.6974216 0.6974976 0.6975733 [260] 0.6976488 0.6977240 0.6977990 0.6978737 0.6979482 0.6980225 0.6980965 [267] 0.6981703 0.6982438 0.6983171 0.6983901 0.6984629 0.6985355 0.6986078 [274] 0.6986799 0.6987517 0.6988233 0.6988947 0.6989658 0.6990366 0.6991073 [281] 0.6991777 0.6992478 0.6993177 0.6993874 0.6994568 0.6995260 0.6995950 [288] 0.6996637 0.6997321 0.6998004 0.6998684 0.6999361 0.7000037 0.7000709 [295] 0.7001380 0.7002048 0.7002714 0.7003377 0.7004038 0.7004697 0.7005353 [302] 0.7006007 0.7006658 0.7007308 0.7007955 0.7008599 0.7009241 0.7009881 [309] 0.7010518 0.7011154 0.7011786 0.7012417 0.7013045 0.7013671 0.7014294 [316] 0.7014915 0.7015534 0.7016151 0.7016765 0.7017377 0.7017986 0.7018593 [323] 0.7019198 0.7019801 0.7020401 0.7020999 0.7021595 0.7022188 0.7022779 [330] 0.7023368 0.7023955 0.7024539 0.7025121 0.7025700 0.7026278 0.7026853 [337] 0.7027426 0.7027996 0.7028564 0.7029130 0.7029694 0.7030256 0.7030815 [344] 0.7031372 0.7031926 0.7032479 0.7033029 0.7033577 0.7034122 0.7034666 [351] 0.7035207 0.7035746 0.7036282 0.7036817 0.7037349 0.7037879 0.7038406 [358] 0.7038932 0.7039455 0.7039976 0.7040495 0.7041011 0.7041526 0.7042038 [365] 0.7042548 0.7043055 0.7043561 0.7044064 0.7044565 0.7045064 0.7045561 [372] 0.7046055 0.7046548 0.7047038 0.7047526 0.7048011 0.7048495 0.7048976 [379] 0.7049455 0.7049932 0.7050407 0.7050880 0.7051350 0.7051819 0.7052285 [386] 0.7052749 0.7053210 0.7053670 0.7054128 0.7054583 0.7055036 0.7055487 [393] 0.7055936 0.7056383 0.7056827 0.7057270 0.7057710 0.7058148 0.7058584 [400] 0.7059018 0.7059450 > mx [1] 0.705945 > 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/freestat/rcomp/tmp/1upot1226401589.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/2kstu1226401589.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/3acbj1226401589.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/44d281226401589.tab") > > system("convert tmp/1upot1226401589.ps tmp/1upot1226401589.png") > system("convert tmp/2kstu1226401589.ps tmp/2kstu1226401589.png") > system("convert tmp/3acbj1226401589.ps tmp/3acbj1226401589.png") > > > proc.time() user system elapsed 1.204 0.774 1.434