R version 2.8.0 (2008-10-20) 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(117.1,118.7,126.5,127.5,134.6,131.8,135.9,142.7,141.7,153.4,145,137.7,148.3,152.2,169.4,168.6,161.1,174.1,179,190.6,190,181.6,174.8,180.5,196.8,193.8,197,216.3,221.4,217.9,229.7,227.4,204.2,196.6,198.8,207.5,190.7,201.6,210.5,223.5,223.8,231.2,244,234.7,250.2,265.7,287.6,283.3,295.4,312.3,333.8,347.7,383.2,407.1,413.6,362.7,321.9,239.4,191,159.7,163.4) > x <- c(562,561,555,544,537,543,594,611,613,611,594,595,591,589,584,573,567,569,621,629,628,612,595,597,593,590,580,574,573,573,620,626,620,588,566,557,561,549,532,526,511,499,555,565,542,527,510,514,517,508,493,490,469,478,528,534,518,506,502,516,528) > #'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.6401059 -0.6399910 -0.6398759 -0.6397607 -0.6396455 -0.6395301 [7] -0.6394146 -0.6392990 -0.6391834 -0.6390676 -0.6389517 -0.6388357 [13] -0.6387195 -0.6386033 -0.6384870 -0.6383706 -0.6382540 -0.6381374 [19] -0.6380207 -0.6379038 -0.6377869 -0.6376698 -0.6375526 -0.6374354 [25] -0.6373180 -0.6372005 -0.6370829 -0.6369653 -0.6368475 -0.6367296 [31] -0.6366116 -0.6364935 -0.6363753 -0.6362570 -0.6361386 -0.6360201 [37] -0.6359014 -0.6357827 -0.6356639 -0.6355450 -0.6354259 -0.6353068 [43] -0.6351876 -0.6350682 -0.6349488 -0.6348293 -0.6347096 -0.6345899 [49] -0.6344700 -0.6343501 -0.6342300 -0.6341099 -0.6339896 -0.6338693 [55] -0.6337488 -0.6336283 -0.6335076 -0.6333869 -0.6332660 -0.6331451 [61] -0.6330240 -0.6329028 -0.6327816 -0.6326602 -0.6325388 -0.6324172 [67] -0.6322955 -0.6321738 -0.6320519 -0.6319300 -0.6318079 -0.6316857 [73] -0.6315635 -0.6314411 -0.6313187 -0.6311961 -0.6310735 -0.6309507 [79] -0.6308279 -0.6307049 -0.6305819 -0.6304587 -0.6303355 -0.6302121 [85] -0.6300887 -0.6299652 -0.6298415 -0.6297178 -0.6295940 -0.6294700 [91] -0.6293460 -0.6292219 -0.6290977 -0.6289734 -0.6288489 -0.6287244 [97] -0.6285998 -0.6284751 -0.6283503 -0.6282254 -0.6281004 -0.6279754 [103] -0.6278502 -0.6277249 -0.6275995 -0.6274741 -0.6273485 -0.6272228 [109] -0.6270971 -0.6269712 -0.6268453 -0.6267192 -0.6265931 -0.6264669 [115] -0.6263405 -0.6262141 -0.6260876 -0.6259610 -0.6258343 -0.6257075 [121] -0.6255806 -0.6254536 -0.6253266 -0.6251994 -0.6250721 -0.6249448 [127] -0.6248173 -0.6246898 -0.6245621 -0.6244344 -0.6243066 -0.6241787 [133] -0.6240507 -0.6239226 -0.6237944 -0.6236661 -0.6235377 -0.6234092 [139] -0.6232807 -0.6231520 -0.6230233 -0.6228945 -0.6227655 -0.6226365 [145] -0.6225074 -0.6223782 -0.6222489 -0.6221196 -0.6219901 -0.6218605 [151] -0.6217309 -0.6216011 -0.6214713 -0.6213414 -0.6212114 -0.6210813 [157] -0.6209511 -0.6208208 -0.6206904 -0.6205600 -0.6204294 -0.6202988 [163] -0.6201681 -0.6200372 -0.6199063 -0.6197753 -0.6196443 -0.6195131 [169] -0.6193818 -0.6192505 -0.6191191 -0.6189875 -0.6188559 -0.6187242 [175] -0.6185924 -0.6184606 -0.6183286 -0.6181966 -0.6180644 -0.6179322 [181] -0.6177999 -0.6176675 -0.6175350 -0.6174025 -0.6172698 -0.6171371 [187] -0.6170043 -0.6168713 -0.6167384 -0.6166053 -0.6164721 -0.6163388 [193] -0.6162055 -0.6160721 -0.6159386 -0.6158050 -0.6156713 -0.6155375 [199] -0.6154037 -0.6152698 -0.6151357 -0.6150016 -0.6148675 -0.6147332 [205] -0.6145988 -0.6144644 -0.6143299 -0.6141953 -0.6140606 -0.6139258 [211] -0.6137910 -0.6136560 -0.6135210 -0.6133859 -0.6132507 -0.6131155 [217] -0.6129801 -0.6128447 -0.6127092 -0.6125736 -0.6124379 -0.6123021 [223] -0.6121663 -0.6120304 -0.6118943 -0.6117583 -0.6116221 -0.6114858 [229] -0.6113495 -0.6112131 -0.6110766 -0.6109400 -0.6108034 -0.6106667 [235] -0.6105298 -0.6103930 -0.6102560 -0.6101189 -0.6099818 -0.6098446 [241] -0.6097073 -0.6095699 -0.6094325 -0.6092949 -0.6091573 -0.6090196 [247] -0.6088819 -0.6087440 -0.6086061 -0.6084681 -0.6083300 -0.6081919 [253] -0.6080536 -0.6079153 -0.6077769 -0.6076385 -0.6074999 -0.6073613 [259] -0.6072226 -0.6070838 -0.6069450 -0.6068060 -0.6066670 -0.6065279 [265] -0.6063888 -0.6062495 -0.6061102 -0.6059708 -0.6058314 -0.6056918 [271] -0.6055522 -0.6054125 -0.6052728 -0.6051329 -0.6049930 -0.6048530 [277] -0.6047129 -0.6045728 -0.6044326 -0.6042923 -0.6041519 -0.6040115 [283] -0.6038710 -0.6037304 -0.6035897 -0.6034490 -0.6033082 -0.6031673 [289] -0.6030263 -0.6028853 -0.6027442 -0.6026030 -0.6024617 -0.6023204 [295] -0.6021790 -0.6020376 -0.6018960 -0.6017544 -0.6016127 -0.6014710 [301] -0.6013291 -0.6011872 -0.6010453 -0.6009032 -0.6007611 -0.6006189 [307] -0.6004766 -0.6003343 -0.6001919 -0.6000494 -0.5999069 -0.5997643 [313] -0.5996216 -0.5994789 -0.5993360 -0.5991931 -0.5990502 -0.5989071 [319] -0.5987640 -0.5986209 -0.5984776 -0.5983343 -0.5981909 -0.5980475 [325] -0.5979040 -0.5977604 -0.5976167 -0.5974730 -0.5973292 -0.5971853 [331] -0.5970414 -0.5968974 -0.5967534 -0.5966092 -0.5964650 -0.5963208 [337] -0.5961764 -0.5960320 -0.5958876 -0.5957430 -0.5955984 -0.5954537 [343] -0.5953090 -0.5951642 -0.5950193 -0.5948744 -0.5947294 -0.5945843 [349] -0.5944392 -0.5942940 -0.5941487 -0.5940034 -0.5938580 -0.5937126 [355] -0.5935670 -0.5934214 -0.5932758 -0.5931301 -0.5929843 -0.5928384 [361] -0.5926925 -0.5925466 -0.5924005 -0.5922544 -0.5921082 -0.5919620 [367] -0.5918157 -0.5916694 -0.5915229 -0.5913765 -0.5912299 -0.5910833 [373] -0.5909366 -0.5907899 -0.5906431 -0.5904962 -0.5903493 -0.5902023 [379] -0.5900553 -0.5899082 -0.5897610 -0.5896138 -0.5894665 -0.5893191 [385] -0.5891717 -0.5890242 -0.5888767 -0.5887291 -0.5885814 -0.5884337 [391] -0.5882859 -0.5881381 -0.5879902 -0.5878422 -0.5876942 -0.5875461 [397] -0.5873980 -0.5872498 -0.5871015 -0.5869532 -0.5868048 > mx [1] 0.6401059 > 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/freestat/rcomp/tmp/1t9221257955309.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/freestat/rcomp/tmp/2zjfv1257955309.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/freestat/rcomp/tmp/3ykzq1257955309.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/4bvhz1257955309.tab") > > system("convert tmp/1t9221257955309.ps tmp/1t9221257955309.png") > system("convert tmp/2zjfv1257955309.ps tmp/2zjfv1257955309.png") > system("convert tmp/3ykzq1257955309.ps tmp/3ykzq1257955309.png") > > > proc.time() user system elapsed 1.251 0.822 1.716