R version 2.7.2 (2008-08-25) Copyright (C) 2008 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(4.7,4.8,4.7,4.6,4.5,4.5,4.8,4.8,4.6,4.3,4.3,4.6,5.4,5.5,5.5,5.3,5.2,5.2,5.4,5.3,5.0,4.9,4.9,5.3,6.3,6.7,6.7,6.4,6.1,6.0,6.2,6.1,6.0,6.0,5.9,5.9,6.0,6.1,6.4,6.7,6.7,6.5,5.9,5.6,5.7,6.0,6.3,6.3,6.2,6.1,6.3,6.5,6.6,6.5,6.2,6.2,5.9,6.1,6.1,6.1,6.1,6.1,6.3,6.7,6.9,6.9,6.9,6.8,6.4,5.9,5.5,5.6,5.6,5.8,5.9,6.1,6.1,6.0,6.0,5.8,5.5,5.5,5.4,5.2,5.2,5.2,5.5,5.7,5.7,5.6,5.4,5.1,5.1,5.3,5.3,5.3) > x <- c(5.8,5.8,5.7,5.5,5.3,5.2,5.3,5.3,5.0,4.8,4.9,5.3,6.0,6.2,6.4,6.4,6.4,6.2,6.1,6.0,5.9,6.2,6.2,6.4,6.8,6.9,7.0,7.0,6.9,6.7,6.6,6.5,6.4,6.5,6.5,6.6,6.7,6.8,7.2,7.6,7.6,7.3,6.4,6.1,6.3,7.1,7.5,7.4,7.1,6.8,6.9,7.2,7.4,7.3,6.9,6.9,6.8,7.1,7.2,7.1,7.0,6.9,7.0,7.4,7.5,7.5,7.4,7.3,7.0,6.7,6.5,6.5,6.5,6.6,6.8,6.9,6.9,6.8,6.8,6.5,6.1,6.0,5.9,5.8,5.9,5.9,6.2,6.3,6.2,6.0,5.8,5.5,5.5,5.7,5.8,5.7) > #'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.9164422 0.9165743 0.9167060 0.9168373 0.9169683 0.9170988 0.9172289 [8] 0.9173586 0.9174878 0.9176167 0.9177452 0.9178733 0.9180009 0.9181282 [15] 0.9182551 0.9183815 0.9185076 0.9186332 0.9187584 0.9188832 0.9190077 [22] 0.9191317 0.9192553 0.9193785 0.9195013 0.9196236 0.9197456 0.9198672 [29] 0.9199883 0.9201091 0.9202294 0.9203494 0.9204689 0.9205880 0.9207067 [36] 0.9208250 0.9209429 0.9210604 0.9211775 0.9212941 0.9214104 0.9215262 [43] 0.9216417 0.9217567 0.9218713 0.9219855 0.9220993 0.9222127 0.9223257 [50] 0.9224383 0.9225505 0.9226622 0.9227736 0.9228845 0.9229950 0.9231051 [57] 0.9232149 0.9233242 0.9234330 0.9235415 0.9236496 0.9237573 0.9238645 [64] 0.9239714 0.9240778 0.9241838 0.9242894 0.9243946 0.9244994 0.9246038 [71] 0.9247078 0.9248113 0.9249145 0.9250172 0.9251195 0.9252215 0.9253230 [78] 0.9254241 0.9255248 0.9256250 0.9257249 0.9258244 0.9259234 0.9260221 [85] 0.9261203 0.9262181 0.9263155 0.9264125 0.9265091 0.9266053 0.9267011 [92] 0.9267964 0.9268914 0.9269859 0.9270801 0.9271738 0.9272671 0.9273600 [99] 0.9274525 0.9275446 0.9276362 0.9277275 0.9278184 0.9279088 0.9279988 [106] 0.9280885 0.9281777 0.9282665 0.9283549 0.9284429 0.9285305 0.9286176 [113] 0.9287044 0.9287908 0.9288767 0.9289622 0.9290474 0.9291321 0.9292164 [120] 0.9293003 0.9293838 0.9294669 0.9295496 0.9296318 0.9297137 0.9297952 [127] 0.9298762 0.9299568 0.9300371 0.9301169 0.9301963 0.9302753 0.9303539 [134] 0.9304321 0.9305099 0.9305873 0.9306643 0.9307408 0.9308170 0.9308928 [141] 0.9309681 0.9310431 0.9311176 0.9311917 0.9312655 0.9313388 0.9314117 [148] 0.9314842 0.9315563 0.9316280 0.9316993 0.9317702 0.9318407 0.9319108 [155] 0.9319804 0.9320497 0.9321186 0.9321870 0.9322551 0.9323228 0.9323900 [162] 0.9324569 0.9325233 0.9325893 0.9326550 0.9327202 0.9327851 0.9328495 [169] 0.9329135 0.9329771 0.9330404 0.9331032 0.9331656 0.9332276 0.9332893 [176] 0.9333505 0.9334113 0.9334717 0.9335317 0.9335914 0.9336506 0.9337094 [183] 0.9337678 0.9338258 0.9338834 0.9339407 0.9339975 0.9340539 0.9341099 [190] 0.9341656 0.9342208 0.9342756 0.9343300 0.9343841 0.9344377 0.9344909 [197] 0.9345438 0.9345962 0.9346483 0.9346999 0.9347512 0.9348020 0.9348525 [204] 0.9349026 0.9349522 0.9350015 0.9350504 0.9350989 0.9351470 0.9351947 [211] 0.9352420 0.9352889 0.9353354 0.9353816 0.9354273 0.9354726 0.9355176 [218] 0.9355621 0.9356063 0.9356501 0.9356935 0.9357364 0.9357790 0.9358212 [225] 0.9358631 0.9359045 0.9359455 0.9359862 0.9360264 0.9360663 0.9361058 [232] 0.9361449 0.9361836 0.9362219 0.9362598 0.9362974 0.9363345 0.9363713 [239] 0.9364077 0.9364436 0.9364793 0.9365145 0.9365493 0.9365838 0.9366178 [246] 0.9366515 0.9366848 0.9367177 0.9367502 0.9367824 0.9368141 0.9368455 [253] 0.9368765 0.9369071 0.9369373 0.9369672 0.9369966 0.9370257 0.9370544 [260] 0.9370827 0.9371107 0.9371382 0.9371654 0.9371922 0.9372186 0.9372447 [267] 0.9372703 0.9372956 0.9373205 0.9373450 0.9373692 0.9373930 0.9374163 [274] 0.9374394 0.9374620 0.9374843 0.9375062 0.9375277 0.9375488 0.9375696 [281] 0.9375900 0.9376100 0.9376296 0.9376489 0.9376678 0.9376863 0.9377045 [288] 0.9377223 0.9377397 0.9377567 0.9377734 0.9377897 0.9378056 0.9378212 [295] 0.9378363 0.9378512 0.9378656 0.9378797 0.9378934 0.9379067 0.9379197 [302] 0.9379323 0.9379445 0.9379564 0.9379679 0.9379791 0.9379898 0.9380003 [309] 0.9380103 0.9380200 0.9380293 0.9380382 0.9380468 0.9380551 0.9380629 [316] 0.9380704 0.9380776 0.9380843 0.9380907 0.9380968 0.9381025 0.9381078 [323] 0.9381128 0.9381174 0.9381217 0.9381256 0.9381291 0.9381323 0.9381351 [330] 0.9381376 0.9381397 0.9381414 0.9381428 0.9381439 0.9381445 0.9381449 [337] 0.9381448 0.9381445 0.9381437 0.9381426 0.9381412 0.9381394 0.9381373 [344] 0.9381348 0.9381319 0.9381287 0.9381252 0.9381213 0.9381170 0.9381124 [351] 0.9381074 0.9381021 0.9380965 0.9380905 0.9380842 0.9380775 0.9380704 [358] 0.9380630 0.9380553 0.9380472 0.9380388 0.9380300 0.9380209 0.9380115 [365] 0.9380017 0.9379915 0.9379810 0.9379702 0.9379590 0.9379475 0.9379357 [372] 0.9379235 0.9379109 0.9378980 0.9378848 0.9378713 0.9378574 0.9378431 [379] 0.9378286 0.9378137 0.9377984 0.9377828 0.9377669 0.9377506 0.9377340 [386] 0.9377171 0.9376999 0.9376823 0.9376643 0.9376461 0.9376275 0.9376085 [393] 0.9375893 0.9375697 0.9375497 0.9375295 0.9375089 0.9374880 0.9374667 [400] 0.9374452 0.9374232 > mx [1] 0.9381449 > mxli [1] 1.35 > 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/1squk1226487458.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/2ek9y1226487458.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/3u60c1226487458.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/45rxm1226487458.tab") > > system("convert tmp/1squk1226487458.ps tmp/1squk1226487458.png") > system("convert tmp/2ek9y1226487458.ps tmp/2ek9y1226487458.png") > system("convert tmp/3u60c1226487458.ps tmp/3u60c1226487458.png") > > > proc.time() user system elapsed 0.979 0.484 1.576