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(118.9,108.8,115.6,95.0,92.8,108.9,109.8,106.1,102.8,98.4,85.7,114.6,129.4,117.7,126.6,103.8,101.5,118.7,119.6,114.8,109.9,106.3,95.0,124.5,140.4,128.8,137.5,113.3,110.3,129.1,128.4,120.3,113.6,96.9,124.7,126.4,131.9,122.5,113.1,99.8,116.0,115.0,114.0,111.0,91.7,90.6,103.3,106.7,111.2,102.9,126.5,115.1,110.2,110.1,103.3,107.7,103.9,114.0,117.2,117.0,116.5) > x <- c(116.1,102.5,102.0,101.3,100.6,100.9,104.2,108.3,108.9,109.9,106.8,112.7,113.4,101.3,97.8,95.0,93.8,94.5,101.4,105.8,106.6,109.7,108.8,113.4,113.7,103.6,98.2,95.5,94.4,95.9,103.2,104.1,127.6,130.3,133.0,140.4,123.5,116.9,115.9,113.1,112.1,112.4,118.9,117.4,115.6,120.7,114.9,122.0,119.6,114.6,118.4,110.9,111.6,114.6,112.1,117.4,114.8,123.4,118.1,121.9,123.3) > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = '' > par2 = '' > par1 = '' > ylab = '' > xlab = '' > main = '' > #'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.01157874 0.01167098 0.01176330 0.01185569 0.01194815 0.01204070 [7] 0.01213331 0.01222600 0.01231876 0.01241160 0.01250451 0.01259750 [13] 0.01269056 0.01278369 0.01287690 0.01297018 0.01306353 0.01315696 [19] 0.01325046 0.01334403 0.01343768 0.01353140 0.01362519 0.01371906 [25] 0.01381300 0.01390701 0.01400109 0.01409525 0.01418948 0.01428378 [31] 0.01437816 0.01447260 0.01456712 0.01466171 0.01475637 0.01485111 [37] 0.01494591 0.01504079 0.01513574 0.01523076 0.01532585 0.01542102 [43] 0.01551625 0.01561156 0.01570693 0.01580238 0.01589790 0.01599349 [49] 0.01608915 0.01618487 0.01628067 0.01637655 0.01647249 0.01656850 [55] 0.01666458 0.01676073 0.01685695 0.01695324 0.01704960 0.01714603 [61] 0.01724252 0.01733909 0.01743573 0.01753243 0.01762921 0.01772605 [67] 0.01782296 0.01791995 0.01801700 0.01811411 0.01821130 0.01830855 [73] 0.01840588 0.01850327 0.01860073 0.01869825 0.01879585 0.01889351 [79] 0.01899124 0.01908903 0.01918690 0.01928483 0.01938283 0.01948089 [85] 0.01957902 0.01967722 0.01977548 0.01987382 0.01997221 0.02007068 [91] 0.02016921 0.02026780 0.02036647 0.02046519 0.02056399 0.02066285 [97] 0.02076177 0.02086076 0.02095982 0.02105894 0.02115812 0.02125737 [103] 0.02135668 0.02145606 0.02155551 0.02165502 0.02175459 0.02185423 [109] 0.02195393 0.02205369 0.02215352 0.02225341 0.02235337 0.02245339 [115] 0.02255347 0.02265361 0.02275382 0.02285409 0.02295443 0.02305482 [121] 0.02315528 0.02325581 0.02335639 0.02345704 0.02355775 0.02365852 [127] 0.02375935 0.02386024 0.02396120 0.02406222 0.02416329 0.02426443 [133] 0.02436563 0.02446690 0.02456822 0.02466960 0.02477105 0.02487255 [139] 0.02497411 0.02507574 0.02517742 0.02527917 0.02538097 0.02548283 [145] 0.02558476 0.02568674 0.02578878 0.02589088 0.02599304 0.02609526 [151] 0.02619754 0.02629987 0.02640227 0.02650472 0.02660723 0.02670980 [157] 0.02681243 0.02691511 0.02701785 0.02712065 0.02722351 0.02732642 [163] 0.02742939 0.02753242 0.02763551 0.02773865 0.02784185 0.02794510 [169] 0.02804841 0.02815178 0.02825520 0.02835868 0.02846221 0.02856580 [175] 0.02866944 0.02877314 0.02887690 0.02898071 0.02908457 0.02918849 [181] 0.02929246 0.02939649 0.02950057 0.02960471 0.02970890 0.02981314 [187] 0.02991744 0.03002179 0.03012619 0.03023065 0.03033516 0.03043972 [193] 0.03054434 0.03064901 0.03075373 0.03085850 0.03096333 0.03106820 [199] 0.03117313 0.03127811 0.03138314 0.03148823 0.03159336 0.03169855 [205] 0.03180378 0.03190907 0.03201441 0.03211980 0.03222523 0.03233072 [211] 0.03243626 0.03254185 0.03264749 0.03275317 0.03285891 0.03296470 [217] 0.03307053 0.03317641 0.03328235 0.03338833 0.03349436 0.03360043 [223] 0.03370656 0.03381273 0.03391895 0.03402522 0.03413154 0.03423790 [229] 0.03434431 0.03445077 0.03455727 0.03466382 0.03477042 0.03487706 [235] 0.03498375 0.03509049 0.03519727 0.03530410 0.03541097 0.03551789 [241] 0.03562485 0.03573186 0.03583891 0.03594600 0.03605315 0.03616033 [247] 0.03626756 0.03637484 0.03648215 0.03658951 0.03669692 0.03680437 [253] 0.03691186 0.03701939 0.03712697 0.03723459 0.03734225 0.03744995 [259] 0.03755770 0.03766549 0.03777331 0.03788119 0.03798910 0.03809705 [265] 0.03820505 0.03831308 0.03842116 0.03852927 0.03863743 0.03874563 [271] 0.03885387 0.03896214 0.03907046 0.03917882 0.03928721 0.03939565 [277] 0.03950412 0.03961263 0.03972118 0.03982977 0.03993840 0.04004706 [283] 0.04015577 0.04026451 0.04037328 0.04048210 0.04059095 0.04069984 [289] 0.04080877 0.04091773 0.04102673 0.04113577 0.04124484 0.04135395 [295] 0.04146309 0.04157227 0.04168148 0.04179073 0.04190002 0.04200933 [301] 0.04211869 0.04222808 0.04233750 0.04244695 0.04255644 0.04266597 [307] 0.04277552 0.04288511 0.04299474 0.04310439 0.04321408 0.04332380 [313] 0.04343356 0.04354334 0.04365316 0.04376301 0.04387289 0.04398280 [319] 0.04409275 0.04420272 0.04431273 0.04442276 0.04453283 0.04464293 [325] 0.04475305 0.04486321 0.04497340 0.04508361 0.04519386 0.04530413 [331] 0.04541444 0.04552477 0.04563513 0.04574552 0.04585593 0.04596638 [337] 0.04607685 0.04618735 0.04629788 0.04640843 0.04651901 0.04662962 [343] 0.04674026 0.04685092 0.04696161 0.04707232 0.04718306 0.04729382 [349] 0.04740461 0.04751543 0.04762627 0.04773713 0.04784802 0.04795894 [355] 0.04806988 0.04818084 0.04829182 0.04840283 0.04851387 0.04862492 [361] 0.04873600 0.04884710 0.04895823 0.04906937 0.04918054 0.04929173 [367] 0.04940295 0.04951418 0.04962544 0.04973671 0.04984801 0.04995933 [373] 0.05007067 0.05018203 0.05029341 0.05040481 0.05051623 0.05062767 [379] 0.05073913 0.05085060 0.05096210 0.05107362 0.05118515 0.05129670 [385] 0.05140827 0.05151986 0.05163147 0.05174309 0.05185473 0.05196639 [391] 0.05207806 0.05218975 0.05230146 0.05241318 0.05252492 0.05263668 [397] 0.05274845 0.05286024 0.05297204 0.05308386 0.05319569 > mx [1] 0.05319569 > 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/1m23c1226355486.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/2i1rt1226355486.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/305an1226355486.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/4eeui1226355486.tab") > > system("convert tmp/1m23c1226355486.ps tmp/1m23c1226355486.png") > system("convert tmp/2i1rt1226355486.ps tmp/2i1rt1226355486.png") > system("convert tmp/305an1226355486.ps tmp/305an1226355486.png") > > > proc.time() user system elapsed 0.995 0.513 1.168