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(17872,17420.4,16704.4,15991.2,15583.6,19123.5,17838.7,17209.4,18586.5,16258.1,15141.6,19202.1,17746.5,19090.1,18040.3,17515.5,17751.8,21072.4,17170,19439.5,19795.4,17574.9,16165.4,19464.6,19932.1,19961.2,17343.4,18924.2,18574.1,21350.6,18594.6,19832.1,20844.4,19640.2,17735.4,19813.6,22160,20664.3,17877.4,20906.5,21164.1,21374.4,22952.3,21343.5,23899.3,22392.9,18274.1,22786.7,22321.5,17842.2,16373.5,15933.8,16446.1,17729,16643,16196.7,18252.1,17570.4,15836.8,15836.8) > x <- c(2,2,2,2,2,2,2,2,2,2,2,2,2,2,2.21,2.25,2.25,2.45,2.5,2.5,2.64,2.75,2.93,3,3.17,3.25,3.39,3.5,3.5,3.65,3.75,3.75,3.9,4,4,4,4,4,4,4,4,4,4,4,4,4.18,4.25,4.25,3.97,3.42,2.75,2.31,2,1.66,1.31,1.09,1,1,1,1) > #'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.4784099 0.4793300 0.4802523 0.4811766 0.4821031 0.4830315 0.4839621 [8] 0.4848946 0.4858291 0.4867655 0.4877039 0.4886442 0.4895864 0.4905304 [15] 0.4914762 0.4924239 0.4933733 0.4943245 0.4952773 0.4962319 0.4971882 [22] 0.4981460 0.4991055 0.5000665 0.5010291 0.5019932 0.5029588 0.5039258 [29] 0.5048943 0.5058641 0.5068353 0.5078078 0.5087816 0.5097567 0.5107330 [36] 0.5117105 0.5126892 0.5136690 0.5146498 0.5156318 0.5166147 0.5175987 [43] 0.5185836 0.5195694 0.5205561 0.5215436 0.5225319 0.5235210 0.5245109 [50] 0.5255014 0.5264926 0.5274844 0.5284768 0.5294697 0.5304631 0.5314570 [57] 0.5324514 0.5334461 0.5344411 0.5354365 0.5364321 0.5374280 0.5384240 [64] 0.5394202 0.5404165 0.5414129 0.5424093 0.5434056 0.5444019 0.5453981 [71] 0.5463942 0.5473901 0.5483857 0.5493811 0.5503762 0.5513709 0.5523652 [78] 0.5533591 0.5543525 0.5553454 0.5563377 0.5573294 0.5583205 0.5593108 [85] 0.5603005 0.5612893 0.5622773 0.5632645 0.5642507 0.5652360 0.5662203 [92] 0.5672035 0.5681857 0.5691667 0.5701466 0.5711253 0.5721027 0.5730788 [99] 0.5740535 0.5750269 0.5759989 0.5769694 0.5779384 0.5789058 0.5798716 [106] 0.5808358 0.5817984 0.5827591 0.5837182 0.5846754 0.5856308 0.5865843 [113] 0.5875359 0.5884855 0.5894331 0.5903786 0.5913221 0.5922634 0.5932025 [120] 0.5941395 0.5950742 0.5960066 0.5969367 0.5978644 0.5987897 0.5997126 [127] 0.6006330 0.6015508 0.6024662 0.6033789 0.6042890 0.6051965 0.6061012 [134] 0.6070032 0.6079025 0.6087989 0.6096925 0.6105832 0.6114710 0.6123559 [141] 0.6132378 0.6141167 0.6149926 0.6158654 0.6167351 0.6176017 0.6184651 [148] 0.6193253 0.6201823 0.6210360 0.6218864 0.6227336 0.6235774 0.6244178 [155] 0.6252549 0.6260885 0.6269187 0.6277454 0.6285686 0.6293883 0.6302045 [162] 0.6310171 0.6318261 0.6326314 0.6334332 0.6342312 0.6350256 0.6358163 [169] 0.6366033 0.6373865 0.6381660 0.6389416 0.6397135 0.6404816 0.6412458 [176] 0.6420061 0.6427626 0.6435152 0.6442639 0.6450087 0.6457496 0.6464865 [183] 0.6472194 0.6479484 0.6486734 0.6493944 0.6501114 0.6508243 0.6515332 [190] 0.6522381 0.6529389 0.6536357 0.6543284 0.6550170 0.6557015 0.6563820 [197] 0.6570583 0.6577306 0.6583987 0.6590627 0.6597225 0.6603783 0.6610299 [204] 0.6616774 0.6623207 0.6629599 0.6635950 0.6642259 0.6648527 0.6654753 [211] 0.6660938 0.6667081 0.6673183 0.6679244 0.6685262 0.6691240 0.6697176 [218] 0.6703071 0.6708924 0.6714736 0.6720507 0.6726237 0.6731925 0.6737572 [225] 0.6743178 0.6748743 0.6754267 0.6759751 0.6765193 0.6770595 0.6775955 [232] 0.6781276 0.6786555 0.6791795 0.6796994 0.6802152 0.6807271 0.6812349 [239] 0.6817388 0.6822386 0.6827345 0.6832264 0.6837144 0.6841984 0.6846785 [246] 0.6851546 0.6856269 0.6860953 0.6865597 0.6870204 0.6874771 0.6879301 [253] 0.6883792 0.6888244 0.6892659 0.6897036 0.6901376 0.6905677 0.6909942 [260] 0.6914169 0.6918359 0.6922512 0.6926629 0.6930708 0.6934752 0.6938759 [267] 0.6942730 0.6946665 0.6950564 0.6954428 0.6958256 0.6962049 0.6965807 [274] 0.6969530 0.6973219 0.6976872 0.6980492 0.6984077 0.6987628 0.6991146 [281] 0.6994629 0.6998080 0.7001497 0.7004881 0.7008232 0.7011550 0.7014836 [288] 0.7018090 0.7021311 0.7024501 0.7027658 0.7030785 0.7033879 0.7036943 [295] 0.7039976 0.7042978 0.7045949 0.7048890 0.7051801 0.7054681 0.7057532 [302] 0.7060353 0.7063145 0.7065908 0.7068641 0.7071346 0.7074022 0.7076670 [309] 0.7079289 0.7081881 0.7084444 0.7086980 0.7089488 0.7091969 0.7094423 [316] 0.7096850 0.7099251 0.7101625 0.7103972 0.7106294 0.7108589 0.7110859 [323] 0.7113103 0.7115322 0.7117516 0.7119685 0.7121829 0.7123948 0.7126043 [330] 0.7128114 0.7130161 0.7132183 0.7134183 0.7136158 0.7138111 0.7140040 [337] 0.7141947 0.7143830 0.7145691 0.7147530 0.7149347 0.7151141 0.7152914 [344] 0.7154665 0.7156394 0.7158102 0.7159790 0.7161456 0.7163101 0.7164726 [351] 0.7166330 0.7167914 0.7169478 0.7171021 0.7172546 0.7174050 0.7175535 [358] 0.7177001 0.7178448 0.7179876 0.7181285 0.7182675 0.7184047 0.7185400 [365] 0.7186736 0.7188053 0.7189353 0.7190635 0.7191899 0.7193146 0.7194376 [372] 0.7195589 0.7196785 0.7197964 0.7199126 0.7200272 0.7201402 0.7202516 [379] 0.7203613 0.7204695 0.7205761 0.7206811 0.7207846 0.7208865 0.7209869 [386] 0.7210859 0.7211833 0.7212792 0.7213737 0.7214668 0.7215584 0.7216485 [393] 0.7217373 0.7218246 0.7219106 0.7219952 0.7220784 0.7221603 0.7222409 [400] 0.7223201 0.7223980 > mx [1] 0.722398 > 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/rcomp/tmp/12rac1257957741.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/20b2c1257957741.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/3kta51257957741.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/43lq81257957741.tab") > > system("convert tmp/12rac1257957741.ps tmp/12rac1257957741.png") > system("convert tmp/20b2c1257957741.ps tmp/20b2c1257957741.png") > system("convert tmp/3kta51257957741.ps tmp/3kta51257957741.png") > > > proc.time() user system elapsed 0.773 0.504 0.953