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(241.66,251.25,230.26,240.91,211.20,188.19,177.01,167.85,174.03,170.09,203.42,254.97,342.84,386.29,440.51,433.58,408.13,370.32,355.51,332.62,314.62,301.73,306.31,282.98,266.48,249.97,259.87,246.24,238.36,238.04,224.19,214.71,203.11,221.00,211.73,209.39,217.48,242.19,244.64,232.07,235.80,230.37,209.82,206.41,209.60,192.24,186.17,193.41,202.36,203.00,190.64,185.43,171.58,179.57,180.42,162.10,157.95,146.66,154.43,163.38,150.92,151.98,144.74,140.37,143.36,135.79,134.73,126.42,124.72,117.90,114.07,112.26,105.44,110.77,107.68,105.76,102.03,100.22,111.62,118.11,111.72,103.42,97.13,103.10,104.91,100.22,98.52,95.32,96.92,96.60,92.55,82.75,80.84,79.13,79.77,85.10,96.39,97.56,96.39,101.18,103.52,100.11,99.26,104.48,101.29,100.33,115.24,113.64,115.35,108.42,105.65,108.64,104.80,95.43,104.48,103.84,100.01) > x <- c(124.06,124.58,122.00,124.02,124.16,124.29,123.93,124.62,121.81,124.14,124.31,125.15,125.35,125.48,124.17,125.33,124.46,123.39,123.14,122.24,119.31,120.87,120.43,119.41,118.85,119.08,117.25,118.51,118.42,118.56,117.97,117.98,115.25,117.23,117.08,116.83,117.17,117.73,115.74,116.99,116.90,116.49,115.84,115.92,113.32,114.84,114.75,114.84,115.03,115.03,112.99,114.15,113.77,113.57,113.38,112.71,110.27,111.73,112.12,112.31,111.73,111.83,109.99,111.15,111.25,110.87,110.27,110.18,108.15,109.60,109.60,109.41,109.80,109.60,107.76,109.02,108.62,109.02,109.22,108.92,106.69,107.76,107.66,107.85,107.95,107.85,106.30,107.37,107.66,107.46,107.37,107.18,105.43,106.39,106.50,106.50,106.69,106.50,105.14,106.50,106.20,105.72,104.76,104.55,102.71,104.36,104.65,104.46,104.65,103.88,102.32,103.39,103.00,102.71,102.51,102.04,100.00) > #'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.8419576 0.8420052 0.8420526 0.8421000 0.8421473 0.8421945 0.8422416 [8] 0.8422886 0.8423355 0.8423823 0.8424291 0.8424757 0.8425223 0.8425688 [15] 0.8426151 0.8426614 0.8427077 0.8427538 0.8427998 0.8428457 0.8428916 [22] 0.8429373 0.8429830 0.8430286 0.8430741 0.8431195 0.8431648 0.8432100 [29] 0.8432551 0.8433002 0.8433451 0.8433900 0.8434348 0.8434795 0.8435241 [36] 0.8435686 0.8436130 0.8436573 0.8437015 0.8437457 0.8437897 0.8438337 [43] 0.8438776 0.8439214 0.8439651 0.8440087 0.8440522 0.8440956 0.8441389 [50] 0.8441822 0.8442253 0.8442684 0.8443114 0.8443543 0.8443971 0.8444398 [57] 0.8444824 0.8445249 0.8445674 0.8446097 0.8446520 0.8446941 0.8447362 [64] 0.8447782 0.8448201 0.8448619 0.8449036 0.8449453 0.8449868 0.8450283 [71] 0.8450696 0.8451109 0.8451521 0.8451932 0.8452342 0.8452751 0.8453159 [78] 0.8453566 0.8453973 0.8454378 0.8454783 0.8455186 0.8455589 0.8455991 [85] 0.8456392 0.8456792 0.8457191 0.8457590 0.8457987 0.8458384 0.8458779 [92] 0.8459174 0.8459568 0.8459961 0.8460353 0.8460744 0.8461134 0.8461523 [99] 0.8461911 0.8462299 0.8462686 0.8463071 0.8463456 0.8463840 0.8464223 [106] 0.8464605 0.8464986 0.8465367 0.8465746 0.8466124 0.8466502 0.8466879 [113] 0.8467255 0.8467629 0.8468003 0.8468377 0.8468749 0.8469120 0.8469490 [120] 0.8469860 0.8470228 0.8470596 0.8470963 0.8471329 0.8471694 0.8472058 [127] 0.8472421 0.8472783 0.8473145 0.8473505 0.8473865 0.8474223 0.8474581 [134] 0.8474938 0.8475294 0.8475649 0.8476003 0.8476357 0.8476709 0.8477061 [141] 0.8477411 0.8477761 0.8478110 0.8478457 0.8478804 0.8479150 0.8479496 [148] 0.8479840 0.8480183 0.8480526 0.8480867 0.8481208 0.8481548 0.8481887 [155] 0.8482225 0.8482562 0.8482898 0.8483233 0.8483568 0.8483901 0.8484234 [162] 0.8484565 0.8484896 0.8485226 0.8485555 0.8485883 0.8486210 0.8486536 [169] 0.8486862 0.8487186 0.8487510 0.8487832 0.8488154 0.8488475 0.8488795 [176] 0.8489114 0.8489432 0.8489750 0.8490066 0.8490381 0.8490696 0.8491010 [183] 0.8491323 0.8491634 0.8491945 0.8492255 0.8492565 0.8492873 0.8493180 [190] 0.8493487 0.8493792 0.8494097 0.8494401 0.8494704 0.8495006 0.8495307 [197] 0.8495607 0.8495906 0.8496205 0.8496502 0.8496799 0.8497095 0.8497389 [204] 0.8497683 0.8497976 0.8498269 0.8498560 0.8498850 0.8499140 0.8499428 [211] 0.8499716 0.8500002 0.8500288 0.8500573 0.8500857 0.8501140 0.8501423 [218] 0.8501704 0.8501985 0.8502264 0.8502543 0.8502821 0.8503097 0.8503373 [225] 0.8503648 0.8503923 0.8504196 0.8504468 0.8504740 0.8505010 0.8505280 [232] 0.8505549 0.8505817 0.8506084 0.8506350 0.8506615 0.8506880 0.8507143 [239] 0.8507406 0.8507667 0.8507928 0.8508188 0.8508447 0.8508705 0.8508962 [246] 0.8509218 0.8509474 0.8509728 0.8509982 0.8510235 0.8510486 0.8510737 [253] 0.8510987 0.8511237 0.8511485 0.8511732 0.8511979 0.8512224 0.8512469 [260] 0.8512713 0.8512956 0.8513198 0.8513439 0.8513679 0.8513918 0.8514157 [267] 0.8514394 0.8514631 0.8514867 0.8515102 0.8515336 0.8515569 0.8515801 [274] 0.8516032 0.8516263 0.8516492 0.8516721 0.8516948 0.8517175 0.8517401 [281] 0.8517626 0.8517851 0.8518074 0.8518296 0.8518518 0.8518738 0.8518958 [288] 0.8519177 0.8519395 0.8519612 0.8519828 0.8520044 0.8520258 0.8520472 [295] 0.8520684 0.8520896 0.8521107 0.8521317 0.8521526 0.8521734 0.8521941 [302] 0.8522148 0.8522353 0.8522558 0.8522762 0.8522965 0.8523167 0.8523368 [309] 0.8523568 0.8523768 0.8523966 0.8524164 0.8524360 0.8524556 0.8524751 [316] 0.8524945 0.8525138 0.8525331 0.8525522 0.8525712 0.8525902 0.8526091 [323] 0.8526279 0.8526466 0.8526652 0.8526837 0.8527021 0.8527205 0.8527387 [330] 0.8527569 0.8527750 0.8527930 0.8528109 0.8528287 0.8528464 0.8528641 [337] 0.8528816 0.8528991 0.8529165 0.8529337 0.8529509 0.8529681 0.8529851 [344] 0.8530020 0.8530189 0.8530356 0.8530523 0.8530689 0.8530854 0.8531018 [351] 0.8531181 0.8531343 0.8531505 0.8531666 0.8531825 0.8531984 0.8532142 [358] 0.8532299 0.8532455 0.8532611 0.8532765 0.8532919 0.8533071 0.8533223 [365] 0.8533374 0.8533524 0.8533674 0.8533822 0.8533969 0.8534116 0.8534262 [372] 0.8534406 0.8534550 0.8534694 0.8534836 0.8534977 0.8535118 0.8535257 [379] 0.8535396 0.8535534 0.8535671 0.8535807 0.8535942 0.8536077 0.8536210 [386] 0.8536343 0.8536474 0.8536605 0.8536735 0.8536865 0.8536993 0.8537120 [393] 0.8537247 0.8537373 0.8537497 0.8537621 0.8537744 0.8537867 0.8537988 [400] 0.8538109 0.8538228 > mx [1] 0.8538228 > 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/1peof1257760908.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/2er9r1257760908.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/3wmpd1257760908.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/4lxaf1257760908.tab") > > system("convert tmp/1peof1257760908.ps tmp/1peof1257760908.png") > system("convert tmp/2er9r1257760908.ps tmp/2er9r1257760908.png") > system("convert tmp/3wmpd1257760908.ps tmp/3wmpd1257760908.png") > > > proc.time() user system elapsed 0.774 0.494 1.008