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(423,427,441,449,452,462,455,461,461,463,462,456,455,456,472,472,471,465,459,465,468,467,463,460,462,461,476,476,471,453,443,442,444,438,427,424,416,406,431,434,418,412,404,409,412,406,398,397,385,390,413,413,401,397,397,409,419,424,428,430) > x <- c(114,116,153,162,161,149,139,135,130,127,122,117,112,113,149,157,157,147,137,132,125,123,117,114,111,112,144,150,149,134,123,116,117,111,105,102,95,93,124,130,124,115,106,105,105,101,95,93,84,87,116,120,117,109,105,107,109,109,108,107) > #'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.7762830 0.7762913 0.7762985 0.7763049 0.7763103 0.7763148 0.7763184 [8] 0.7763211 0.7763228 0.7763235 0.7763234 0.7763223 0.7763203 0.7763174 [15] 0.7763135 0.7763087 0.7763030 0.7762963 0.7762888 0.7762802 0.7762708 [22] 0.7762604 0.7762491 0.7762369 0.7762237 0.7762096 0.7761946 0.7761787 [29] 0.7761618 0.7761440 0.7761253 0.7761056 0.7760850 0.7760635 0.7760410 [36] 0.7760177 0.7759934 0.7759682 0.7759420 0.7759149 0.7758869 0.7758580 [43] 0.7758282 0.7757974 0.7757657 0.7757331 0.7756995 0.7756651 0.7756297 [50] 0.7755934 0.7755561 0.7755180 0.7754789 0.7754389 0.7753980 0.7753561 [57] 0.7753134 0.7752697 0.7752251 0.7751796 0.7751332 0.7750859 0.7750376 [64] 0.7749884 0.7749383 0.7748873 0.7748354 0.7747826 0.7747289 0.7746742 [71] 0.7746187 0.7745622 0.7745048 0.7744465 0.7743873 0.7743272 0.7742662 [78] 0.7742043 0.7741415 0.7740778 0.7740131 0.7739476 0.7738812 0.7738138 [85] 0.7737456 0.7736765 0.7736064 0.7735355 0.7734637 0.7733909 0.7733173 [92] 0.7732428 0.7731674 0.7730911 0.7730139 0.7729358 0.7728569 0.7727770 [99] 0.7726962 0.7726146 0.7725321 0.7724487 0.7723644 0.7722792 0.7721931 [106] 0.7721062 0.7720184 0.7719297 0.7718401 0.7717496 0.7716583 0.7715661 [113] 0.7714730 0.7713790 0.7712842 0.7711885 0.7710920 0.7709945 0.7708962 [120] 0.7707970 0.7706970 0.7705961 0.7704944 0.7703917 0.7702883 0.7701839 [127] 0.7700787 0.7699727 0.7698657 0.7697580 0.7696494 0.7695399 0.7694296 [134] 0.7693184 0.7692064 0.7690935 0.7689798 0.7688653 0.7687499 0.7686336 [141] 0.7685165 0.7683986 0.7682799 0.7681603 0.7680399 0.7679186 0.7677965 [148] 0.7676736 0.7675498 0.7674253 0.7672999 0.7671736 0.7670466 0.7669187 [155] 0.7667900 0.7666605 0.7665302 0.7663990 0.7662670 0.7661343 0.7660007 [162] 0.7658663 0.7657311 0.7655951 0.7654582 0.7653206 0.7651822 0.7650430 [169] 0.7649029 0.7647621 0.7646205 0.7644781 0.7643349 0.7641909 0.7640461 [176] 0.7639005 0.7637541 0.7636070 0.7634590 0.7633103 0.7631608 0.7630106 [183] 0.7628595 0.7627077 0.7625551 0.7624017 0.7622475 0.7620926 0.7619369 [190] 0.7617805 0.7616233 0.7614653 0.7613066 0.7611471 0.7609868 0.7608258 [197] 0.7606641 0.7605016 0.7603383 0.7601743 0.7600095 0.7598440 0.7596778 [204] 0.7595108 0.7593431 0.7591746 0.7590054 0.7588355 0.7586648 0.7584934 [211] 0.7583213 0.7581485 0.7579749 0.7578006 0.7576256 0.7574498 0.7572734 [218] 0.7570962 0.7569183 0.7567397 0.7565604 0.7563804 0.7561997 0.7560182 [225] 0.7558361 0.7556533 0.7554697 0.7552855 0.7551006 0.7549150 0.7547287 [232] 0.7545417 0.7543540 0.7541656 0.7539765 0.7537868 0.7535964 0.7534053 [239] 0.7532135 0.7530210 0.7528279 0.7526341 0.7524397 0.7522445 0.7520487 [246] 0.7518523 0.7516552 0.7514574 0.7512590 0.7510599 0.7508601 0.7506597 [253] 0.7504587 0.7502570 0.7500547 0.7498517 0.7496481 0.7494438 0.7492390 [260] 0.7490334 0.7488273 0.7486205 0.7484130 0.7482050 0.7479963 0.7477870 [267] 0.7475771 0.7473666 0.7471554 0.7469437 0.7467313 0.7465183 0.7463047 [274] 0.7460905 0.7458757 0.7456602 0.7454442 0.7452276 0.7450104 0.7447926 [281] 0.7445742 0.7443552 0.7441356 0.7439154 0.7436947 0.7434734 0.7432514 [288] 0.7430290 0.7428059 0.7425822 0.7423580 0.7421332 0.7419079 0.7416820 [295] 0.7414555 0.7412284 0.7410008 0.7407727 0.7405439 0.7403147 0.7400848 [302] 0.7398545 0.7396235 0.7393921 0.7391601 0.7389275 0.7386944 0.7384608 [309] 0.7382266 0.7379919 0.7377567 0.7375209 0.7372847 0.7370478 0.7368105 [316] 0.7365727 0.7363343 0.7360954 0.7358560 0.7356161 0.7353757 0.7351347 [323] 0.7348933 0.7346513 0.7344089 0.7341659 0.7339225 0.7336786 0.7334341 [330] 0.7331892 0.7329438 0.7326979 0.7324515 0.7322046 0.7319573 0.7317094 [337] 0.7314611 0.7312123 0.7309631 0.7307133 0.7304631 0.7302125 0.7299614 [344] 0.7297098 0.7294577 0.7292052 0.7289522 0.7286988 0.7284449 0.7281906 [351] 0.7279358 0.7276806 0.7274249 0.7271688 0.7269123 0.7266553 0.7263978 [358] 0.7261400 0.7258817 0.7256230 0.7253638 0.7251042 0.7248442 0.7245838 [365] 0.7243230 0.7240617 0.7238000 0.7235380 0.7232755 0.7230125 0.7227492 [372] 0.7224855 0.7222214 0.7219568 0.7216919 0.7214266 0.7211609 0.7208947 [379] 0.7206282 0.7203613 0.7200941 0.7198264 0.7195583 0.7192899 0.7190211 [386] 0.7187519 0.7184823 0.7182124 0.7179420 0.7176714 0.7174003 0.7171289 [393] 0.7168571 0.7165849 0.7163124 0.7160396 0.7157664 0.7154928 0.7152189 [400] 0.7149446 0.7146700 > mx [1] 0.7763235 > mxli [1] -1.91 > 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/18gc51261090392.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/2vqpg1261090392.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/3t5481261090392.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/45zya1261090392.tab") > > try(system("convert tmp/18gc51261090392.ps tmp/18gc51261090392.png",intern=TRUE)) character(0) > try(system("convert tmp/2vqpg1261090392.ps tmp/2vqpg1261090392.png",intern=TRUE)) character(0) > try(system("convert tmp/3t5481261090392.ps tmp/3t5481261090392.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.772 0.495 1.093