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(0.86,0.88,0.88,0.88,0.87,0.88,0.87,0.85,0.84,0.83,0.86,0.87,0.85,0.89,0.98,1.01,1,1.01,1.05,1,0.99,1.02,1.11,1.15,1.18,1.2,1.22,1.2,1.23,1.23,1.21,1.25,1.2,1.2,1.21,1.25,1.23,1.2,1.18,1.16,1.12,1.11,1.1,1.08,1.01,1.01,0.99,1.07,1.13,1.09,0.95,0.79,0.73,0.7,0.65,0.61,0.53,0.51,0.41,0.42) > x <- c(2756.76,2849.27,2921.44,2981.85,3080.58,3106.22,3119.31,3061.26,3097.31,3161.69,3257.16,3277.01,3295.32,3363.99,3494.17,3667.03,3813.06,3917.96,3895.51,3801.06,3570.12,3701.61,3862.27,3970.1,4138.52,4199.75,4290.89,4443.91,4502.64,4356.98,4591.27,4696.96,4621.4,4562.84,4202.52,4296.49,4435.23,4105.18,4116.68,3844.49,3720.98,3674.4,3857.62,3801.06,3504.37,3032.6,3047.03,2962.34,2197.82,2014.45,1862.83,1905.41,1810.99,1670.07,1864.44,2052.02,2029.6,2070.83,2293.41,2443.27) > #'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.6873970 0.6879329 0.6884686 0.6890041 0.6895394 0.6900744 0.6906093 [8] 0.6911439 0.6916783 0.6922125 0.6927464 0.6932801 0.6938135 0.6943466 [15] 0.6948795 0.6954121 0.6959444 0.6964764 0.6970082 0.6975396 0.6980707 [22] 0.6986015 0.6991319 0.6996620 0.7001918 0.7007212 0.7012503 0.7017790 [29] 0.7023074 0.7028353 0.7033629 0.7038901 0.7044169 0.7049433 0.7054693 [36] 0.7059949 0.7065200 0.7070447 0.7075690 0.7080928 0.7086162 0.7091391 [43] 0.7096616 0.7101835 0.7107050 0.7112260 0.7117465 0.7122665 0.7127859 [50] 0.7133049 0.7138233 0.7143412 0.7148585 0.7153753 0.7158916 0.7164072 [57] 0.7169223 0.7174369 0.7179508 0.7184641 0.7189769 0.7194890 0.7200005 [64] 0.7205114 0.7210216 0.7215312 0.7220402 0.7225485 0.7230561 0.7235631 [71] 0.7240694 0.7245750 0.7250799 0.7255842 0.7260877 0.7265905 0.7270925 [78] 0.7275939 0.7280945 0.7285943 0.7290934 0.7295917 0.7300893 0.7305861 [85] 0.7310821 0.7315773 0.7320717 0.7325653 0.7330581 0.7335501 0.7340412 [92] 0.7345315 0.7350210 0.7355096 0.7359973 0.7364842 0.7369702 0.7374553 [99] 0.7379395 0.7384228 0.7389052 0.7393867 0.7398673 0.7403469 0.7408257 [106] 0.7413034 0.7417802 0.7422561 0.7427310 0.7432049 0.7436778 0.7441498 [113] 0.7446207 0.7450906 0.7455596 0.7460275 0.7464944 0.7469602 0.7474250 [120] 0.7478888 0.7483515 0.7488131 0.7492737 0.7497331 0.7501915 0.7506489 [127] 0.7511051 0.7515602 0.7520141 0.7524670 0.7529187 0.7533693 0.7538188 [134] 0.7542671 0.7547142 0.7551602 0.7556050 0.7560486 0.7564911 0.7569323 [141] 0.7573724 0.7578112 0.7582488 0.7586852 0.7591204 0.7595543 0.7599870 [148] 0.7604185 0.7608487 0.7612776 0.7617053 0.7621317 0.7625568 0.7629806 [155] 0.7634031 0.7638243 0.7642442 0.7646628 0.7650801 0.7654960 0.7659107 [162] 0.7663239 0.7667358 0.7671464 0.7675556 0.7679635 0.7683699 0.7687750 [169] 0.7691787 0.7695810 0.7699819 0.7703815 0.7707796 0.7711762 0.7715715 [176] 0.7719654 0.7723578 0.7727487 0.7731382 0.7735263 0.7739129 0.7742981 [183] 0.7746818 0.7750640 0.7754447 0.7758240 0.7762017 0.7765780 0.7769527 [190] 0.7773260 0.7776978 0.7780680 0.7784367 0.7788039 0.7791695 0.7795336 [197] 0.7798962 0.7802572 0.7806167 0.7809746 0.7813309 0.7816857 0.7820389 [204] 0.7823906 0.7827406 0.7830891 0.7834360 0.7837813 0.7841249 0.7844670 [211] 0.7848075 0.7851463 0.7854836 0.7858192 0.7861532 0.7864856 0.7868163 [218] 0.7871454 0.7874728 0.7877987 0.7881228 0.7884453 0.7887662 0.7890853 [225] 0.7894029 0.7897187 0.7900329 0.7903454 0.7906562 0.7909654 0.7912728 [232] 0.7915786 0.7918827 0.7921851 0.7924857 0.7927847 0.7930820 0.7933775 [239] 0.7936714 0.7939635 0.7942540 0.7945427 0.7948296 0.7951149 0.7953984 [246] 0.7956802 0.7959603 0.7962386 0.7965152 0.7967901 0.7970632 0.7973345 [253] 0.7976041 0.7978720 0.7981381 0.7984025 0.7986651 0.7989259 0.7991850 [260] 0.7994423 0.7996979 0.7999517 0.8002037 0.8004540 0.8007025 0.8009492 [267] 0.8011942 0.8014373 0.8016787 0.8019184 0.8021562 0.8023923 0.8026266 [274] 0.8028591 0.8030898 0.8033187 0.8035459 0.8037713 0.8039948 0.8042166 [281] 0.8044367 0.8046549 0.8048713 0.8050860 0.8052988 0.8055099 0.8057192 [288] 0.8059266 0.8061323 0.8063362 0.8065383 0.8067387 0.8069372 0.8071339 [295] 0.8073289 0.8075220 0.8077134 0.8079029 0.8080907 0.8082767 0.8084609 [302] 0.8086433 0.8088239 0.8090028 0.8091798 0.8093550 0.8095285 0.8097002 [309] 0.8098701 0.8100382 0.8102045 0.8103691 0.8105318 0.8106928 0.8108520 [316] 0.8110094 0.8111651 0.8113189 0.8114710 0.8116213 0.8117699 0.8119166 [323] 0.8120616 0.8122049 0.8123463 0.8124860 0.8126240 0.8127601 0.8128945 [330] 0.8130272 0.8131581 0.8132872 0.8134146 0.8135403 0.8136642 0.8137863 [337] 0.8139067 0.8140254 0.8141423 0.8142574 0.8143709 0.8144826 0.8145925 [344] 0.8147008 0.8148073 0.8149121 0.8150152 0.8151165 0.8152161 0.8153141 [351] 0.8154103 0.8155048 0.8155975 0.8156886 0.8157780 0.8158657 0.8159517 [358] 0.8160360 0.8161186 0.8161995 0.8162788 0.8163563 0.8164322 0.8165064 [365] 0.8165789 0.8166498 0.8167190 0.8167866 0.8168524 0.8169167 0.8169792 [372] 0.8170402 0.8170995 0.8171571 0.8172131 0.8172675 0.8173202 0.8173714 [379] 0.8174208 0.8174687 0.8175150 0.8175596 0.8176027 0.8176441 0.8176839 [386] 0.8177222 0.8177588 0.8177938 0.8178273 0.8178592 0.8178895 0.8179182 [393] 0.8179454 0.8179710 0.8179950 0.8180175 0.8180384 0.8180578 0.8180756 [400] 0.8180919 0.8181067 > mx [1] 0.8181067 > 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/1sehu1257765067.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/279w31257765067.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/36xwh1257765067.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/4f1d01257765067.tab") > > system("convert tmp/1sehu1257765067.ps tmp/1sehu1257765067.png") > system("convert tmp/279w31257765067.ps tmp/279w31257765067.png") > system("convert tmp/36xwh1257765067.ps tmp/36xwh1257765067.png") > > > proc.time() user system elapsed 0.769 0.504 0.993