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(11956.6,10723.8,13938.9,13979.8,13807.4,12973.9,12509.8,12934.1,14908.3,13772.1,13012.6,14049.9,11816.5,11593.2,14466.2,13615.9,14733.9,13880.7,13527.5,13584,16170.2,13260.6,14741.9,15486.5,13154.5,12621.2,15031.6,15452.4,15428,13105.9,14716.8,14180,16202.2,14392.4,15140.6,15960.1,14351.3,13230.2,15202.1,17056,16077.7,13348.2,16402.4,16559.1,16579,17561.2,16129.6,18484.3,16402.6,14032.3,17109.1,17157.2,13879.8,12362.4,12683.5,12608.8,13583.7,12846.3,12347.1,13967,13114.3) > x <- c(10519.2,10414.9,12476.8,12384.6,12266.7,12919.9,11497.3,12142,13919.4,12656.8,12034.1,13199.7,10881.3,11301.2,13643.9,12517,13981.1,14275.7,13435,13565.7,16216.3,12970,14079.9,14235,12213.4,12581,14130.4,14210.8,14378.5,13142.8,13714.7,13621.9,15379.8,13306.3,14391.2,14909.9,14025.4,12951.2,14344.3,16093.4,15413.6,14705.7,15972.8,16241.4,16626.4,17136.2,15622.9,18003.9,16136.1,14423.7,16789.4,16782.2,14133.8,12607,12004.5,12175.4,13268,12299.3,11800.6,13873.3,12269.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.9190943 0.9192734 0.9194521 0.9196302 0.9198077 0.9199848 0.9201614 [8] 0.9203374 0.9205129 0.9206879 0.9208624 0.9210363 0.9212098 0.9213827 [15] 0.9215551 0.9217270 0.9218983 0.9220692 0.9222395 0.9224093 0.9225785 [22] 0.9227473 0.9229155 0.9230832 0.9232503 0.9234170 0.9235831 0.9237487 [29] 0.9239138 0.9240783 0.9242423 0.9244058 0.9245687 0.9247311 0.9248930 [36] 0.9250544 0.9252152 0.9253755 0.9255353 0.9256945 0.9258532 0.9260114 [43] 0.9261690 0.9263261 0.9264827 0.9266387 0.9267942 0.9269492 0.9271036 [50] 0.9272575 0.9274109 0.9275637 0.9277160 0.9278677 0.9280190 0.9281696 [57] 0.9283198 0.9284694 0.9286184 0.9287669 0.9289149 0.9290624 0.9292093 [64] 0.9293556 0.9295014 0.9296467 0.9297915 0.9299357 0.9300793 0.9302224 [71] 0.9303650 0.9305070 0.9306485 0.9307894 0.9309298 0.9310697 0.9312090 [78] 0.9313478 0.9314860 0.9316236 0.9317608 0.9318974 0.9320334 0.9321689 [85] 0.9323038 0.9324382 0.9325721 0.9327054 0.9328381 0.9329703 0.9331020 [92] 0.9332331 0.9333637 0.9334937 0.9336232 0.9337521 0.9338804 0.9340083 [99] 0.9341355 0.9342622 0.9343884 0.9345140 0.9346391 0.9347636 0.9348876 [106] 0.9350110 0.9351339 0.9352562 0.9353780 0.9354992 0.9356198 0.9357399 [113] 0.9358595 0.9359785 0.9360969 0.9362148 0.9363322 0.9364490 0.9365652 [120] 0.9366809 0.9367961 0.9369106 0.9370247 0.9371381 0.9372511 0.9373634 [127] 0.9374752 0.9375865 0.9376972 0.9378074 0.9379170 0.9380260 0.9381345 [134] 0.9382424 0.9383498 0.9384566 0.9385629 0.9386686 0.9387738 0.9388784 [141] 0.9389824 0.9390859 0.9391889 0.9392913 0.9393931 0.9394944 0.9395951 [148] 0.9396953 0.9397949 0.9398939 0.9399924 0.9400904 0.9401878 0.9402846 [155] 0.9403809 0.9404766 0.9405718 0.9406664 0.9407604 0.9408539 0.9409469 [162] 0.9410393 0.9411311 0.9412224 0.9413131 0.9414033 0.9414929 0.9415819 [169] 0.9416704 0.9417584 0.9418458 0.9419326 0.9420189 0.9421046 0.9421898 [176] 0.9422744 0.9423585 0.9424420 0.9425249 0.9426073 0.9426892 0.9427705 [183] 0.9428512 0.9429314 0.9430110 0.9430901 0.9431686 0.9432466 0.9433240 [190] 0.9434008 0.9434771 0.9435529 0.9436281 0.9437027 0.9437768 0.9438503 [197] 0.9439233 0.9439957 0.9440676 0.9441389 0.9442097 0.9442799 0.9443496 [204] 0.9444187 0.9444873 0.9445553 0.9446227 0.9446896 0.9447560 0.9448218 [211] 0.9448871 0.9449518 0.9450159 0.9450795 0.9451426 0.9452051 0.9452670 [218] 0.9453284 0.9453893 0.9454496 0.9455093 0.9455685 0.9456272 0.9456853 [225] 0.9457428 0.9457998 0.9458563 0.9459122 0.9459676 0.9460224 0.9460767 [232] 0.9461304 0.9461836 0.9462362 0.9462883 0.9463398 0.9463908 0.9464413 [239] 0.9464912 0.9465405 0.9465893 0.9466376 0.9466853 0.9467325 0.9467792 [246] 0.9468252 0.9468708 0.9469158 0.9469603 0.9470042 0.9470476 0.9470904 [253] 0.9471327 0.9471744 0.9472157 0.9472563 0.9472965 0.9473361 0.9473751 [260] 0.9474136 0.9474516 0.9474890 0.9475259 0.9475623 0.9475981 0.9476334 [267] 0.9476681 0.9477023 0.9477360 0.9477691 0.9478017 0.9478338 0.9478653 [274] 0.9478963 0.9479268 0.9479567 0.9479861 0.9480150 0.9480433 0.9480711 [281] 0.9480983 0.9481251 0.9481512 0.9481769 0.9482020 0.9482266 0.9482507 [288] 0.9482742 0.9482973 0.9483197 0.9483417 0.9483631 0.9483840 0.9484044 [295] 0.9484242 0.9484435 0.9484623 0.9484806 0.9484983 0.9485155 0.9485322 [302] 0.9485484 0.9485640 0.9485791 0.9485937 0.9486078 0.9486213 0.9486343 [309] 0.9486468 0.9486588 0.9486703 0.9486812 0.9486916 0.9487015 0.9487109 [316] 0.9487198 0.9487281 0.9487359 0.9487432 0.9487500 0.9487563 0.9487621 [323] 0.9487673 0.9487720 0.9487762 0.9487799 0.9487831 0.9487858 0.9487880 [330] 0.9487896 0.9487907 0.9487914 0.9487915 0.9487911 0.9487902 0.9487888 [337] 0.9487868 0.9487844 0.9487814 0.9487780 0.9487740 0.9487696 0.9487646 [344] 0.9487591 0.9487532 0.9487467 0.9487397 0.9487322 0.9487242 0.9487157 [351] 0.9487067 0.9486972 0.9486872 0.9486767 0.9486657 0.9486542 0.9486422 [358] 0.9486297 0.9486167 0.9486032 0.9485892 0.9485747 0.9485597 0.9485442 [365] 0.9485283 0.9485118 0.9484948 0.9484774 0.9484594 0.9484410 0.9484221 [372] 0.9484026 0.9483827 0.9483623 0.9483414 0.9483200 0.9482982 0.9482758 [379] 0.9482530 0.9482296 0.9482058 0.9481815 0.9481567 0.9481315 0.9481057 [386] 0.9480795 0.9480527 0.9480255 0.9479979 0.9479697 0.9479410 0.9479119 [393] 0.9478823 0.9478522 0.9478217 0.9477906 0.9477591 0.9477271 0.9476947 [400] 0.9476617 0.9476283 > mx [1] 0.9487915 > mxli [1] 1.32 > 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/1s21e1258113638.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/2f8x61258113638.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/3oy8c1258113638.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/45wep1258113638.tab") > > system("convert tmp/1s21e1258113638.ps tmp/1s21e1258113638.png") > system("convert tmp/2f8x61258113638.ps tmp/2f8x61258113638.png") > system("convert tmp/3oy8c1258113638.ps tmp/3oy8c1258113638.png") > > > proc.time() user system elapsed 0.786 0.499 1.283