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(9762.12,10124.63,10540.05,10601.61,10323.73,10418.4,10092.96,10364.91,10152.09,10032.8,10204.59,10001.6,10411.75,10673.38,10539.51,10723.78,10682.06,10283.19,10377.18,10486.64,10545.38,10554.27,10532.54,10324.31,10695.25,10827.81,10872.48,10971.19,11145.65,11234.68,11333.88,10997.97,11036.89,11257.35,11533.59,11963.12,12185.15,12377.62,12512.89,12631.48,12268.53,12754.8,13407.75,13480.21,13673.28,13239.71,13557.69,13901.28,13200.58,13406.97,12538.12,12419.57,12193.88,12656.63,12812.48,12056.67,11322.38,11530.75,11114.08,9181.73) > x <- c(10205.29,10295.98,10892.76,10631.92,11441.08,11950.95,11037.54,11527.72,11383.89,10989.34,11079.42,11028.93,10973,11068.05,11394.84,11545.71,11809.38,11395.64,11082.38,11402.75,11716.87,12204.98,12986.62,13392.79,14368.05,15650.83,16102.64,16187.64,16311.54,17232.97,16397.83,14990.31,15147.55,15786.78,15934.09,16519.44,16101.07,16775.08,17286.32,17741.23,17128.37,17460.53,17611.14,18001.37,17974.77,16460.95,16235.39,16903.36,15543.76,15532.18,13731.31,13547.84,12602.93,13357.7,13995.33,14084.6,13168.91,12989.35,12123.53,9117.03) > #'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.7721910 0.7722648 0.7723381 0.7724108 0.7724830 0.7725547 0.7726258 [8] 0.7726964 0.7727665 0.7728361 0.7729051 0.7729736 0.7730416 0.7731090 [15] 0.7731759 0.7732423 0.7733082 0.7733736 0.7734384 0.7735027 0.7735665 [22] 0.7736298 0.7736926 0.7737548 0.7738166 0.7738778 0.7739385 0.7739987 [29] 0.7740584 0.7741176 0.7741763 0.7742345 0.7742921 0.7743493 0.7744060 [36] 0.7744621 0.7745178 0.7745729 0.7746276 0.7746817 0.7747354 0.7747886 [43] 0.7748412 0.7748934 0.7749451 0.7749963 0.7750470 0.7750972 0.7751469 [50] 0.7751961 0.7752448 0.7752931 0.7753409 0.7753881 0.7754349 0.7754812 [57] 0.7755271 0.7755724 0.7756173 0.7756617 0.7757056 0.7757491 0.7757920 [64] 0.7758345 0.7758765 0.7759181 0.7759591 0.7759998 0.7760399 0.7760796 [71] 0.7761188 0.7761575 0.7761958 0.7762336 0.7762709 0.7763078 0.7763442 [78] 0.7763801 0.7764156 0.7764507 0.7764853 0.7765194 0.7765531 0.7765863 [85] 0.7766190 0.7766514 0.7766832 0.7767146 0.7767456 0.7767761 0.7768062 [92] 0.7768358 0.7768650 0.7768937 0.7769220 0.7769499 0.7769773 0.7770042 [99] 0.7770308 0.7770569 0.7770825 0.7771077 0.7771325 0.7771569 0.7771808 [106] 0.7772043 0.7772273 0.7772500 0.7772722 0.7772939 0.7773153 0.7773362 [113] 0.7773567 0.7773768 0.7773964 0.7774156 0.7774344 0.7774528 0.7774708 [120] 0.7774883 0.7775055 0.7775222 0.7775385 0.7775544 0.7775699 0.7775849 [127] 0.7775996 0.7776138 0.7776277 0.7776411 0.7776541 0.7776668 0.7776790 [134] 0.7776908 0.7777022 0.7777132 0.7777238 0.7777340 0.7777438 0.7777532 [141] 0.7777623 0.7777709 0.7777791 0.7777869 0.7777944 0.7778014 0.7778081 [148] 0.7778144 0.7778202 0.7778257 0.7778308 0.7778356 0.7778399 0.7778438 [155] 0.7778474 0.7778506 0.7778534 0.7778558 0.7778579 0.7778596 0.7778608 [162] 0.7778618 0.7778623 0.7778625 0.7778623 0.7778617 0.7778607 0.7778594 [169] 0.7778577 0.7778557 0.7778533 0.7778505 0.7778473 0.7778438 0.7778399 [176] 0.7778357 0.7778311 0.7778261 0.7778208 0.7778151 0.7778091 0.7778027 [183] 0.7777959 0.7777888 0.7777814 0.7777736 0.7777654 0.7777569 0.7777480 [190] 0.7777388 0.7777292 0.7777193 0.7777091 0.7776985 0.7776875 0.7776762 [197] 0.7776646 0.7776526 0.7776403 0.7776277 0.7776147 0.7776013 0.7775877 [204] 0.7775737 0.7775593 0.7775446 0.7775296 0.7775143 0.7774986 0.7774826 [211] 0.7774663 0.7774496 0.7774327 0.7774153 0.7773977 0.7773797 0.7773614 [218] 0.7773428 0.7773239 0.7773046 0.7772851 0.7772652 0.7772450 0.7772244 [225] 0.7772036 0.7771824 0.7771609 0.7771391 0.7771170 0.7770946 0.7770719 [232] 0.7770488 0.7770255 0.7770018 0.7769779 0.7769536 0.7769290 0.7769041 [239] 0.7768789 0.7768534 0.7768276 0.7768015 0.7767751 0.7767484 0.7767214 [246] 0.7766941 0.7766665 0.7766386 0.7766104 0.7765819 0.7765531 0.7765241 [253] 0.7764947 0.7764650 0.7764351 0.7764049 0.7763743 0.7763435 0.7763124 [260] 0.7762810 0.7762493 0.7762174 0.7761851 0.7761526 0.7761198 0.7760867 [267] 0.7760533 0.7760197 0.7759857 0.7759515 0.7759170 0.7758823 0.7758472 [274] 0.7758119 0.7757763 0.7757405 0.7757043 0.7756679 0.7756313 0.7755943 [281] 0.7755571 0.7755196 0.7754819 0.7754438 0.7754055 0.7753670 0.7753282 [288] 0.7752891 0.7752498 0.7752102 0.7751703 0.7751302 0.7750898 0.7750491 [295] 0.7750082 0.7749671 0.7749257 0.7748840 0.7748421 0.7747999 0.7747574 [302] 0.7747148 0.7746718 0.7746286 0.7745852 0.7745415 0.7744976 0.7744534 [309] 0.7744089 0.7743643 0.7743193 0.7742742 0.7742287 0.7741831 0.7741372 [316] 0.7740910 0.7740447 0.7739980 0.7739512 0.7739041 0.7738567 0.7738092 [323] 0.7737613 0.7737133 0.7736650 0.7736165 0.7735677 0.7735187 0.7734695 [330] 0.7734201 0.7733704 0.7733205 0.7732703 0.7732200 0.7731694 0.7731185 [337] 0.7730675 0.7730162 0.7729647 0.7729130 0.7728610 0.7728089 0.7727565 [344] 0.7727039 0.7726510 0.7725980 0.7725447 0.7724912 0.7724375 0.7723836 [351] 0.7723294 0.7722750 0.7722205 0.7721657 0.7721107 0.7720555 0.7720000 [358] 0.7719444 0.7718885 0.7718325 0.7717762 0.7717197 0.7716630 0.7716061 [365] 0.7715490 0.7714917 0.7714342 0.7713765 0.7713186 0.7712604 0.7712021 [372] 0.7711436 0.7710848 0.7710259 0.7709668 0.7709074 0.7708479 0.7707882 [379] 0.7707282 0.7706681 0.7706078 0.7705473 0.7704866 0.7704257 0.7703646 [386] 0.7703033 0.7702418 0.7701801 0.7701182 0.7700562 0.7699939 0.7699315 [393] 0.7698689 0.7698060 0.7697430 0.7696799 0.7696165 0.7695529 0.7694892 [400] 0.7694253 0.7693611 > mx [1] 0.7778625 > mxli [1] -0.37 > 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/1q4he1226511960.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/2o8wn1226511960.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/3c9zk1226511960.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/4917h1226511960.tab") > > system("convert tmp/1q4he1226511960.ps tmp/1q4he1226511960.png") > system("convert tmp/2o8wn1226511960.ps tmp/2o8wn1226511960.png") > system("convert tmp/3c9zk1226511960.ps tmp/3c9zk1226511960.png") > > > proc.time() user system elapsed 1.218 0.794 1.367