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(100.00,106.73,104.81,96.15,88.46,88.46,91.35,92.31,91.35,87.50,85.58,86.54,97.12,99.04,98.08,92.31,88.46,89.42,90.38,90.38,88.46,86.54,86.54,86.54,94.23,96.15,94.23,89.42,86.54,86.54,87.50,87.50,87.50,88.46,84.62,79.81,80.77,77.88,74.04,75.96,75.96,76.92,75.96,73.08,68.27,65.38,62.50,66.35,78.85,83.65,79.81,75.96,72.12,75.00,79.81,80.77,78.85,74.04,69.23,70.19) > x <- c(100.00,105.26,106.58,101.32,98.68,100.00,102.63,102.63,102.63,98.68,98.68,93.42,98.68,98.68,100.00,101.32,101.32,103.95,106.58,107.89,107.89,107.89,103.95,96.05,90.79,86.84,88.16,90.79,92.11,93.42,94.74,93.42,90.79,92.11,89.47,84.21,88.16,86.84,84.21,82.89,81.58,85.53,89.47,89.47,84.21,80.26,76.32,80.26,94.74,96.05,90.79,80.26,76.32,81.58,93.42,101.32,103.95,101.32,97.37,98.68) > #'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.6541496 0.6541090 0.6540683 0.6540275 0.6539865 0.6539454 0.6539042 [8] 0.6538628 0.6538212 0.6537795 0.6537377 0.6536957 0.6536536 0.6536113 [15] 0.6535689 0.6535264 0.6534837 0.6534408 0.6533979 0.6533547 0.6533115 [22] 0.6532681 0.6532245 0.6531808 0.6531370 0.6530930 0.6530489 0.6530047 [29] 0.6529603 0.6529157 0.6528711 0.6528262 0.6527813 0.6527362 0.6526909 [36] 0.6526456 0.6526000 0.6525544 0.6525086 0.6524626 0.6524165 0.6523703 [43] 0.6523239 0.6522774 0.6522308 0.6521840 0.6521371 0.6520900 0.6520428 [50] 0.6519955 0.6519480 0.6519003 0.6518526 0.6518047 0.6517566 0.6517085 [57] 0.6516601 0.6516117 0.6515631 0.6515143 0.6514655 0.6514165 0.6513673 [64] 0.6513180 0.6512686 0.6512190 0.6511693 0.6511195 0.6510695 0.6510194 [71] 0.6509691 0.6509187 0.6508682 0.6508175 0.6507667 0.6507158 0.6506647 [78] 0.6506135 0.6505622 0.6505107 0.6504591 0.6504073 0.6503554 0.6503034 [85] 0.6502512 0.6501989 0.6501465 0.6500939 0.6500412 0.6499883 0.6499353 [92] 0.6498822 0.6498290 0.6497756 0.6497221 0.6496684 0.6496146 0.6495607 [99] 0.6495066 0.6494524 0.6493981 0.6493436 0.6492890 0.6492343 0.6491794 [106] 0.6491244 0.6490693 0.6490140 0.6489586 0.6489031 0.6488474 0.6487916 [113] 0.6487357 0.6486796 0.6486234 0.6485671 0.6485106 0.6484540 0.6483973 [120] 0.6483405 0.6482835 0.6482263 0.6481691 0.6481117 0.6480542 0.6479965 [127] 0.6479387 0.6478808 0.6478228 0.6477646 0.6477063 0.6476479 0.6475893 [134] 0.6475306 0.6474718 0.6474128 0.6473537 0.6472945 0.6472352 0.6471757 [141] 0.6471161 0.6470563 0.6469965 0.6469365 0.6468763 0.6468161 0.6467557 [148] 0.6466952 0.6466346 0.6465738 0.6465129 0.6464519 0.6463907 0.6463294 [155] 0.6462680 0.6462065 0.6461448 0.6460830 0.6460211 0.6459590 0.6458969 [162] 0.6458346 0.6457721 0.6457096 0.6456469 0.6455841 0.6455212 0.6454581 [169] 0.6453949 0.6453316 0.6452682 0.6452046 0.6451409 0.6450771 0.6450131 [176] 0.6449491 0.6448849 0.6448206 0.6447561 0.6446916 0.6446269 0.6445621 [183] 0.6444971 0.6444320 0.6443669 0.6443015 0.6442361 0.6441706 0.6441049 [190] 0.6440391 0.6439731 0.6439071 0.6438409 0.6437746 0.6437082 0.6436416 [197] 0.6435750 0.6435082 0.6434413 0.6433742 0.6433071 0.6432398 0.6431724 [204] 0.6431049 0.6430373 0.6429695 0.6429016 0.6428336 0.6427655 0.6426972 [211] 0.6426289 0.6425604 0.6424918 0.6424231 0.6423542 0.6422852 0.6422162 [218] 0.6421469 0.6420776 0.6420082 0.6419386 0.6418689 0.6417991 0.6417292 [225] 0.6416592 0.6415890 0.6415187 0.6414483 0.6413778 0.6413072 0.6412365 [232] 0.6411656 0.6410946 0.6410235 0.6409523 0.6408810 0.6408095 0.6407379 [239] 0.6406663 0.6405945 0.6405225 0.6404505 0.6403784 0.6403061 0.6402337 [246] 0.6401612 0.6400886 0.6400159 0.6399431 0.6398701 0.6397970 0.6397238 [253] 0.6396505 0.6395771 0.6395036 0.6394300 0.6393562 0.6392823 0.6392083 [260] 0.6391342 0.6390600 0.6389857 0.6389113 0.6388367 0.6387621 0.6386873 [267] 0.6386124 0.6385374 0.6384623 0.6383871 0.6383117 0.6382363 0.6381607 [274] 0.6380850 0.6380093 0.6379334 0.6378574 0.6377812 0.6377050 0.6376287 [281] 0.6375522 0.6374757 0.6373990 0.6373222 0.6372453 0.6371683 0.6370912 [288] 0.6370140 0.6369367 0.6368593 0.6367817 0.6367041 0.6366263 0.6365484 [295] 0.6364705 0.6363924 0.6363142 0.6362359 0.6361575 0.6360790 0.6360003 [302] 0.6359216 0.6358428 0.6357638 0.6356848 0.6356056 0.6355264 0.6354470 [309] 0.6353675 0.6352879 0.6352082 0.6351284 0.6350485 0.6349685 0.6348884 [316] 0.6348082 0.6347279 0.6346475 0.6345669 0.6344863 0.6344056 0.6343247 [323] 0.6342438 0.6341627 0.6340816 0.6340003 0.6339190 0.6338375 0.6337559 [330] 0.6336743 0.6335925 0.6335106 0.6334287 0.6333466 0.6332644 0.6331821 [337] 0.6330997 0.6330172 0.6329347 0.6328520 0.6327692 0.6326863 0.6326033 [344] 0.6325202 0.6324370 0.6323537 0.6322703 0.6321868 0.6321032 0.6320195 [351] 0.6319358 0.6318519 0.6317679 0.6316838 0.6315996 0.6315153 0.6314309 [358] 0.6313464 0.6312619 0.6311772 0.6310924 0.6310075 0.6309225 0.6308375 [365] 0.6307523 0.6306670 0.6305817 0.6304962 0.6304107 0.6303250 0.6302393 [372] 0.6301534 0.6300675 0.6299814 0.6298953 0.6298091 0.6297227 0.6296363 [379] 0.6295498 0.6294632 0.6293765 0.6292897 0.6292028 0.6291158 0.6290287 [386] 0.6289416 0.6288543 0.6287669 0.6286795 0.6285919 0.6285043 0.6284166 [393] 0.6283287 0.6282408 0.6281528 0.6280647 0.6279765 0.6278882 0.6277998 [400] 0.6277113 0.6276228 > mx [1] 0.6541496 > 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/1trte1259022677.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/20l561259022677.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/3ujzc1259022677.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/49pid1259022677.tab") > > system("convert tmp/1trte1259022677.ps tmp/1trte1259022677.png") > system("convert tmp/20l561259022677.ps tmp/20l561259022677.png") > system("convert tmp/3ujzc1259022677.ps tmp/3ujzc1259022677.png") > > > proc.time() user system elapsed 0.767 0.508 0.918