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(9.0,9.1,8.7,8.2,7.9,7.9,9.1,9.4,9.5,9.1,9.0,9.3,9.9,9.8,9.4,8.3,8.0,8.5,10.4,11.1,10.9,9.9,9.2,9.2,9.5,9.6,9.5,9.1,8.9,9.0,10.1,10.3,10.2,9.6,9.2,9.3,9.4,9.4,9.2,9.0,9.0,9.0,9.8,10.0,9.9,9.3,9.0,9.0,9.1,9.1,9.1,9.2,8.8,8.3,8.4,8.1,7.8,7.9,7.9,8.0,7.9,7.5,7.2,6.9,6.6,6.7,7.3,7.5) > x <- c(7.8,7.6,7.5,7.6,7.5,7.3,7.6,7.5,7.6,7.9,7.9,8.1,8.2,8.0,7.5,6.8,6.5,6.6,7.6,8.0,8.0,7.7,7.5,7.6,7.7,7.9,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.1,7.9,7.3,6.9,6.6,6.7,6.9,7.0,7.1,7.2,7.1,6.9,7.0,6.8,6.4,6.7,6.7,6.4,6.3,6.2,6.5,6.8,6.8,6.5,6.3,5.9,5.9,6.4,6.4) > #'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.7312817 0.7312170 0.7311521 0.7310871 0.7310220 0.7309567 0.7308913 [8] 0.7308258 0.7307601 0.7306943 0.7306284 0.7305624 0.7304962 0.7304299 [15] 0.7303635 0.7302969 0.7302303 0.7301634 0.7300965 0.7300294 0.7299623 [22] 0.7298949 0.7298275 0.7297599 0.7296922 0.7296244 0.7295565 0.7294884 [29] 0.7294202 0.7293519 0.7292834 0.7292148 0.7291461 0.7290773 0.7290084 [36] 0.7289393 0.7288701 0.7288008 0.7287313 0.7286617 0.7285920 0.7285222 [43] 0.7284523 0.7283822 0.7283120 0.7282417 0.7281712 0.7281007 0.7280300 [50] 0.7279592 0.7278882 0.7278172 0.7277460 0.7276747 0.7276033 0.7275317 [57] 0.7274601 0.7273883 0.7273164 0.7272443 0.7271722 0.7270999 0.7270275 [64] 0.7269550 0.7268823 0.7268096 0.7267367 0.7266637 0.7265906 0.7265173 [71] 0.7264440 0.7263705 0.7262969 0.7262232 0.7261493 0.7260754 0.7260013 [78] 0.7259271 0.7258528 0.7257784 0.7257038 0.7256291 0.7255544 0.7254794 [85] 0.7254044 0.7253293 0.7252540 0.7251786 0.7251032 0.7250275 0.7249518 [92] 0.7248760 0.7248000 0.7247239 0.7246477 0.7245714 0.7244950 0.7244184 [99] 0.7243418 0.7242650 0.7241881 0.7241111 0.7240340 0.7239567 0.7238794 [106] 0.7238019 0.7237243 0.7236467 0.7235688 0.7234909 0.7234129 0.7233347 [113] 0.7232565 0.7231781 0.7230996 0.7230210 0.7229422 0.7228634 0.7227845 [120] 0.7227054 0.7226262 0.7225469 0.7224675 0.7223880 0.7223084 0.7222287 [127] 0.7221488 0.7220689 0.7219888 0.7219086 0.7218283 0.7217479 0.7216674 [134] 0.7215868 0.7215061 0.7214252 0.7213443 0.7212632 0.7211820 0.7211007 [141] 0.7210193 0.7209378 0.7208562 0.7207745 0.7206926 0.7206107 0.7205286 [148] 0.7204465 0.7203642 0.7202818 0.7201994 0.7201168 0.7200341 0.7199512 [155] 0.7198683 0.7197853 0.7197022 0.7196189 0.7195356 0.7194521 0.7193686 [162] 0.7192849 0.7192011 0.7191172 0.7190333 0.7189492 0.7188650 0.7187807 [169] 0.7186962 0.7186117 0.7185271 0.7184424 0.7183576 0.7182726 0.7181876 [176] 0.7181024 0.7180172 0.7179318 0.7178464 0.7177608 0.7176751 0.7175894 [183] 0.7175035 0.7174175 0.7173314 0.7172452 0.7171590 0.7170726 0.7169861 [190] 0.7168995 0.7168128 0.7167260 0.7166391 0.7165521 0.7164650 0.7163778 [197] 0.7162905 0.7162030 0.7161155 0.7160279 0.7159402 0.7158524 0.7157645 [204] 0.7156765 0.7155883 0.7155001 0.7154118 0.7153234 0.7152349 0.7151463 [211] 0.7150576 0.7149687 0.7148798 0.7147908 0.7147017 0.7146125 0.7145232 [218] 0.7144338 0.7143443 0.7142547 0.7141650 0.7140752 0.7139853 0.7138953 [225] 0.7138052 0.7137150 0.7136247 0.7135343 0.7134438 0.7133533 0.7132626 [232] 0.7131718 0.7130810 0.7129900 0.7128989 0.7128078 0.7127165 0.7126252 [239] 0.7125337 0.7124422 0.7123506 0.7122589 0.7121670 0.7120751 0.7119831 [246] 0.7118910 0.7117988 0.7117065 0.7116141 0.7115216 0.7114291 0.7113364 [253] 0.7112436 0.7111508 0.7110578 0.7109648 0.7108717 0.7107785 0.7106851 [260] 0.7105917 0.7104982 0.7104046 0.7103109 0.7102172 0.7101233 0.7100293 [267] 0.7099353 0.7098411 0.7097469 0.7096526 0.7095582 0.7094637 0.7093691 [274] 0.7092744 0.7091796 0.7090847 0.7089898 0.7088947 0.7087996 0.7087044 [281] 0.7086091 0.7085137 0.7084182 0.7083226 0.7082269 0.7081312 0.7080353 [288] 0.7079394 0.7078434 0.7077473 0.7076511 0.7075548 0.7074584 0.7073619 [295] 0.7072654 0.7071688 0.7070720 0.7069752 0.7068783 0.7067814 0.7066843 [302] 0.7065871 0.7064899 0.7063926 0.7062952 0.7061977 0.7061001 0.7060024 [309] 0.7059047 0.7058068 0.7057089 0.7056109 0.7055128 0.7054146 0.7053164 [316] 0.7052180 0.7051196 0.7050211 0.7049225 0.7048238 0.7047250 0.7046262 [323] 0.7045272 0.7044282 0.7043291 0.7042300 0.7041307 0.7040313 0.7039319 [330] 0.7038324 0.7037328 0.7036331 0.7035334 0.7034336 0.7033336 0.7032336 [337] 0.7031336 0.7030334 0.7029332 0.7028328 0.7027324 0.7026319 0.7025314 [344] 0.7024307 0.7023300 0.7022292 0.7021283 0.7020274 0.7019263 0.7018252 [351] 0.7017240 0.7016227 0.7015213 0.7014199 0.7013184 0.7012168 0.7011151 [358] 0.7010134 0.7009115 0.7008096 0.7007076 0.7006056 0.7005034 0.7004012 [365] 0.7002989 0.7001965 0.7000941 0.6999916 0.6998890 0.6997863 0.6996835 [372] 0.6995807 0.6994778 0.6993748 0.6992717 0.6991686 0.6990654 0.6989621 [379] 0.6988587 0.6987553 0.6986518 0.6985482 0.6984445 0.6983408 0.6982370 [386] 0.6981331 0.6980291 0.6979251 0.6978210 0.6977168 0.6976126 0.6975082 [393] 0.6974038 0.6972994 0.6971948 0.6970902 0.6969855 0.6968807 0.6967759 [400] 0.6966710 0.6965660 > mx [1] 0.7312817 > 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/freestat/rcomp/tmp/1ile31226429795.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/2l0dx1226429795.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/3zz571226429795.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/4fyxb1226429795.tab") > > system("convert tmp/1ile31226429795.ps tmp/1ile31226429795.png") > system("convert tmp/2l0dx1226429795.ps tmp/2l0dx1226429795.png") > system("convert tmp/3zz571226429795.ps tmp/3zz571226429795.png") > > > proc.time() user system elapsed 1.225 0.819 1.506