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(93,98.4,92.6,94.6,99.5,97.6,91.3,93.6,93.1,78.4,70.2,69.3,71.1,73.5,85.9,91.5,91.8,88.3,91.3,94,99.3,96.7,88,96.7,106.8,114.3,105.7,90.1,91.6,97.7,100.8,104.6,95.9,102.7,104,107.9,113.8,113.8,123.1,125.1,137.6,134,140.3,152.1,150.6,167.3,153.2,142,154.4,158.5,180.9,181.3,172.4,192,199.3,215.4,214.3,201.5,190.5,196) > x <- c(97.4,95.3,93.6,91.5,93.1,91.7,94.3,93.9,90.9,88.3,91.3,91.7,92.4,92,95.6,95.8,96.4,99,107,109.7,116.2,115.9,113.8,112.6,113.7,115.9,110.3,111.3,113.4,108.2,104.8,106,110.9,115,118.4,121.4,128.8,131.7,141.7,142.9,139.4,134.7,125,113.6,111.5,108.5,112.3,116.6,115.5,120.1,132.9,128.1,129.3,132.5,131,124.9,120.8,122,122.1,127.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.6662714 0.6663055 0.6663393 0.6663728 0.6664060 0.6664389 0.6664715 [8] 0.6665038 0.6665358 0.6665674 0.6665988 0.6666298 0.6666605 0.6666909 [15] 0.6667210 0.6667508 0.6667802 0.6668094 0.6668382 0.6668667 0.6668949 [22] 0.6669227 0.6669503 0.6669775 0.6670044 0.6670310 0.6670572 0.6670832 [29] 0.6671088 0.6671341 0.6671590 0.6671837 0.6672080 0.6672319 0.6672556 [36] 0.6672789 0.6673019 0.6673246 0.6673469 0.6673689 0.6673905 0.6674119 [43] 0.6674329 0.6674535 0.6674739 0.6674939 0.6675135 0.6675328 0.6675518 [50] 0.6675705 0.6675888 0.6676067 0.6676244 0.6676417 0.6676586 0.6676752 [57] 0.6676915 0.6677074 0.6677230 0.6677382 0.6677531 0.6677676 0.6677818 [64] 0.6677956 0.6678091 0.6678223 0.6678351 0.6678475 0.6678596 0.6678714 [71] 0.6678827 0.6678938 0.6679045 0.6679148 0.6679248 0.6679344 0.6679437 [78] 0.6679526 0.6679611 0.6679693 0.6679772 0.6679847 0.6679918 0.6679986 [85] 0.6680050 0.6680110 0.6680167 0.6680220 0.6680270 0.6680315 0.6680358 [92] 0.6680396 0.6680431 0.6680463 0.6680490 0.6680514 0.6680534 0.6680551 [99] 0.6680564 0.6680573 0.6680579 0.6680580 0.6680579 0.6680573 0.6680564 [106] 0.6680550 0.6680534 0.6680513 0.6680489 0.6680461 0.6680429 0.6680393 [113] 0.6680354 0.6680311 0.6680264 0.6680213 0.6680159 0.6680100 0.6680038 [120] 0.6679972 0.6679902 0.6679829 0.6679751 0.6679670 0.6679585 0.6679496 [127] 0.6679403 0.6679307 0.6679206 0.6679102 0.6678993 0.6678881 0.6678765 [134] 0.6678645 0.6678521 0.6678394 0.6678262 0.6678126 0.6677987 0.6677844 [141] 0.6677696 0.6677545 0.6677390 0.6677231 0.6677068 0.6676901 0.6676730 [148] 0.6676555 0.6676376 0.6676193 0.6676006 0.6675815 0.6675620 0.6675421 [155] 0.6675218 0.6675011 0.6674801 0.6674586 0.6674367 0.6674144 0.6673917 [162] 0.6673686 0.6673451 0.6673211 0.6672968 0.6672721 0.6672470 0.6672214 [169] 0.6671955 0.6671691 0.6671424 0.6671152 0.6670876 0.6670597 0.6670313 [176] 0.6670024 0.6669732 0.6669436 0.6669136 0.6668831 0.6668522 0.6668210 [183] 0.6667893 0.6667572 0.6667246 0.6666917 0.6666583 0.6666246 0.6665904 [190] 0.6665558 0.6665208 0.6664853 0.6664495 0.6664132 0.6663765 0.6663394 [197] 0.6663019 0.6662639 0.6662255 0.6661868 0.6661475 0.6661079 0.6660678 [204] 0.6660274 0.6659865 0.6659451 0.6659034 0.6658612 0.6658186 0.6657756 [211] 0.6657321 0.6656882 0.6656439 0.6655992 0.6655540 0.6655085 0.6654625 [218] 0.6654160 0.6653691 0.6653218 0.6652741 0.6652260 0.6651774 0.6651283 [225] 0.6650789 0.6650290 0.6649787 0.6649280 0.6648768 0.6648252 0.6647731 [232] 0.6647207 0.6646678 0.6646144 0.6645606 0.6645064 0.6644518 0.6643967 [239] 0.6643412 0.6642853 0.6642289 0.6641720 0.6641148 0.6640571 0.6639990 [246] 0.6639404 0.6638814 0.6638219 0.6637620 0.6637017 0.6636409 0.6635797 [253] 0.6635181 0.6634560 0.6633935 0.6633305 0.6632671 0.6632033 0.6631390 [260] 0.6630743 0.6630091 0.6629435 0.6628774 0.6628109 0.6627440 0.6626766 [267] 0.6626088 0.6625405 0.6624718 0.6624026 0.6623330 0.6622630 0.6621925 [274] 0.6621216 0.6620502 0.6619784 0.6619061 0.6618334 0.6617602 0.6616866 [281] 0.6616125 0.6615380 0.6614631 0.6613877 0.6613118 0.6612355 0.6611588 [288] 0.6610816 0.6610040 0.6609259 0.6608473 0.6607684 0.6606889 0.6606090 [295] 0.6605287 0.6604479 0.6603667 0.6602850 0.6602029 0.6601203 0.6600373 [302] 0.6599538 0.6598699 0.6597855 0.6597007 0.6596154 0.6595297 0.6594435 [309] 0.6593569 0.6592698 0.6591822 0.6590942 0.6590058 0.6589169 0.6588276 [316] 0.6587378 0.6586475 0.6585568 0.6584657 0.6583741 0.6582820 0.6581895 [323] 0.6580965 0.6580031 0.6579093 0.6578149 0.6577202 0.6576249 0.6575293 [330] 0.6574331 0.6573365 0.6572395 0.6571420 0.6570441 0.6569457 0.6568468 [337] 0.6567475 0.6566477 0.6565475 0.6564469 0.6563457 0.6562442 0.6561421 [344] 0.6560397 0.6559367 0.6558333 0.6557295 0.6556252 0.6555204 0.6554152 [351] 0.6553096 0.6552035 0.6550969 0.6549899 0.6548824 0.6547745 0.6546661 [358] 0.6545572 0.6544480 0.6543382 0.6542280 0.6541174 0.6540063 0.6538947 [365] 0.6537827 0.6536702 0.6535573 0.6534439 0.6533301 0.6532158 0.6531011 [372] 0.6529859 0.6528703 0.6527542 0.6526376 0.6525206 0.6524032 0.6522853 [379] 0.6521669 0.6520481 0.6519289 0.6518092 0.6516890 0.6515684 0.6514473 [386] 0.6513258 0.6512038 0.6510814 0.6509585 0.6508352 0.6507114 0.6505872 [393] 0.6504625 0.6503374 0.6502118 0.6500857 0.6499593 0.6498323 0.6497049 [400] 0.6495771 0.6494488 > mx [1] 0.668058 > mxli [1] -0.99 > 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/1uukp1226574279.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/289sv1226574279.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/3ruys1226574279.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/4m9jz1226574279.tab") > > system("convert tmp/1uukp1226574279.ps tmp/1uukp1226574279.png") > system("convert tmp/289sv1226574279.ps tmp/289sv1226574279.png") > system("convert tmp/3ruys1226574279.ps tmp/3ruys1226574279.png") > > > proc.time() user system elapsed 0.972 0.459 1.246