R version 2.10.0 (2009-10-26) 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(277 + ,260.6 + ,291.6 + ,275.4 + ,275.3 + ,231.7 + ,238.8 + ,274.2 + ,277.8 + ,299.1 + ,286.6 + ,232.3 + ,294.1 + ,267.5 + ,309.7 + ,280.7 + ,287.3 + ,235.7 + ,256.4 + ,289 + ,290.8 + ,321.9 + ,291.8 + ,241.4 + ,295.5 + ,258.2 + ,306.1 + ,281.5 + ,283.1 + ,237.4 + ,274.8 + ,299.3 + ,300.4 + ,340.9 + ,318.8 + ,265.7 + ,322.7 + ,281.6 + ,323.5 + ,312.6 + ,310.8 + ,262.8 + ,273.8 + ,320 + ,310.3 + ,342.2 + ,320.1 + ,265.6 + ,327 + ,300.7 + ,346.4 + ,317.3 + ,326.2 + ,270.7 + ,278.2 + ,324.6 + ,321.8 + ,343.5 + ,354 + ,278.2 + ,330.2 + ,307.3 + ,375.9 + ,335.3 + ,339.3 + ,280.3 + ,293.7 + ,341.2 + ,345.1 + ,368.7 + ,369.4 + ,288.4 + ,341 + ,319.1 + ,374.2 + ,344.5 + ,337.3 + ,281 + ,282.2 + ,321 + ,325.4 + ,366.3 + ,380.3 + ,300.7 + ,359.3 + ,327.6 + ,383.6 + ,352.4 + ,329.4 + ,294.5 + ,333.5 + ,334.3 + ,358 + ,396.1 + ,387 + ,307.2 + ,363.9 + ,344.7 + ,397.6 + ,376.8 + ,337.1 + ,299.3 + ,323.1 + ,329.1 + ,347 + ,462 + ,436.5 + ,360.4 + ,415.5 + ,382.1 + ,432.2 + ,424.3 + ,386.7 + ,354.5 + ,375.8 + ,368 + ,402.4 + ,426.5 + ,433.3 + ,338.5 + ,416.8 + ,381.1 + ,445.7 + ,412.4 + ,394 + ,348.2 + ,380.1 + ,373.7 + ,393.6 + ,434.2 + ,430.7 + ,344.5 + ,411.9 + ,370.5 + ,437.3 + ,411.3 + ,385.5 + ,341.3 + ,384.2 + ,373.2 + ,415.8 + ,448.6 + ,454.3 + ,350.3 + ,419.1 + ,398 + ,456.1 + ,430.1 + ,399.8 + ,362.7 + ,384.9 + ,385.3 + ,432.3 + ,468.9 + ,442.7 + ,370.2 + ,439.4 + ,393.9 + ,468.7 + ,438.8 + ,430.1 + ,366.3 + ,391 + ,380.9 + ,431.4 + ,465.4 + ,471.5 + ,387.5 + ,446.4 + ,421.5 + ,504.8 + ,492.1 + ,421.3 + ,396.7 + ,428 + ,421.9 + ,465.6 + ,525.8 + ,499.9 + ,435.3 + ,479.5 + ,473 + ,554.4 + ,489.6 + ,462.2 + ,420.3) > x <- c(7.7,7.5,8.3,7.8,7.9,6.6,7,8.2,8.2,9.1,9,7.1,8.9,8.5,9.8,8.8,9.2,7.4,8.3,9.7,9.7,10.8,9.8,7.9,9.8,9,10.5,9.5,9.7,8.1,10.1,11.1,11.2,12.6,12.2,9.9,11.8,11.1,12.6,11.9,11.9,10,10.8,12.9,12.5,13.8,13.1,10.5,12.9,12.9,14.4,12.7,13.3,11,11.9,14.1,14.4,14.9,15.7,12,14.3,14.2,17.4,15.1,15.3,12.6,14,16.6,16.7,17.6,18.3,13.6,15.8,16.1,18.6,17.3,17,13.9,15.2,17.8,18,19.4,21.8,16.2,19.2,19.5,22,20,19.2,16.9,20,20.4,21.8,25,25.8,19.4,22.6,24.1,26.9,24.9,23.3,20.3,22.3,23.7,24.3,31.7,32.2,25.4,28.6,28.7,30.9,31.4,29.1,26.3,28.9,28.9,31,33.4,35.9,25.8,31.2,31.7,36.2,32,32.1,28.1,31.1,31.9,32,36.6,38.1,28.1,32.9,30.7,35.4,33.7,31.6,27.9,32.2,32.3,35.3,37.2,39.6,28.4,33.9,33.7,38.3,34.6,32.7,29.5,32,33.2,36.7,38.6,38.1,29.8,35.6,33.2,38.9,34.8,37.2,29.7,32.2,32.1,36.3,38.4,40.8,31.3,36.2,35.1,44.1,39.3,34.1,32.4,36.3,36.8,40.5,46,43.9,37.2,40.7,42,49.2,42.3,40.8,37.6) > #'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.7932221 0.7940204 0.7948184 0.7956161 0.7964134 0.7972103 0.7980068 [8] 0.7988029 0.7995985 0.8003938 0.8011885 0.8019827 0.8027764 0.8035696 [15] 0.8043623 0.8051544 0.8059458 0.8067367 0.8075270 0.8083166 0.8091056 [22] 0.8098938 0.8106814 0.8114682 0.8122543 0.8130396 0.8138242 0.8146080 [29] 0.8153909 0.8161730 0.8169542 0.8177345 0.8185140 0.8192925 0.8200701 [36] 0.8208467 0.8216223 0.8223970 0.8231706 0.8239431 0.8247146 0.8254850 [43] 0.8262543 0.8270225 0.8277895 0.8285554 0.8293201 0.8300835 0.8308458 [50] 0.8316068 0.8323665 0.8331249 0.8338820 0.8346378 0.8353922 0.8361452 [57] 0.8368969 0.8376471 0.8383959 0.8391433 0.8398891 0.8406335 0.8413763 [64] 0.8421176 0.8428573 0.8435955 0.8443320 0.8450669 0.8458002 0.8465318 [71] 0.8472618 0.8479900 0.8487165 0.8494412 0.8501642 0.8508854 0.8516048 [78] 0.8523223 0.8530380 0.8537519 0.8544638 0.8551739 0.8558820 0.8565882 [85] 0.8572924 0.8579946 0.8586948 0.8593930 0.8600891 0.8607832 0.8614751 [92] 0.8621650 0.8628528 0.8635384 0.8642218 0.8649031 0.8655822 0.8662590 [99] 0.8669337 0.8676060 0.8682761 0.8689440 0.8696095 0.8702726 0.8709335 [106] 0.8715919 0.8722480 0.8729017 0.8735530 0.8742019 0.8748483 0.8754922 [113] 0.8761337 0.8767727 0.8774091 0.8780430 0.8786744 0.8793032 0.8799295 [120] 0.8805531 0.8811742 0.8817926 0.8824084 0.8830215 0.8836319 0.8842397 [127] 0.8848448 0.8854471 0.8860468 0.8866437 0.8872378 0.8878292 0.8884178 [134] 0.8890036 0.8895866 0.8901667 0.8907441 0.8913186 0.8918902 0.8924590 [141] 0.8930249 0.8935879 0.8941479 0.8947051 0.8952594 0.8958107 0.8963590 [148] 0.8969044 0.8974468 0.8979863 0.8985227 0.8990562 0.8995866 0.9001140 [155] 0.9006384 0.9011598 0.9016781 0.9021933 0.9027055 0.9032146 0.9037207 [162] 0.9042236 0.9047235 0.9052202 0.9057139 0.9062044 0.9066918 0.9071761 [169] 0.9076572 0.9081352 0.9086100 0.9090817 0.9095502 0.9100156 0.9104778 [176] 0.9109368 0.9113926 0.9118452 0.9122947 0.9127410 0.9131840 0.9136239 [183] 0.9140605 0.9144940 0.9149242 0.9153512 0.9157750 0.9161956 0.9166130 [190] 0.9170271 0.9174380 0.9178457 0.9182501 0.9186513 0.9190493 0.9194441 [197] 0.9198356 0.9202238 0.9206089 0.9209907 0.9213692 0.9217445 0.9221166 [204] 0.9224854 0.9228510 0.9232134 0.9235725 0.9239284 0.9242811 0.9246305 [211] 0.9249767 0.9253197 0.9256594 0.9259959 0.9263292 0.9266593 0.9269861 [218] 0.9273097 0.9276301 0.9279473 0.9282613 0.9285721 0.9288797 0.9291841 [225] 0.9294852 0.9297832 0.9300780 0.9303697 0.9306581 0.9309434 0.9312254 [232] 0.9315044 0.9317801 0.9320527 0.9323222 0.9325884 0.9328516 0.9331116 [239] 0.9333685 0.9336222 0.9338729 0.9341204 0.9343648 0.9346060 0.9348442 [246] 0.9350793 0.9353113 0.9355402 0.9357661 0.9359888 0.9362085 0.9364252 [253] 0.9366388 0.9368493 0.9370569 0.9372613 0.9374628 0.9376612 0.9378567 [260] 0.9380491 0.9382385 0.9384250 0.9386084 0.9387889 0.9389664 0.9391410 [267] 0.9393126 0.9394812 0.9396469 0.9398097 0.9399696 0.9401265 0.9402806 [274] 0.9404317 0.9405800 0.9407253 0.9408678 0.9410074 0.9411442 0.9412781 [281] 0.9414092 0.9415374 0.9416628 0.9417854 0.9419051 0.9420221 0.9421363 [288] 0.9422477 0.9423563 0.9424621 0.9425652 0.9426655 0.9427630 0.9428579 [295] 0.9429500 0.9430394 0.9431260 0.9432100 0.9432913 0.9433698 0.9434457 [302] 0.9435190 0.9435895 0.9436575 0.9437227 0.9437854 0.9438454 0.9439027 [309] 0.9439575 0.9440097 0.9440592 0.9441062 0.9441506 0.9441924 0.9442317 [316] 0.9442684 0.9443026 0.9443342 0.9443633 0.9443899 0.9444139 0.9444355 [323] 0.9444546 0.9444711 0.9444852 0.9444968 0.9445060 0.9445127 0.9445169 [330] 0.9445187 0.9445181 0.9445151 0.9445096 0.9445017 0.9444914 0.9444788 [337] 0.9444637 0.9444463 0.9444265 0.9444043 0.9443798 0.9443529 0.9443237 [344] 0.9442922 0.9442583 0.9442222 0.9441837 0.9441429 0.9440998 0.9440545 [351] 0.9440069 0.9439569 0.9439048 0.9438503 0.9437937 0.9437348 0.9436736 [358] 0.9436102 0.9435446 0.9434768 0.9434068 0.9433346 0.9432602 0.9431836 [365] 0.9431048 0.9430239 0.9429408 0.9428555 0.9427681 0.9426786 0.9425869 [372] 0.9424931 0.9423971 0.9422991 0.9421989 0.9420966 0.9419923 0.9418858 [379] 0.9417773 0.9416667 0.9415540 0.9414392 0.9413224 0.9412036 0.9410827 [386] 0.9409597 0.9408348 0.9407078 0.9405787 0.9404477 0.9403147 0.9401796 [393] 0.9400426 0.9399036 0.9397626 0.9396196 0.9394746 0.9393277 0.9391788 [400] 0.9390280 0.9388752 > mx [1] 0.9445187 > mxli [1] 1.29 > 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/1gvdx1261084373.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/rcomp/tmp/2mjhr1261084373.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/rcomp/tmp/34kd71261084373.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/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/4bub61261084373.tab") > > try(system("convert tmp/1gvdx1261084373.ps tmp/1gvdx1261084373.png",intern=TRUE)) character(0) > try(system("convert tmp/2mjhr1261084373.ps tmp/2mjhr1261084373.png",intern=TRUE)) character(0) > try(system("convert tmp/34kd71261084373.ps tmp/34kd71261084373.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.230 0.960 1.893