R version 2.7.2 (2008-08-25) 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(97.8,107.4,117.5,105.6,97.4,99.5,98,104.3,100.6,101.1,103.9,96.9,95.5,108.4,117,103.8,100.8,110.6,104,112.6,107.3,98.9,109.8,104.9,102.2,123.9,124.9,112.7,121.9,100.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5,115.7,113.6,129.7,112,116.8,127,112.1,114.2,121.1,131.6,125,120.4,117.7,117.5,120.6,127.5,112.3,124.5,115.2,105.4) > x <- c(78.4,114.6,113.3,117,99.6,99.4,101.9,115.2,108.5,113.8,121,92.2,90.2,101.5,126.6,93.9,89.8,93.4,101.5,110.4,105.9,108.4,113.9,86.1,69.4,101.2,100.5,98,106.6,90.1,96.9,125.9,112,100,123.9,79.8,83.4,113.6,112.9,104,109.9,99,106.3,128.9,111.1,102.9,130,87,87.5,117.6,103.4,110.8,112.6,102.5,112.4,135.6,105.1,127.7,137,91,90.5,122.4,123.3,124.3,120,118.1,119,142.7,123.6,129.6,151.6,110.4,99.2,130.5,136.2,129.7,128,121.6,135.8,143.8,147.5,136.2,156.6,123.3,100.4) > #'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.6404516 0.6407567 0.6410608 0.6413639 0.6416661 0.6419672 0.6422674 [8] 0.6425666 0.6428648 0.6431620 0.6434582 0.6437534 0.6440476 0.6443408 [15] 0.6446331 0.6449243 0.6452146 0.6455038 0.6457921 0.6460793 0.6463656 [22] 0.6466508 0.6469350 0.6472183 0.6475005 0.6477817 0.6480619 0.6483411 [29] 0.6486193 0.6488965 0.6491727 0.6494479 0.6497220 0.6499952 0.6502673 [36] 0.6505384 0.6508085 0.6510776 0.6513456 0.6516127 0.6518787 0.6521437 [43] 0.6524077 0.6526707 0.6529326 0.6531935 0.6534534 0.6537123 0.6539701 [50] 0.6542269 0.6544827 0.6547375 0.6549912 0.6552440 0.6554956 0.6557463 [57] 0.6559959 0.6562445 0.6564921 0.6567386 0.6569841 0.6572286 0.6574720 [64] 0.6577144 0.6579557 0.6581961 0.6584354 0.6586736 0.6589108 0.6591470 [71] 0.6593822 0.6596163 0.6598493 0.6600814 0.6603124 0.6605423 0.6607712 [78] 0.6609991 0.6612259 0.6614517 0.6616765 0.6619002 0.6621229 0.6623445 [85] 0.6625651 0.6627846 0.6630031 0.6632206 0.6634370 0.6636523 0.6638667 [92] 0.6640799 0.6642922 0.6645034 0.6647135 0.6649226 0.6651307 0.6653377 [99] 0.6655436 0.6657486 0.6659524 0.6661553 0.6663570 0.6665578 0.6667575 [106] 0.6669561 0.6671537 0.6673503 0.6675458 0.6677402 0.6679336 0.6681260 [113] 0.6683173 0.6685076 0.6686968 0.6688850 0.6690721 0.6692582 0.6694432 [120] 0.6696272 0.6698101 0.6699920 0.6701729 0.6703527 0.6705314 0.6707092 [127] 0.6708858 0.6710614 0.6712360 0.6714095 0.6715820 0.6717535 0.6719238 [134] 0.6720932 0.6722615 0.6724287 0.6725949 0.6727601 0.6729242 0.6730873 [141] 0.6732493 0.6734103 0.6735703 0.6737292 0.6738870 0.6740439 0.6741996 [148] 0.6743544 0.6745081 0.6746607 0.6748123 0.6749629 0.6751124 0.6752609 [155] 0.6754084 0.6755548 0.6757002 0.6758445 0.6759878 0.6761300 0.6762713 [162] 0.6764114 0.6765506 0.6766887 0.6768258 0.6769618 0.6770968 0.6772308 [169] 0.6773637 0.6774956 0.6776265 0.6777563 0.6778851 0.6780129 0.6781396 [176] 0.6782653 0.6783900 0.6785137 0.6786363 0.6787579 0.6788784 0.6789980 [183] 0.6791165 0.6792340 0.6793504 0.6794659 0.6795803 0.6796937 0.6798060 [190] 0.6799174 0.6800277 0.6801370 0.6802452 0.6803525 0.6804587 0.6805639 [197] 0.6806681 0.6807713 0.6808735 0.6809746 0.6810747 0.6811738 0.6812719 [204] 0.6813690 0.6814651 0.6815602 0.6816542 0.6817472 0.6818393 0.6819303 [211] 0.6820203 0.6821093 0.6821973 0.6822843 0.6823702 0.6824552 0.6825392 [218] 0.6826222 0.6827041 0.6827851 0.6828651 0.6829440 0.6830220 0.6830990 [225] 0.6831749 0.6832499 0.6833239 0.6833969 0.6834688 0.6835398 0.6836098 [232] 0.6836788 0.6837469 0.6838139 0.6838799 0.6839450 0.6840091 0.6840721 [239] 0.6841342 0.6841953 0.6842555 0.6843146 0.6843728 0.6844299 0.6844861 [246] 0.6845414 0.6845956 0.6846489 0.6847012 0.6847525 0.6848028 0.6848522 [253] 0.6849006 0.6849480 0.6849944 0.6850399 0.6850844 0.6851280 0.6851706 [260] 0.6852122 0.6852529 0.6852925 0.6853313 0.6853690 0.6854058 0.6854417 [267] 0.6854766 0.6855105 0.6855435 0.6855755 0.6856066 0.6856367 0.6856659 [274] 0.6856941 0.6857213 0.6857477 0.6857730 0.6857975 0.6858209 0.6858435 [281] 0.6858651 0.6858857 0.6859054 0.6859242 0.6859420 0.6859589 0.6859749 [288] 0.6859899 0.6860040 0.6860171 0.6860294 0.6860407 0.6860510 0.6860605 [295] 0.6860690 0.6860765 0.6860832 0.6860889 0.6860938 0.6860977 0.6861006 [302] 0.6861027 0.6861038 0.6861040 0.6861033 0.6861017 0.6860992 0.6860958 [309] 0.6860914 0.6860862 0.6860800 0.6860730 0.6860650 0.6860561 0.6860464 [316] 0.6860357 0.6860241 0.6860116 0.6859982 0.6859840 0.6859688 0.6859527 [323] 0.6859358 0.6859179 0.6858992 0.6858796 0.6858591 0.6858377 0.6858154 [330] 0.6857922 0.6857682 0.6857432 0.6857174 0.6856907 0.6856632 0.6856347 [337] 0.6856054 0.6855752 0.6855442 0.6855122 0.6854794 0.6854458 0.6854112 [344] 0.6853758 0.6853396 0.6853024 0.6852644 0.6852256 0.6851859 0.6851453 [351] 0.6851039 0.6850616 0.6850185 0.6849745 0.6849297 0.6848840 0.6848374 [358] 0.6847901 0.6847418 0.6846928 0.6846429 0.6845921 0.6845405 0.6844881 [365] 0.6844348 0.6843807 0.6843258 0.6842701 0.6842135 0.6841560 0.6840978 [372] 0.6840387 0.6839788 0.6839180 0.6838565 0.6837941 0.6837309 0.6836669 [379] 0.6836021 0.6835364 0.6834700 0.6834027 0.6833346 0.6832657 0.6831960 [386] 0.6831255 0.6830542 0.6829820 0.6829091 0.6828354 0.6827609 0.6826855 [393] 0.6826094 0.6825325 0.6824548 0.6823763 0.6822970 0.6822169 0.6821360 [400] 0.6820544 0.6819719 > mx [1] 0.686104 > mxli [1] 1.03 > 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/18we31226519629.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/2dxku1226519629.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/3eso11226519629.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/49tsd1226519629.tab") > > system("convert tmp/18we31226519629.ps tmp/18we31226519629.png") > system("convert tmp/2dxku1226519629.ps tmp/2dxku1226519629.png") > system("convert tmp/3eso11226519629.ps tmp/3eso11226519629.png") > > > proc.time() user system elapsed 0.963 0.507 1.152