R version 2.8.0 (2008-10-20) 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(97.4,97,105.4,102.7,98.1,104.5,87.4,89.9,109.8,111.7,98.6,96.9,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,97.6) > x <- c(91.2,99.2,108.2,101.5,106.9,104.4,77.9,60,99.5,95,105.6,102.5,93.3,97.3,127,111.7,96.4,133,72.2,95.8,124.1,127.6,110.7,104.6,112.7,115.3,139.4,119,97.4,154,81.5,88.8,127.7,105.1,114.9,106.4,104.5,121.6,141.4,99,126.7,134.1,81.3,88.6,132.7,132.9,134.4,103.7,119.7,115,132.9,108.5,113.9,142,97.7,92.2,128.8,134.9,128.2,114.8,117.9,119.1,120.7,129.1,117.6,129.2,100,87.3) > #'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.7576468 0.7582193 0.7587898 0.7593584 0.7599249 0.7604894 0.7610519 [8] 0.7616123 0.7621707 0.7627271 0.7632814 0.7638337 0.7643839 0.7649321 [15] 0.7654782 0.7660222 0.7665642 0.7671041 0.7676419 0.7681776 0.7687112 [22] 0.7692428 0.7697722 0.7702996 0.7708248 0.7713479 0.7718689 0.7723878 [29] 0.7729046 0.7734192 0.7739317 0.7744421 0.7749503 0.7754564 0.7759604 [36] 0.7764622 0.7769619 0.7774594 0.7779548 0.7784480 0.7789390 0.7794279 [43] 0.7799146 0.7803991 0.7808815 0.7813617 0.7818397 0.7823156 0.7827892 [50] 0.7832607 0.7837300 0.7841971 0.7846620 0.7851248 0.7855853 0.7860436 [57] 0.7864998 0.7869537 0.7874055 0.7878550 0.7883023 0.7887475 0.7891904 [64] 0.7896311 0.7900696 0.7905059 0.7909400 0.7913719 0.7918015 0.7922290 [71] 0.7926542 0.7930772 0.7934980 0.7939166 0.7943330 0.7947471 0.7951590 [78] 0.7955687 0.7959762 0.7963815 0.7967845 0.7971854 0.7975840 0.7979803 [85] 0.7983745 0.7987665 0.7991562 0.7995437 0.7999290 0.8003120 0.8006929 [92] 0.8010715 0.8014479 0.8018221 0.8021941 0.8025638 0.8029314 0.8032967 [99] 0.8036598 0.8040207 0.8043794 0.8047359 0.8050901 0.8054422 0.8057920 [106] 0.8061397 0.8064851 0.8068284 0.8071694 0.8075082 0.8078448 0.8081793 [113] 0.8085115 0.8088415 0.8091694 0.8094950 0.8098185 0.8101398 0.8104588 [120] 0.8107757 0.8110905 0.8114030 0.8117134 0.8120216 0.8123276 0.8126314 [127] 0.8129331 0.8132326 0.8135299 0.8138251 0.8141181 0.8144090 0.8146977 [134] 0.8149842 0.8152686 0.8155508 0.8158310 0.8161089 0.8163847 0.8166584 [141] 0.8169300 0.8171994 0.8174667 0.8177319 0.8179949 0.8182559 0.8185147 [148] 0.8187714 0.8190260 0.8192785 0.8195288 0.8197771 0.8200233 0.8202674 [155] 0.8205094 0.8207493 0.8209872 0.8212229 0.8214566 0.8216882 0.8219177 [162] 0.8221452 0.8223706 0.8225940 0.8228153 0.8230345 0.8232517 0.8234669 [169] 0.8236800 0.8238911 0.8241002 0.8243072 0.8245122 0.8247152 0.8249161 [176] 0.8251151 0.8253120 0.8255070 0.8256999 0.8258909 0.8260798 0.8262668 [183] 0.8264518 0.8266348 0.8268159 0.8269949 0.8271720 0.8273472 0.8275203 [190] 0.8276916 0.8278608 0.8280282 0.8281936 0.8283570 0.8285186 0.8286782 [197] 0.8288358 0.8289916 0.8291454 0.8292974 0.8294474 0.8295955 0.8297418 [204] 0.8298861 0.8300286 0.8301692 0.8303079 0.8304447 0.8305797 0.8307128 [211] 0.8308440 0.8309734 0.8311010 0.8312267 0.8313505 0.8314726 0.8315928 [218] 0.8317111 0.8318277 0.8319424 0.8320553 0.8321665 0.8322758 0.8323833 [225] 0.8324891 0.8325930 0.8326952 0.8327956 0.8328942 0.8329910 0.8330861 [232] 0.8331795 0.8332710 0.8333609 0.8334490 0.8335353 0.8336199 0.8337028 [239] 0.8337840 0.8338635 0.8339412 0.8340172 0.8340916 0.8341642 0.8342352 [246] 0.8343044 0.8343720 0.8344379 0.8345021 0.8345647 0.8346255 0.8346848 [253] 0.8347424 0.8347983 0.8348526 0.8349052 0.8349563 0.8350057 0.8350534 [260] 0.8350996 0.8351441 0.8351870 0.8352284 0.8352681 0.8353062 0.8353428 [267] 0.8353778 0.8354112 0.8354430 0.8354732 0.8355019 0.8355290 0.8355546 [274] 0.8355786 0.8356011 0.8356221 0.8356415 0.8356594 0.8356757 0.8356906 [281] 0.8357039 0.8357157 0.8357260 0.8357348 0.8357422 0.8357480 0.8357524 [288] 0.8357552 0.8357566 0.8357566 0.8357550 0.8357520 0.8357476 0.8357417 [295] 0.8357344 0.8357256 0.8357154 0.8357037 0.8356906 0.8356762 0.8356602 [302] 0.8356429 0.8356242 0.8356041 0.8355826 0.8355596 0.8355353 0.8355097 [309] 0.8354826 0.8354542 0.8354244 0.8353932 0.8353607 0.8353268 0.8352916 [316] 0.8352550 0.8352171 0.8351779 0.8351373 0.8350954 0.8350522 0.8350076 [323] 0.8349618 0.8349146 0.8348662 0.8348164 0.8347654 0.8347130 0.8346594 [330] 0.8346045 0.8345483 0.8344909 0.8344321 0.8343722 0.8343109 0.8342485 [337] 0.8341847 0.8341197 0.8340535 0.8339861 0.8339174 0.8338475 0.8337764 [344] 0.8337040 0.8336304 0.8335557 0.8334797 0.8334025 0.8333242 0.8332446 [351] 0.8331639 0.8330819 0.8329988 0.8329146 0.8328291 0.8327425 0.8326547 [358] 0.8325658 0.8324757 0.8323845 0.8322921 0.8321986 0.8321039 0.8320081 [365] 0.8319112 0.8318132 0.8317140 0.8316137 0.8315124 0.8314099 0.8313063 [372] 0.8312016 0.8310958 0.8309889 0.8308809 0.8307719 0.8306618 0.8305506 [379] 0.8304383 0.8303249 0.8302105 0.8300951 0.8299785 0.8298610 0.8297423 [386] 0.8296227 0.8295020 0.8293802 0.8292575 0.8291337 0.8290088 0.8288830 [393] 0.8287561 0.8286282 0.8284993 0.8283694 0.8282385 0.8281066 0.8279737 [400] 0.8278399 0.8277050 > mx [1] 0.8357566 > mxli [1] 0.88 > 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/freestat/rcomp/tmp/1ljwf1226603872.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/freestat/rcomp/tmp/2r68c1226603872.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/freestat/rcomp/tmp/301qm1226603872.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/4fpm91226603872.tab") > > system("convert tmp/1ljwf1226603872.ps tmp/1ljwf1226603872.png") > system("convert tmp/2r68c1226603872.ps tmp/2r68c1226603872.png") > system("convert tmp/301qm1226603872.ps tmp/301qm1226603872.png") > > > proc.time() user system elapsed 1.180 0.784 1.298