R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(19437.50,18885.1,16579,17203.6,19165.7,17107.6,17690.5,18664.9,15878.6,16014.6,16842.6,15986.9,16773.3,16263.1,13597.3,14285.6,15496.8,13916.8,14345.5,15761.3,14531.6,15076.6,15816.8,17180.4,20432.3,21289.5,18203.6,20159.5,21053.2,19673.6,21473.3,20244.7,19049.6,20194.3,18021.9,19537.3,20286.6,17967.7,16409.9,17802.7,18509.9,18161.3,16721.3,19106.9,16772.1,17463.6,16162.3,17862.9,17664.9,17180.8,15672.7,15189.8,17699.4,17444.6,15930.7,19691.6,16698,16896.2,17972.4,17637.4,15214) > x <- c(19685.6,19601.7,16006.9,17681.2,19790.4,17014.2,17424.5,18908.9,15692.1,15160,15794.3,16032.1,16065,16236.8,12521,14762.1,15446.9,13635,14212.6,15021.7,14134.3,13721.4,14384.5,15638.6,19711.6,20359.8,16141.4,20056.9,20605.5,19325.8,20547.7,19211.2,19009.5,18746.8,16471.5,18957.2,20515.2,18374.4,16192.9,18147.5,19301.4,18344.7,17183.6,19630,17167.2,17428.5,16016.5,18466.5,18406.6,18174.1,14851.9,16260.7,18329.6,18003.8,15903.8,19554.2,16554.2,16198.9,16571.8,17535.2,16198.1) > #'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.8973626 0.8975418 0.8977205 0.8978987 0.8980765 0.8982538 0.8984306 [8] 0.8986069 0.8987828 0.8989582 0.8991332 0.8993076 0.8994816 0.8996551 [15] 0.8998282 0.9000008 0.9001729 0.9003445 0.9005157 0.9006864 0.9008566 [22] 0.9010264 0.9011956 0.9013645 0.9015328 0.9017007 0.9018681 0.9020350 [29] 0.9022015 0.9023675 0.9025331 0.9026981 0.9028627 0.9030269 0.9031905 [36] 0.9033537 0.9035165 0.9036787 0.9038405 0.9040018 0.9041627 0.9043231 [43] 0.9044830 0.9046425 0.9048015 0.9049600 0.9051181 0.9052757 0.9054328 [50] 0.9055895 0.9057457 0.9059014 0.9060567 0.9062115 0.9063658 0.9065197 [57] 0.9066731 0.9068261 0.9069786 0.9071306 0.9072822 0.9074333 0.9075839 [64] 0.9077341 0.9078838 0.9080331 0.9081819 0.9083302 0.9084781 0.9086255 [71] 0.9087724 0.9089189 0.9090649 0.9092105 0.9093556 0.9095003 0.9096445 [78] 0.9097882 0.9099315 0.9100743 0.9102167 0.9103586 0.9105000 0.9106410 [85] 0.9107816 0.9109216 0.9110613 0.9112004 0.9113391 0.9114774 0.9116152 [92] 0.9117525 0.9118894 0.9120259 0.9121618 0.9122974 0.9124325 0.9125671 [99] 0.9127013 0.9128350 0.9129682 0.9131011 0.9132334 0.9133653 0.9134968 [106] 0.9136278 0.9137584 0.9138885 0.9140182 0.9141474 0.9142762 0.9144045 [113] 0.9145324 0.9146598 0.9147868 0.9149133 0.9150394 0.9151650 0.9152902 [120] 0.9154150 0.9155393 0.9156631 0.9157865 0.9159095 0.9160320 0.9161541 [127] 0.9162758 0.9163970 0.9165177 0.9166380 0.9167579 0.9168773 0.9169963 [134] 0.9171149 0.9172330 0.9173507 0.9174679 0.9175847 0.9177010 0.9178170 [141] 0.9179324 0.9180475 0.9181621 0.9182763 0.9183900 0.9185033 0.9186162 [148] 0.9187286 0.9188406 0.9189522 0.9190633 0.9191740 0.9192842 0.9193941 [155] 0.9195035 0.9196124 0.9197210 0.9198291 0.9199367 0.9200440 0.9201508 [162] 0.9202572 0.9203632 0.9204687 0.9205738 0.9206785 0.9207827 0.9208865 [169] 0.9209899 0.9210929 0.9211954 0.9212976 0.9213993 0.9215005 0.9216014 [176] 0.9217018 0.9218018 0.9219014 0.9220006 0.9220993 0.9221976 0.9222955 [183] 0.9223930 0.9224901 0.9225867 0.9226829 0.9227787 0.9228741 0.9229691 [190] 0.9230636 0.9231578 0.9232515 0.9233448 0.9234377 0.9235302 0.9236223 [197] 0.9237139 0.9238051 0.9238960 0.9239864 0.9240764 0.9241660 0.9242552 [204] 0.9243439 0.9244323 0.9245203 0.9246078 0.9246950 0.9247817 0.9248680 [211] 0.9249539 0.9250394 0.9251245 0.9252092 0.9252935 0.9253774 0.9254609 [218] 0.9255440 0.9256267 0.9257090 0.9257909 0.9258723 0.9259534 0.9260341 [225] 0.9261144 0.9261943 0.9262737 0.9263528 0.9264315 0.9265098 0.9265877 [232] 0.9266652 0.9267423 0.9268190 0.9268953 0.9269712 0.9270467 0.9271219 [239] 0.9271966 0.9272710 0.9273449 0.9274185 0.9274917 0.9275644 0.9276368 [246] 0.9277088 0.9277805 0.9278517 0.9279225 0.9279930 0.9280630 0.9281327 [253] 0.9282020 0.9282709 0.9283395 0.9284076 0.9284754 0.9285428 0.9286098 [260] 0.9286764 0.9287426 0.9288085 0.9288739 0.9289390 0.9290037 0.9290681 [267] 0.9291320 0.9291956 0.9292588 0.9293217 0.9293841 0.9294462 0.9295079 [274] 0.9295692 0.9296302 0.9296908 0.9297510 0.9298108 0.9298703 0.9299294 [281] 0.9299881 0.9300465 0.9301045 0.9301621 0.9302193 0.9302762 0.9303327 [288] 0.9303889 0.9304447 0.9305001 0.9305551 0.9306098 0.9306641 0.9307181 [295] 0.9307717 0.9308249 0.9308778 0.9309303 0.9309825 0.9310343 0.9310857 [302] 0.9311368 0.9311875 0.9312379 0.9312879 0.9313375 0.9313868 0.9314357 [309] 0.9314843 0.9315325 0.9315804 0.9316279 0.9316751 0.9317219 0.9317683 [316] 0.9318144 0.9318602 0.9319056 0.9319507 0.9319954 0.9320397 0.9320837 [323] 0.9321274 0.9321707 0.9322137 0.9322563 0.9322986 0.9323405 0.9323821 [330] 0.9324234 0.9324643 0.9325048 0.9325451 0.9325850 0.9326245 0.9326637 [337] 0.9327025 0.9327411 0.9327793 0.9328171 0.9328546 0.9328918 0.9329286 [344] 0.9329651 0.9330013 0.9330371 0.9330726 0.9331077 0.9331426 0.9331771 [351] 0.9332112 0.9332451 0.9332786 0.9333117 0.9333446 0.9333771 0.9334093 [358] 0.9334411 0.9334727 0.9335039 0.9335347 0.9335653 0.9335955 0.9336254 [365] 0.9336550 0.9336842 0.9337132 0.9337418 0.9337701 0.9337980 0.9338257 [372] 0.9338530 0.9338800 0.9339067 0.9339331 0.9339591 0.9339848 0.9340102 [379] 0.9340353 0.9340601 0.9340846 0.9341087 0.9341326 0.9341561 0.9341793 [386] 0.9342022 0.9342248 0.9342471 0.9342690 0.9342907 0.9343120 0.9343331 [393] 0.9343538 0.9343742 0.9343943 0.9344141 0.9344336 0.9344528 0.9344717 [400] 0.9344903 0.9345086 > mx [1] 0.9345086 > 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/rcomp/tmp/1z0291293194322.ps",horizontal=F,onefile=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/rcomp/tmp/2z0291293194322.ps",horizontal=F,onefile=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/rcomp/tmp/3z0291293194322.ps",horizontal=F,onefile=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/4vsi01293194322.tab") > > try(system("convert tmp/1z0291293194322.ps tmp/1z0291293194322.png",intern=TRUE)) character(0) > try(system("convert tmp/2z0291293194322.ps tmp/2z0291293194322.png",intern=TRUE)) character(0) > try(system("convert tmp/3z0291293194322.ps tmp/3z0291293194322.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.88 0.62 1.50