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(7.3,7.6,7.5,7.6,7.9,7.9,8.1,8.2,8,7.5,6.8,6.5,6.6,7.6,8,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.9,7.7,7.4,7.5) > x <- c(7.9,9.1,9.4,9.4,9.1,9,9.3,9.9,9.8,9.3,8.3,8,8.5,10.4,11.1,10.9,10,9.2,9.2,9.5,9.6,9.5,9.1,8.9,9,10.1,10.3,10.2,9.6,9.2,9.3,9.4,9.4,9.2,9,9,9,9.8,10,9.8,9.3,9,9,9.1,9.1,9.1,9.2,8.8,8.3,8.4,8.1,7.7,7.9,7.9,8,7.9,7.6,7.1,6.8,6.5,6.9,8.2,8.7,8.3,7.9,7.5,7.8,8.3,8.4,8.2,7.7,7.2,7.3) > #'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.6624645 0.6624861 0.6625073 0.6625281 0.6625486 0.6625687 0.6625884 [8] 0.6626077 0.6626266 0.6626452 0.6626633 0.6626811 0.6626985 0.6627155 [15] 0.6627322 0.6627484 0.6627643 0.6627798 0.6627949 0.6628097 0.6628240 [22] 0.6628380 0.6628515 0.6628647 0.6628776 0.6628900 0.6629020 0.6629137 [29] 0.6629250 0.6629359 0.6629464 0.6629565 0.6629662 0.6629756 0.6629845 [36] 0.6629931 0.6630013 0.6630091 0.6630165 0.6630236 0.6630302 0.6630365 [43] 0.6630424 0.6630479 0.6630530 0.6630577 0.6630620 0.6630660 0.6630695 [50] 0.6630727 0.6630755 0.6630778 0.6630799 0.6630815 0.6630827 0.6630835 [57] 0.6630840 0.6630841 0.6630837 0.6630830 0.6630819 0.6630804 0.6630785 [64] 0.6630763 0.6630736 0.6630706 0.6630671 0.6630633 0.6630591 0.6630545 [71] 0.6630495 0.6630441 0.6630383 0.6630321 0.6630256 0.6630186 0.6630113 [78] 0.6630035 0.6629954 0.6629869 0.6629780 0.6629687 0.6629590 0.6629490 [85] 0.6629385 0.6629276 0.6629164 0.6629047 0.6628927 0.6628803 0.6628675 [92] 0.6628543 0.6628407 0.6628267 0.6628123 0.6627975 0.6627823 0.6627668 [99] 0.6627508 0.6627345 0.6627178 0.6627006 0.6626831 0.6626652 0.6626469 [106] 0.6626282 0.6626091 0.6625896 0.6625698 0.6625495 0.6625288 0.6625078 [113] 0.6624863 0.6624645 0.6624423 0.6624196 0.6623966 0.6623732 0.6623494 [120] 0.6623252 0.6623006 0.6622757 0.6622503 0.6622245 0.6621984 0.6621718 [127] 0.6621449 0.6621175 0.6620898 0.6620617 0.6620331 0.6620042 0.6619749 [134] 0.6619452 0.6619151 0.6618847 0.6618538 0.6618225 0.6617909 0.6617588 [141] 0.6617263 0.6616935 0.6616603 0.6616266 0.6615926 0.6615582 0.6615234 [148] 0.6614882 0.6614526 0.6614166 0.6613802 0.6613435 0.6613063 0.6612687 [155] 0.6612308 0.6611924 0.6611537 0.6611146 0.6610751 0.6610351 0.6609948 [162] 0.6609541 0.6609130 0.6608716 0.6608297 0.6607874 0.6607448 0.6607017 [169] 0.6606583 0.6606144 0.6605702 0.6605256 0.6604805 0.6604351 0.6603893 [176] 0.6603431 0.6602966 0.6602496 0.6602022 0.6601545 0.6601063 0.6600578 [183] 0.6600088 0.6599595 0.6599098 0.6598597 0.6598092 0.6597583 0.6597070 [190] 0.6596553 0.6596033 0.6595508 0.6594980 0.6594448 0.6593911 0.6593371 [197] 0.6592827 0.6592279 0.6591727 0.6591172 0.6590612 0.6590048 0.6589481 [204] 0.6588909 0.6588334 0.6587755 0.6587172 0.6586585 0.6585994 0.6585400 [211] 0.6584801 0.6584199 0.6583592 0.6582982 0.6582368 0.6581750 0.6581128 [218] 0.6580502 0.6579872 0.6579239 0.6578601 0.6577960 0.6577315 0.6576666 [225] 0.6576013 0.6575356 0.6574695 0.6574031 0.6573363 0.6572690 0.6572014 [232] 0.6571334 0.6570650 0.6569963 0.6569271 0.6568576 0.6567876 0.6567173 [239] 0.6566466 0.6565755 0.6565041 0.6564322 0.6563600 0.6562873 0.6562143 [246] 0.6561410 0.6560672 0.6559930 0.6559185 0.6558435 0.6557682 0.6556925 [253] 0.6556165 0.6555400 0.6554632 0.6553859 0.6553083 0.6552304 0.6551520 [260] 0.6550732 0.6549941 0.6549146 0.6548347 0.6547544 0.6546738 0.6545927 [267] 0.6545113 0.6544295 0.6543473 0.6542648 0.6541818 0.6540985 0.6540148 [274] 0.6539307 0.6538463 0.6537615 0.6536762 0.6535907 0.6535047 0.6534183 [281] 0.6533316 0.6532445 0.6531570 0.6530692 0.6529809 0.6528923 0.6528034 [288] 0.6527140 0.6526243 0.6525341 0.6524437 0.6523528 0.6522616 0.6521699 [295] 0.6520780 0.6519856 0.6518929 0.6517998 0.6517063 0.6516124 0.6515182 [302] 0.6514236 0.6513286 0.6512333 0.6511375 0.6510414 0.6509450 0.6508481 [309] 0.6507509 0.6506534 0.6505554 0.6504571 0.6503584 0.6502594 0.6501599 [316] 0.6500601 0.6499600 0.6498594 0.6497585 0.6496573 0.6495556 0.6494536 [323] 0.6493512 0.6492485 0.6491454 0.6490419 0.6489381 0.6488339 0.6487293 [330] 0.6486243 0.6485190 0.6484134 0.6483073 0.6482009 0.6480942 0.6479870 [337] 0.6478795 0.6477717 0.6476635 0.6475549 0.6474459 0.6473366 0.6472270 [344] 0.6471169 0.6470065 0.6468958 0.6467847 0.6466732 0.6465614 0.6464492 [351] 0.6463366 0.6462237 0.6461104 0.6459968 0.6458828 0.6457685 0.6456538 [358] 0.6455387 0.6454233 0.6453075 0.6451914 0.6450749 0.6449581 0.6448409 [365] 0.6447233 0.6446054 0.6444871 0.6443685 0.6442495 0.6441302 0.6440105 [372] 0.6438905 0.6437701 0.6436494 0.6435283 0.6434069 0.6432851 0.6431629 [379] 0.6430404 0.6429176 0.6427944 0.6426709 0.6425470 0.6424227 0.6422982 [386] 0.6421732 0.6420479 0.6419223 0.6417963 0.6416700 0.6415433 0.6414163 [393] 0.6412890 0.6411612 0.6410332 0.6409048 0.6407761 0.6406470 0.6405175 [400] 0.6403878 0.6402577 > mx [1] 0.663084 > mxli [1] -1.43 > 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/1b2wd1257422039.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/211rp1257422039.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/39awn1257422039.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/41v501257422039.tab") > > system("convert tmp/1b2wd1257422039.ps tmp/1b2wd1257422039.png") > system("convert tmp/211rp1257422039.ps tmp/211rp1257422039.png") > system("convert tmp/39awn1257422039.ps tmp/39awn1257422039.png") > > > proc.time() user system elapsed 0.752 0.483 0.881