R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132) > x <- c(1.579,2.146,2.462,3.695,4.831,5.134,6.250,5.760,6.249,2.917,1.741,2.359,1.511,2.059,2.635,2.867,4.403,5.720,4.502,5.749,5.627,2.846,1.762,2.429,1.169,2.154,2.249,2.687,4.359,5.382,4.459,6.398,4.596,3.024,1.887,2.070,1.351,2.218,2.461,3.028,4.784,4.975,4.607,6.249,4.809,3.157,1.910,2.228,1.594,2.467,2.222,3.607,4.685,4.962,5.770,5.480,5.000,3.228,1.993,2.288,1.580,2.111,2.192,3.601,4.665,4.876,5.813,5.589,5.331,3.075,2.002,2.306,1.507,1.992,2.487,3.490,4.647,5.594,5.611,5.788,6.204,3.013,1.931,2.549,1.504,2.090,2.702,2.939,4.500,6.208,6.415,5.657,5.964,3.163,1.997,2.422,1.376,2.202,2.683,3.303,5.202,5.231,4.880,7.998,4.977,3.531,2.025,2.205,1.442,2.238,2.179,3.218,5.139,4.990,4.914,6.084,5.672,3.548,1.793,2.086,1.262,1.743,1.964,3.258,4.966,4.944,5.907,5.561,5.321,3.582,1.757,1.894) > #'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.009985444 0.010052694 0.010120407 0.010188580 0.010257213 0.010326304 [7] 0.010395852 0.010465855 0.010536313 0.010607222 0.010678584 0.010750394 [13] 0.010822653 0.010895359 0.010968510 0.011042104 0.011116140 0.011190617 [19] 0.011265532 0.011340884 0.011416671 0.011492891 0.011569543 0.011646625 [25] 0.011724135 0.011802071 0.011880431 0.011959213 0.012038416 0.012118037 [31] 0.012198074 0.012278526 0.012359390 0.012440664 0.012522346 0.012604435 [37] 0.012686927 0.012769820 0.012853114 0.012936804 0.013020889 0.013105367 [43] 0.013190236 0.013275492 0.013361134 0.013447159 0.013533566 0.013620350 [49] 0.013707511 0.013795046 0.013882951 0.013971225 0.014059866 0.014148869 [55] 0.014238234 0.014327957 0.014418036 0.014508467 0.014599250 0.014690380 [61] 0.014781855 0.014873672 0.014965829 0.015058323 0.015151151 0.015244310 [67] 0.015337797 0.015431611 0.015525747 0.015620203 0.015714976 0.015810063 [73] 0.015905462 0.016001168 0.016097181 0.016193495 0.016290110 0.016387020 [79] 0.016484224 0.016581719 0.016679501 0.016777567 0.016875915 0.016974541 [85] 0.017073442 0.017172616 0.017272058 0.017371766 0.017471738 0.017571968 [91] 0.017672456 0.017773196 0.017874187 0.017975425 0.018076907 0.018178629 [97] 0.018280589 0.018382783 0.018485208 0.018587861 0.018690739 0.018793838 [103] 0.018897156 0.019000688 0.019104432 0.019208384 0.019312542 0.019416901 [109] 0.019521459 0.019626213 0.019731159 0.019836293 0.019941614 0.020047116 [115] 0.020152798 0.020258656 0.020364686 0.020470885 0.020577251 0.020683779 [121] 0.020790467 0.020897310 0.021004307 0.021111454 0.021218746 0.021326182 [127] 0.021433758 0.021541471 0.021649317 0.021757293 0.021865395 0.021973622 [133] 0.022081969 0.022190433 0.022299011 0.022407700 0.022516497 0.022625398 [139] 0.022734400 0.022843500 0.022952695 0.023061982 0.023171357 0.023280817 [145] 0.023390360 0.023499981 0.023609679 0.023719449 0.023829289 0.023939196 [151] 0.024049166 0.024159197 0.024269285 0.024379427 0.024489621 0.024599863 [157] 0.024710151 0.024820480 0.024930849 0.025041254 0.025151693 0.025262162 [163] 0.025372659 0.025483180 0.025593722 0.025704284 0.025814861 0.025925452 [169] 0.026036052 0.026146660 0.026257273 0.026367887 0.026478500 0.026589109 [175] 0.026699712 0.026810306 0.026920888 0.027031455 0.027142004 0.027252534 [181] 0.027363041 0.027473522 0.027583976 0.027694399 0.027804790 0.027915144 [187] 0.028025461 0.028135737 0.028245969 0.028356156 0.028466295 0.028576384 [193] 0.028686420 0.028796400 0.028906322 0.029016185 0.029125985 0.029235720 [199] 0.029345388 0.029454988 0.029564515 0.029673969 0.029783346 0.029892646 [205] 0.030001865 0.030111002 0.030220053 0.030329019 0.030437895 0.030546680 [211] 0.030655373 0.030763970 0.030872471 0.030980872 0.031089173 0.031197370 [217] 0.031305463 0.031413449 0.031521327 0.031629094 0.031736749 0.031844289 [223] 0.031951714 0.032059022 0.032166210 0.032273276 0.032380220 0.032487040 [229] 0.032593733 0.032700299 0.032806735 0.032913041 0.033019213 0.033125252 [235] 0.033231155 0.033336921 0.033442548 0.033548036 0.033653381 0.033758584 [241] 0.033863643 0.033968555 0.034073321 0.034177938 0.034282406 0.034386722 [247] 0.034490887 0.034594897 0.034698753 0.034802453 0.034905996 0.035009381 [253] 0.035112606 0.035215670 0.035318573 0.035421313 0.035523889 0.035626301 [259] 0.035728546 0.035830625 0.035932535 0.036034277 0.036135849 0.036237250 [265] 0.036338480 0.036439537 0.036540421 0.036641131 0.036741666 0.036842025 [271] 0.036942207 0.037042212 0.037142039 0.037241687 0.037341155 0.037440443 [277] 0.037539550 0.037638476 0.037737220 0.037835780 0.037934158 0.038032351 [283] 0.038130359 0.038228183 0.038325821 0.038423273 0.038520538 0.038617616 [289] 0.038714506 0.038811209 0.038907723 0.039004048 0.039100184 0.039196130 [295] 0.039291886 0.039387452 0.039482827 0.039578011 0.039673004 0.039767806 [301] 0.039862415 0.039956833 0.040051058 0.040145091 0.040238931 0.040332578 [307] 0.040426032 0.040519293 0.040612360 0.040705234 0.040797914 0.040890400 [313] 0.040982692 0.041074791 0.041166695 0.041258406 0.041349922 0.041441244 [319] 0.041532372 0.041623306 0.041714046 0.041804592 0.041894943 0.041985101 [325] 0.042075064 0.042164834 0.042254410 0.042343792 0.042432981 0.042521976 [331] 0.042610777 0.042699386 0.042787801 0.042876024 0.042964053 0.043051890 [337] 0.043139535 0.043226988 0.043314248 0.043401317 0.043488194 0.043574880 [343] 0.043661375 0.043747680 0.043833793 0.043919717 0.044005450 0.044090994 [349] 0.044176349 0.044261514 0.044346491 0.044431279 0.044515879 0.044600291 [355] 0.044684516 0.044768554 0.044852406 0.044936071 0.045019550 0.045102843 [361] 0.045185952 0.045268875 0.045351614 0.045434170 0.045516541 0.045598730 [367] 0.045680736 0.045762559 0.045844201 0.045925662 0.046006941 0.046088040 [373] 0.046168959 0.046249699 0.046330259 0.046410641 0.046490844 0.046570870 [379] 0.046650719 0.046730391 0.046809887 0.046889208 0.046968353 0.047047323 [385] 0.047126119 0.047204742 0.047283192 0.047361469 0.047439574 0.047517507 [391] 0.047595269 0.047672861 0.047750283 0.047827535 0.047904619 0.047981534 [397] 0.048058282 0.048134862 0.048211276 0.048287523 0.048363605 > mx [1] 0.0483636 > 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/wessaorg/rcomp/tmp/1dxhm1324504885.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/wessaorg/rcomp/tmp/27i951324504885.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/wessaorg/rcomp/tmp/3ja8o1324504885.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/47rhv1324504885.tab") > > try(system("convert tmp/1dxhm1324504885.ps tmp/1dxhm1324504885.png",intern=TRUE)) character(0) > try(system("convert tmp/27i951324504885.ps tmp/27i951324504885.png",intern=TRUE)) character(0) > try(system("convert tmp/3ja8o1324504885.ps tmp/3ja8o1324504885.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.059 0.255 1.308