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(100.6,104.3,120.4,107.5,102.9,125.6,107.5,108.8,128.4,121.1,119.5,128.7,108.7,105.5,119.8,111.3,110.6,120.1,97.5,107.7,127.3,117.2,119.8,116.2,111,112.4,130.6,109.1,118.8,123.9,101.6,112.8,128,129.6,125.8,119.5,115.7,113.6,129.7,112,116.8,127,112.1,114.2,121.1,131.6,125,120.4,117.7,117.5,120.6,127.5,112.3,124.5,115.2,104.7,130.9,129.2,113.5,125.6,107.6) > x <- c(95.1,97,112.7,102.9,97.4,111.4,87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91) > #'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.8072494 0.8073793 0.8075090 0.8076383 0.8077674 0.8078962 0.8080247 [8] 0.8081530 0.8082809 0.8084085 0.8085359 0.8086630 0.8087898 0.8089163 [15] 0.8090425 0.8091684 0.8092941 0.8094194 0.8095445 0.8096693 0.8097938 [22] 0.8099180 0.8100419 0.8101655 0.8102889 0.8104120 0.8105348 0.8106573 [29] 0.8107795 0.8109014 0.8110230 0.8111444 0.8112655 0.8113862 0.8115068 [36] 0.8116270 0.8117469 0.8118665 0.8119859 0.8121050 0.8122238 0.8123423 [43] 0.8124605 0.8125785 0.8126961 0.8128135 0.8129306 0.8130474 0.8131639 [50] 0.8132802 0.8133961 0.8135118 0.8136272 0.8137423 0.8138571 0.8139717 [57] 0.8140859 0.8141999 0.8143136 0.8144270 0.8145402 0.8146530 0.8147656 [64] 0.8148779 0.8149899 0.8151016 0.8152130 0.8153242 0.8154351 0.8155457 [71] 0.8156560 0.8157660 0.8158758 0.8159853 0.8160945 0.8162034 0.8163120 [78] 0.8164204 0.8165285 0.8166363 0.8167438 0.8168510 0.8169580 0.8170647 [85] 0.8171711 0.8172772 0.8173831 0.8174886 0.8175939 0.8176989 0.8178037 [92] 0.8179081 0.8180123 0.8181162 0.8182198 0.8183232 0.8184263 0.8185291 [99] 0.8186316 0.8187338 0.8188358 0.8189375 0.8190389 0.8191400 0.8192409 [106] 0.8193415 0.8194418 0.8195418 0.8196416 0.8197411 0.8198403 0.8199393 [113] 0.8200379 0.8201363 0.8202344 0.8203323 0.8204299 0.8205272 0.8206242 [120] 0.8207209 0.8208174 0.8209136 0.8210096 0.8211052 0.8212006 0.8212957 [127] 0.8213906 0.8214852 0.8215795 0.8216735 0.8217673 0.8218607 0.8219540 [134] 0.8220469 0.8221396 0.8222320 0.8223242 0.8224160 0.8225076 0.8225990 [141] 0.8226900 0.8227808 0.8228714 0.8229616 0.8230516 0.8231413 0.8232308 [148] 0.8233200 0.8234089 0.8234976 0.8235860 0.8236741 0.8237619 0.8238495 [155] 0.8239368 0.8240239 0.8241107 0.8241972 0.8242835 0.8243695 0.8244552 [162] 0.8245407 0.8246259 0.8247108 0.8247955 0.8248799 0.8249640 0.8250479 [169] 0.8251315 0.8252149 0.8252980 0.8253808 0.8254634 0.8255457 0.8256277 [176] 0.8257095 0.8257911 0.8258723 0.8259533 0.8260341 0.8261145 0.8261948 [183] 0.8262747 0.8263544 0.8264339 0.8265130 0.8265920 0.8266706 0.8267490 [190] 0.8268272 0.8269051 0.8269827 0.8270601 0.8271372 0.8272140 0.8272906 [197] 0.8273670 0.8274431 0.8275189 0.8275945 0.8276698 0.8277449 0.8278197 [204] 0.8278942 0.8279685 0.8280426 0.8281163 0.8281899 0.8282632 0.8283362 [211] 0.8284090 0.8284815 0.8285538 0.8286258 0.8286975 0.8287690 0.8288403 [218] 0.8289113 0.8289821 0.8290526 0.8291228 0.8291928 0.8292626 0.8293321 [225] 0.8294013 0.8294703 0.8295391 0.8296076 0.8296758 0.8297438 0.8298116 [232] 0.8298791 0.8299463 0.8300133 0.8300801 0.8301466 0.8302129 0.8302789 [239] 0.8303447 0.8304102 0.8304755 0.8305405 0.8306053 0.8306699 0.8307342 [246] 0.8307982 0.8308620 0.8309256 0.8309889 0.8310520 0.8311148 0.8311774 [253] 0.8312398 0.8313019 0.8313637 0.8314254 0.8314867 0.8315479 0.8316088 [260] 0.8316694 0.8317298 0.8317900 0.8318499 0.8319096 0.8319691 0.8320283 [267] 0.8320873 0.8321460 0.8322045 0.8322627 0.8323208 0.8323785 0.8324361 [274] 0.8324934 0.8325504 0.8326073 0.8326639 0.8327202 0.8327763 0.8328322 [281] 0.8328879 0.8329433 0.8329984 0.8330534 0.8331081 0.8331626 0.8332168 [288] 0.8332708 0.8333246 0.8333781 0.8334314 0.8334845 0.8335373 0.8335899 [295] 0.8336423 0.8336944 0.8337463 0.8337980 0.8338495 0.8339007 0.8339516 [302] 0.8340024 0.8340529 0.8341032 0.8341533 0.8342031 0.8342527 0.8343021 [309] 0.8343513 0.8344002 0.8344489 0.8344973 0.8345456 0.8345936 0.8346414 [316] 0.8346889 0.8347362 0.8347834 0.8348302 0.8348769 0.8349233 0.8349695 [323] 0.8350155 0.8350612 0.8351068 0.8351521 0.8351972 0.8352420 0.8352867 [330] 0.8353311 0.8353753 0.8354192 0.8354630 0.8355065 0.8355498 0.8355929 [337] 0.8356358 0.8356784 0.8357208 0.8357630 0.8358050 0.8358467 0.8358883 [344] 0.8359296 0.8359707 0.8360116 0.8360523 0.8360927 0.8361329 0.8361730 [351] 0.8362128 0.8362523 0.8362917 0.8363308 0.8363698 0.8364085 0.8364470 [358] 0.8364853 0.8365233 0.8365612 0.8365988 0.8366362 0.8366735 0.8367105 [365] 0.8367472 0.8367838 0.8368202 0.8368563 0.8368922 0.8369280 0.8369635 [372] 0.8369988 0.8370338 0.8370687 0.8371034 0.8371378 0.8371721 0.8372061 [379] 0.8372399 0.8372736 0.8373070 0.8373402 0.8373731 0.8374059 0.8374385 [386] 0.8374709 0.8375030 0.8375350 0.8375667 0.8375982 0.8376296 0.8376607 [393] 0.8376916 0.8377223 0.8377528 0.8377831 0.8378132 0.8378431 0.8378728 [400] 0.8379023 0.8379316 > mx [1] 0.8379316 > 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/html/rcomp/tmp/11n421260809659.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/2md001260809659.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/3mb631260809659.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/4pcfw1260809659.tab") > try(system("convert tmp/11n421260809659.ps tmp/11n421260809659.png",intern=TRUE)) character(0) > try(system("convert tmp/2md001260809659.ps tmp/2md001260809659.png",intern=TRUE)) character(0) > try(system("convert tmp/3mb631260809659.ps tmp/3mb631260809659.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.800 0.510 1.322