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(111.2,116.7,114.8,100.0,98.8,106.3,119.5,120.7,121.1,112.4,108.2,113.6,106.7,114.3,117.3,109.6,109.9,112.5,116.1,112.0,113.3,107.9,108.2,114.8,105.6,111.9,113.6,108.4,111.1,112.5,112.6,108.7,108.9,104.5,105.9,111.1,102.2,108.3,112.3,110.8,108.6,103.8,96.6,88.0,85.6,88.8,92.9,98.8,88.8,90.5,87.7,81.9,80.2,86.3,94.3,94.6,92.2,88.8,88.2,96.3) > x <- c(126.2,127.0,127.1,123.6,125.0,134.7,140.7,137.9,142.1,137.5,136.4,140.7,120.0,123.8,132.2,136.4,144.2,144.9,138.9,129.3,133.3,137.5,140.0,146.3,124.6,130.2,139.0,149.1,151.9,149.0,127.8,113.8,117.5,123.2,127.3,131.5,110.8,112.7,116.9,127.3,130.8,130.6,124.1,113.8,112.3,112.5,112.7,120.4,104.6,107.9,108.5,110.9,111.5,124.5,133.3,125.9,121.1,108.9,105.5,114.8) > #'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.7384543 0.7384041 0.7383536 0.7383029 0.7382520 0.7382009 0.7381496 [8] 0.7380981 0.7380464 0.7379945 0.7379423 0.7378900 0.7378374 0.7377847 [15] 0.7377317 0.7376785 0.7376251 0.7375715 0.7375177 0.7374636 0.7374094 [22] 0.7373550 0.7373003 0.7372454 0.7371904 0.7371351 0.7370796 0.7370239 [29] 0.7369680 0.7369118 0.7368555 0.7367989 0.7367422 0.7366852 0.7366280 [36] 0.7365707 0.7365131 0.7364553 0.7363972 0.7363390 0.7362806 0.7362219 [43] 0.7361630 0.7361040 0.7360447 0.7359852 0.7359255 0.7358656 0.7358054 [50] 0.7357451 0.7356846 0.7356238 0.7355628 0.7355016 0.7354402 0.7353786 [57] 0.7353168 0.7352548 0.7351926 0.7351301 0.7350675 0.7350046 0.7349415 [64] 0.7348782 0.7348147 0.7347510 0.7346870 0.7346229 0.7345585 0.7344940 [71] 0.7344292 0.7343642 0.7342990 0.7342336 0.7341680 0.7341022 0.7340361 [78] 0.7339699 0.7339034 0.7338367 0.7337698 0.7337027 0.7336354 0.7335679 [85] 0.7335001 0.7334322 0.7333640 0.7332956 0.7332270 0.7331582 0.7330892 [92] 0.7330200 0.7329506 0.7328809 0.7328111 0.7327410 0.7326707 0.7326002 [99] 0.7325295 0.7324586 0.7323874 0.7323161 0.7322446 0.7321728 0.7321008 [106] 0.7320286 0.7319562 0.7318836 0.7318108 0.7317377 0.7316645 0.7315910 [113] 0.7315173 0.7314434 0.7313693 0.7312950 0.7312205 0.7311458 0.7310708 [120] 0.7309957 0.7309203 0.7308447 0.7307689 0.7306929 0.7306167 0.7305402 [127] 0.7304636 0.7303867 0.7303097 0.7302324 0.7301549 0.7300772 0.7299993 [134] 0.7299212 0.7298428 0.7297643 0.7296855 0.7296065 0.7295273 0.7294479 [141] 0.7293683 0.7292885 0.7292085 0.7291282 0.7290478 0.7289671 0.7288862 [148] 0.7288051 0.7287238 0.7286423 0.7285606 0.7284786 0.7283965 0.7283141 [155] 0.7282316 0.7281488 0.7280658 0.7279826 0.7278992 0.7278155 0.7277317 [162] 0.7276476 0.7275634 0.7274789 0.7273942 0.7273093 0.7272242 0.7271389 [169] 0.7270533 0.7269676 0.7268817 0.7267955 0.7267091 0.7266225 0.7265357 [176] 0.7264487 0.7263615 0.7262741 0.7261864 0.7260986 0.7260105 0.7259223 [183] 0.7258338 0.7257451 0.7256562 0.7255671 0.7254777 0.7253882 0.7252985 [190] 0.7252085 0.7251184 0.7250280 0.7249374 0.7248466 0.7247556 0.7246644 [197] 0.7245730 0.7244813 0.7243895 0.7242974 0.7242052 0.7241127 0.7240200 [204] 0.7239271 0.7238340 0.7237407 0.7236472 0.7235535 0.7234595 0.7233654 [211] 0.7232710 0.7231765 0.7230817 0.7229867 0.7228915 0.7227961 0.7227005 [218] 0.7226047 0.7225087 0.7224124 0.7223160 0.7222193 0.7221225 0.7220254 [225] 0.7219281 0.7218307 0.7217330 0.7216351 0.7215370 0.7214386 0.7213401 [232] 0.7212414 0.7211425 0.7210433 0.7209440 0.7208444 0.7207446 0.7206447 [239] 0.7205445 0.7204441 0.7203435 0.7202427 0.7201417 0.7200405 0.7199390 [246] 0.7198374 0.7197356 0.7196335 0.7195313 0.7194288 0.7193262 0.7192233 [253] 0.7191202 0.7190170 0.7189135 0.7188098 0.7187059 0.7186018 0.7184975 [260] 0.7183930 0.7182883 0.7181833 0.7180782 0.7179729 0.7178673 0.7177616 [267] 0.7176557 0.7175495 0.7174432 0.7173366 0.7172298 0.7171229 0.7170157 [274] 0.7169083 0.7168007 0.7166930 0.7165850 0.7164768 0.7163684 0.7162598 [281] 0.7161510 0.7160420 0.7159328 0.7158234 0.7157137 0.7156039 0.7154939 [288] 0.7153837 0.7152733 0.7151626 0.7150518 0.7149408 0.7148296 0.7147181 [295] 0.7146065 0.7144946 0.7143826 0.7142704 0.7141579 0.7140453 0.7139324 [302] 0.7138194 0.7137061 0.7135927 0.7134791 0.7133652 0.7132512 0.7131369 [309] 0.7130225 0.7129078 0.7127930 0.7126779 0.7125627 0.7124472 0.7123316 [316] 0.7122157 0.7120997 0.7119834 0.7118670 0.7117504 0.7116335 0.7115165 [323] 0.7113992 0.7112818 0.7111642 0.7110463 0.7109283 0.7108101 0.7106917 [330] 0.7105730 0.7104542 0.7103352 0.7102160 0.7100966 0.7099770 0.7098572 [337] 0.7097372 0.7096170 0.7094966 0.7093760 0.7092552 0.7091342 0.7090130 [344] 0.7088917 0.7087701 0.7086483 0.7085264 0.7084042 0.7082819 0.7081593 [351] 0.7080366 0.7079137 0.7077905 0.7076672 0.7075437 0.7074200 0.7072961 [358] 0.7071720 0.7070477 0.7069232 0.7067986 0.7066737 0.7065486 0.7064234 [365] 0.7062979 0.7061723 0.7060465 0.7059204 0.7057942 0.7056678 0.7055412 [372] 0.7054144 0.7052875 0.7051603 0.7050329 0.7049054 0.7047776 0.7046497 [379] 0.7045216 0.7043933 0.7042648 0.7041361 0.7040072 0.7038781 0.7037488 [386] 0.7036194 0.7034898 0.7033599 0.7032299 0.7030997 0.7029693 0.7028387 [393] 0.7027080 0.7025770 0.7024459 0.7023145 0.7021830 0.7020513 0.7019194 [400] 0.7017873 0.7016551 > mx [1] 0.7384543 > 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/1m1h71258136794.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/2pozd1258136794.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/37xya1258136794.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/4kwn01258136794.tab") > > system("convert tmp/1m1h71258136794.ps tmp/1m1h71258136794.png") > system("convert tmp/2pozd1258136794.ps tmp/2pozd1258136794.png") > system("convert tmp/37xya1258136794.ps tmp/37xya1258136794.png") > > > proc.time() user system elapsed 0.786 0.522 1.770