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(43.5,37.7,36.8,24.4,31.3,43.9,53.6,48.9,30.9,31.8,41.3,43.7,54.1,47.8,36.7,30.8,31.9,61.7,73,64.7,24.2,33.9,32.4,63.2,71.8,60.4,48,44.5,44.9,70.9,72.7,59.5,35.9,40,43.6,57.2,75.8,57.7,47.7,42.3,43,68,70.6,54.2,38.6,40.3,49.2,68.5,75.9,63.2,49.8,37,48.8,74.9,75.3,66.9,44.1,39.8,56.6,77.1,78.5,70.6,54.2,47.2,55.1,74.5,88,80.8,54.4,55.2,73.8,85.3,98.7,86.1,62.5,58.6,67,88.4,96.5,87.1,61.2,62.5,85.2,101.7,113.7) > x <- c(62.2,88.5,93.3,89.2,101.3,97,102.2,100.3,78.2,105.9,119.9,108,77,93.1,109.5,100.4,99,113.9,102.1,101.6,84,110.7,111.6,110.7,73.1,87.5,109.6,99.3,92.1,109.3,94.5,91.4,82.9,103.3,96,104.8,65.8,78.7,100.3,85,94.5,97.9,91.9,87.2,84.4,99.2,105.4,110.9,69.8,86.8,106.7,88.8,96.9,108.1,93.7,94.8,79.8,95.6,107.9,104.9,61.9,85.7,92.4,86.4,99.3,95.5,97,102.1,77.8,105.5,113.2,108.8,66.9,89.3,93.6,92,99.5,98.6,94.6,96.7,75.3,102.5,115.1,104.7,71.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.14953602 -0.14938646 -0.14923669 -0.14908668 -0.14893645 -0.14878600 [7] -0.14863532 -0.14848443 -0.14833330 -0.14818196 -0.14803040 -0.14787862 [13] -0.14772662 -0.14757441 -0.14742198 -0.14726933 -0.14711647 -0.14696340 [19] -0.14681012 -0.14665662 -0.14650291 -0.14634900 -0.14619487 -0.14604054 [25] -0.14588601 -0.14573126 -0.14557632 -0.14542117 -0.14526581 -0.14511026 [31] -0.14495450 -0.14479855 -0.14464240 -0.14448605 -0.14432950 -0.14417276 [37] -0.14401582 -0.14385869 -0.14370137 -0.14354386 -0.14338615 -0.14322826 [43] -0.14307018 -0.14291191 -0.14275345 -0.14259481 -0.14243599 -0.14227698 [49] -0.14211779 -0.14195842 -0.14179887 -0.14163914 -0.14147923 -0.14131914 [55] -0.14115888 -0.14099844 -0.14083783 -0.14067704 -0.14051609 -0.14035496 [61] -0.14019367 -0.14003220 -0.13987057 -0.13970877 -0.13954680 -0.13938467 [67] -0.13922238 -0.13905993 -0.13889731 -0.13873453 -0.13857160 -0.13840850 [73] -0.13824525 -0.13808184 -0.13791828 -0.13775457 -0.13759070 -0.13742668 [79] -0.13726251 -0.13709819 -0.13693372 -0.13676910 -0.13660434 -0.13643943 [85] -0.13627438 -0.13610919 -0.13594385 -0.13577838 -0.13561276 -0.13544700 [91] -0.13528111 -0.13511508 -0.13494892 -0.13478262 -0.13461619 -0.13444962 [97] -0.13428293 -0.13411610 -0.13394915 -0.13378207 -0.13361486 -0.13344753 [103] -0.13328007 -0.13311249 -0.13294479 -0.13277697 -0.13260902 -0.13244096 [109] -0.13227278 -0.13210449 -0.13193607 -0.13176755 -0.13159891 -0.13143016 [115] -0.13126130 -0.13109232 -0.13092324 -0.13075406 -0.13058476 -0.13041536 [121] -0.13024586 -0.13007625 -0.12990654 -0.12973673 -0.12956682 -0.12939681 [127] -0.12922670 -0.12905650 -0.12888620 -0.12871581 -0.12854532 -0.12837475 [133] -0.12820408 -0.12803332 -0.12786248 -0.12769154 -0.12752052 -0.12734942 [139] -0.12717823 -0.12700696 -0.12683560 -0.12666417 -0.12649265 -0.12632106 [145] -0.12614939 -0.12597764 -0.12580582 -0.12563393 -0.12546196 -0.12528992 [151] -0.12511781 -0.12494563 -0.12477338 -0.12460107 -0.12442869 -0.12425624 [157] -0.12408373 -0.12391116 -0.12373852 -0.12356583 -0.12339307 -0.12322026 [163] -0.12304739 -0.12287447 -0.12270148 -0.12252845 -0.12235536 -0.12218223 [169] -0.12200904 -0.12183580 -0.12166251 -0.12148918 -0.12131580 -0.12114238 [175] -0.12096891 -0.12079540 -0.12062185 -0.12044825 -0.12027462 -0.12010095 [181] -0.11992725 -0.11975350 -0.11957973 -0.11940592 -0.11923207 -0.11905820 [187] -0.11888429 -0.11871036 -0.11853639 -0.11836240 -0.11818839 -0.11801435 [193] -0.11784028 -0.11766619 -0.11749208 -0.11731795 -0.11714380 -0.11696964 [199] -0.11679545 -0.11662125 -0.11644703 -0.11627280 -0.11609856 -0.11592431 [205] -0.11575004 -0.11557577 -0.11540148 -0.11522719 -0.11505289 -0.11487859 [211] -0.11470428 -0.11452997 -0.11435566 -0.11418135 -0.11400704 -0.11383272 [217] -0.11365841 -0.11348411 -0.11330980 -0.11313551 -0.11296122 -0.11278693 [223] -0.11261266 -0.11243839 -0.11226414 -0.11208990 -0.11191567 -0.11174145 [229] -0.11156725 -0.11139307 -0.11121890 -0.11104475 -0.11087062 -0.11069651 [235] -0.11052242 -0.11034835 -0.11017431 -0.11000029 -0.10982629 -0.10965232 [241] -0.10947838 -0.10930447 -0.10913058 -0.10895673 -0.10878291 -0.10860912 [247] -0.10843537 -0.10826164 -0.10808796 -0.10791431 -0.10774070 -0.10756712 [253] -0.10739359 -0.10722010 -0.10704665 -0.10687324 -0.10669987 -0.10652655 [259] -0.10635327 -0.10618004 -0.10600686 -0.10583373 -0.10566065 -0.10548761 [265] -0.10531463 -0.10514170 -0.10496882 -0.10479600 -0.10462324 -0.10445053 [271] -0.10427787 -0.10410528 -0.10393274 -0.10376027 -0.10358785 -0.10341550 [277] -0.10324321 -0.10307098 -0.10289882 -0.10272673 -0.10255470 -0.10238274 [283] -0.10221084 -0.10203902 -0.10186727 -0.10169559 -0.10152398 -0.10135244 [289] -0.10118098 -0.10100960 -0.10083829 -0.10066705 -0.10049590 -0.10032482 [295] -0.10015383 -0.09998291 -0.09981207 -0.09964132 -0.09947065 -0.09930007 [301] -0.09912957 -0.09895915 -0.09878883 -0.09861859 -0.09844844 -0.09827837 [307] -0.09810840 -0.09793852 -0.09776873 -0.09759904 -0.09742944 -0.09725993 [313] -0.09709052 -0.09692120 -0.09675199 -0.09658287 -0.09641385 -0.09624492 [319] -0.09607610 -0.09590739 -0.09573877 -0.09557025 -0.09540184 -0.09523354 [325] -0.09506534 -0.09489725 -0.09472926 -0.09456138 -0.09439361 -0.09422595 [331] -0.09405841 -0.09389097 -0.09372364 -0.09355643 -0.09338933 -0.09322235 [337] -0.09305548 -0.09288872 -0.09272209 -0.09255557 -0.09238917 -0.09222289 [343] -0.09205672 -0.09189068 -0.09172476 -0.09155897 -0.09139329 -0.09122774 [349] -0.09106231 -0.09089701 -0.09073184 -0.09056679 -0.09040187 -0.09023708 [355] -0.09007241 -0.08990788 -0.08974348 -0.08957920 -0.08941506 -0.08925105 [361] -0.08908718 -0.08892344 -0.08875983 -0.08859636 -0.08843303 -0.08826983 [367] -0.08810677 -0.08794385 -0.08778106 -0.08761842 -0.08745592 -0.08729356 [373] -0.08713133 -0.08696926 -0.08680732 -0.08664553 -0.08648388 -0.08632238 [379] -0.08616102 -0.08599981 -0.08583875 -0.08567783 -0.08551707 -0.08535645 [385] -0.08519598 -0.08503566 -0.08487549 -0.08471548 -0.08455561 -0.08439590 [391] -0.08423634 -0.08407694 -0.08391769 -0.08375859 -0.08359965 -0.08344087 [397] -0.08328225 -0.08312378 -0.08296547 -0.08280732 -0.08264933 > mx [1] 0.1495360 > 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/1r32c1226517060.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/2k2io1226517060.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/36egw1226517060.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/4q29y1226517060.tab") > > system("convert tmp/1r32c1226517060.ps tmp/1r32c1226517060.png") > system("convert tmp/2k2io1226517060.ps tmp/2k2io1226517060.png") > system("convert tmp/36egw1226517060.ps tmp/36egw1226517060.png") > > > proc.time() user system elapsed 1.081 0.530 1.487