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(420,418,410,418,426,428,430,424,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,424,433,456,459,446) > x <- c(8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8.00,8.2,8.1,8.1,8.00,7.9,7.9,8.00,8.00,7.9,8.00,7.7,7.2,7.5,7.3,7.00,7.00,7.00,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9,7.7,8.00,8.00,7.7,7.3,7.4,8.1,8.3,8.2) > #'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.7567865 0.7567910 0.7567951 0.7567989 0.7568024 0.7568056 0.7568085 [8] 0.7568110 0.7568132 0.7568151 0.7568167 0.7568179 0.7568188 0.7568195 [15] 0.7568197 0.7568197 0.7568194 0.7568187 0.7568177 0.7568164 0.7568147 [22] 0.7568128 0.7568105 0.7568079 0.7568050 0.7568018 0.7567982 0.7567943 [29] 0.7567901 0.7567856 0.7567808 0.7567757 0.7567702 0.7567644 0.7567583 [36] 0.7567518 0.7567451 0.7567380 0.7567306 0.7567229 0.7567149 0.7567066 [43] 0.7566979 0.7566889 0.7566796 0.7566700 0.7566601 0.7566498 0.7566392 [50] 0.7566283 0.7566171 0.7566056 0.7565937 0.7565816 0.7565691 0.7565563 [57] 0.7565432 0.7565297 0.7565160 0.7565019 0.7564875 0.7564728 0.7564578 [64] 0.7564425 0.7564268 0.7564108 0.7563945 0.7563779 0.7563610 0.7563438 [71] 0.7563262 0.7563083 0.7562901 0.7562716 0.7562528 0.7562337 0.7562142 [78] 0.7561944 0.7561743 0.7561539 0.7561332 0.7561122 0.7560908 0.7560692 [85] 0.7560472 0.7560249 0.7560023 0.7559794 0.7559561 0.7559326 0.7559087 [92] 0.7558845 0.7558600 0.7558352 0.7558101 0.7557846 0.7557589 0.7557328 [99] 0.7557064 0.7556797 0.7556527 0.7556254 0.7555978 0.7555698 0.7555416 [106] 0.7555130 0.7554841 0.7554549 0.7554254 0.7553956 0.7553654 0.7553350 [113] 0.7553042 0.7552731 0.7552417 0.7552101 0.7551780 0.7551457 0.7551131 [120] 0.7550801 0.7550469 0.7550133 0.7549795 0.7549453 0.7549108 0.7548760 [127] 0.7548408 0.7548054 0.7547697 0.7547336 0.7546973 0.7546606 0.7546236 [134] 0.7545863 0.7545487 0.7545108 0.7544726 0.7544341 0.7543953 0.7543561 [141] 0.7543167 0.7542769 0.7542369 0.7541965 0.7541558 0.7541148 0.7540735 [148] 0.7540319 0.7539900 0.7539478 0.7539053 0.7538624 0.7538193 0.7537758 [155] 0.7537321 0.7536880 0.7536437 0.7535990 0.7535540 0.7535087 0.7534631 [162] 0.7534172 0.7533710 0.7533245 0.7532777 0.7532306 0.7531832 0.7531355 [169] 0.7530874 0.7530391 0.7529905 0.7529415 0.7528923 0.7528427 0.7527929 [176] 0.7527427 0.7526923 0.7526415 0.7525905 0.7525391 0.7524874 0.7524355 [183] 0.7523832 0.7523306 0.7522777 0.7522245 0.7521711 0.7521173 0.7520632 [190] 0.7520088 0.7519541 0.7518991 0.7518439 0.7517883 0.7517324 0.7516762 [197] 0.7516197 0.7515629 0.7515058 0.7514484 0.7513908 0.7513328 0.7512745 [204] 0.7512159 0.7511570 0.7510979 0.7510384 0.7509786 0.7509185 0.7508582 [211] 0.7507975 0.7507365 0.7506753 0.7506137 0.7505518 0.7504897 0.7504272 [218] 0.7503645 0.7503015 0.7502381 0.7501745 0.7501106 0.7500463 0.7499818 [225] 0.7499170 0.7498519 0.7497865 0.7497208 0.7496548 0.7495885 0.7495219 [232] 0.7494550 0.7493879 0.7493204 0.7492527 0.7491846 0.7491163 0.7490476 [239] 0.7489787 0.7489095 0.7488400 0.7487702 0.7487001 0.7486297 0.7485590 [246] 0.7484881 0.7484168 0.7483453 0.7482734 0.7482013 0.7481289 0.7480562 [253] 0.7479832 0.7479099 0.7478363 0.7477624 0.7476883 0.7476138 0.7475391 [260] 0.7474641 0.7473888 0.7473132 0.7472373 0.7471611 0.7470846 0.7470079 [267] 0.7469308 0.7468535 0.7467759 0.7466980 0.7466198 0.7465414 0.7464626 [274] 0.7463836 0.7463043 0.7462246 0.7461448 0.7460646 0.7459841 0.7459034 [281] 0.7458223 0.7457410 0.7456594 0.7455775 0.7454954 0.7454129 0.7453302 [288] 0.7452472 0.7451639 0.7450803 0.7449964 0.7449123 0.7448279 0.7447432 [295] 0.7446582 0.7445729 0.7444873 0.7444015 0.7443154 0.7442290 0.7441423 [302] 0.7440554 0.7439682 0.7438807 0.7437929 0.7437048 0.7436165 0.7435278 [309] 0.7434389 0.7433497 0.7432603 0.7431706 0.7430805 0.7429902 0.7428997 [316] 0.7428088 0.7427177 0.7426263 0.7425346 0.7424427 0.7423505 0.7422580 [323] 0.7421652 0.7420721 0.7419788 0.7418852 0.7417913 0.7416972 0.7416028 [330] 0.7415081 0.7414131 0.7413179 0.7412224 0.7411266 0.7410305 0.7409342 [337] 0.7408376 0.7407407 0.7406436 0.7405461 0.7404484 0.7403505 0.7402522 [344] 0.7401537 0.7400550 0.7399559 0.7398566 0.7397570 0.7396572 0.7395571 [351] 0.7394567 0.7393560 0.7392551 0.7391539 0.7390524 0.7389507 0.7388487 [358] 0.7387464 0.7386439 0.7385411 0.7384381 0.7383347 0.7382311 0.7381273 [365] 0.7380231 0.7379187 0.7378141 0.7377092 0.7376040 0.7374985 0.7373928 [372] 0.7372868 0.7371806 0.7370741 0.7369673 0.7368603 0.7367530 0.7366454 [379] 0.7365376 0.7364295 0.7363212 0.7362125 0.7361037 0.7359945 0.7358852 [386] 0.7357755 0.7356656 0.7355554 0.7354450 0.7353343 0.7352233 0.7351121 [393] 0.7350007 0.7348889 0.7347769 0.7346647 0.7345522 0.7344394 0.7343264 [400] 0.7342131 0.7340996 > mx [1] 0.7568197 > mxli [1] -1.86 > 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/1m6vl1258034059.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/217fq1258034059.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/3bubj1258034059.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/41vc91258034059.tab") > > system("convert tmp/1m6vl1258034059.ps tmp/1m6vl1258034059.png") > system("convert tmp/217fq1258034059.ps tmp/217fq1258034059.png") > system("convert tmp/3bubj1258034059.ps tmp/3bubj1258034059.png") > > > proc.time() user system elapsed 0.755 0.485 1.933