R version 2.7.2 (2008-08-25) 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,8.8,8.7,8.7,8.6,8.6,8.5,8.5,8.3,8.2,8.1,7.8,7.5,7.4,7.3,7.7,7.7,7.6,7.3,7.2,7.5,8.0,8.1,8.4,8.6,8.7,8.6,8.4,8.4,8.5,8.9,8.8,8.7,8.6,8.6,8.6,8.8,8.8,8.8,8.8,8.7,8.7,8.9,8.9,9.0,8.9,9.0,9.1,9.3,9.4,9.4,9.2,9.2,9.4,9.9,10.0,9.9,9.6,9.5,9.6,9.5,9.6,9.6,9.5,9.5,9.5,9.5,9.4,9.5,9.5,9.5,9.5,9.5,9.4,9.3,9.2,9.3,9.4,9.5,9.6,9.5,9.3,9.1,9.0,9.0,8.9,9.0,9.2,9.0,8.7,8.3,8.0,7.7,7.9,7.9,7.8,7.7,7.5,7.3,7.2,7.1,7.1) > x <- c(6.2,6.1,5.9,5.6,5.5,5.5,5.6,5.7,5.6,5.4,5.3,5.3,5.4,5.5,5.6,5.7,5.8,5.8,5.7,5.9,6.1,6.4,6.4,6.3,6.2,6.2,6.3,6.5,6.6,6.6,6.7,6.6,6.7,7.0,7.2,7.3,7.5,7.6,7.7,7.8,7.8,7.7,7.6,7.6,7.7,7.8,7.8,7.8,7.7,7.6,7.4,7.1,7.1,7.3,7.6,7.8,7.7,7.6,7.5,7.5,7.5,7.6,7.6,7.7,7.8,7.7,7.6,7.6,7.6,7.7,7.8,7.8,7.9,7.9,7.8,7.8,7.7,7.5,7.1,6.9,7.1,7.1,7.1,7.0,6.9,6.8,6.7,6.8,6.8,6.7,6.8,6.7,6.6,6.4,6.4,6.4,6.5,6.5,6.4,6.3,6.2,6.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.7126747 0.7128131 0.7129513 0.7130892 0.7132268 0.7133642 0.7135014 [8] 0.7136382 0.7137749 0.7139112 0.7140473 0.7141831 0.7143187 0.7144540 [15] 0.7145890 0.7147238 0.7148583 0.7149925 0.7151265 0.7152603 0.7153937 [22] 0.7155269 0.7156598 0.7157925 0.7159249 0.7160570 0.7161889 0.7163205 [29] 0.7164518 0.7165829 0.7167137 0.7168442 0.7169745 0.7171045 0.7172342 [36] 0.7173637 0.7174929 0.7176218 0.7177504 0.7178788 0.7180069 0.7181348 [43] 0.7182624 0.7183897 0.7185167 0.7186435 0.7187700 0.7188962 0.7190222 [50] 0.7191479 0.7192733 0.7193984 0.7195233 0.7196479 0.7197722 0.7198963 [57] 0.7200201 0.7201436 0.7202668 0.7203898 0.7205125 0.7206349 0.7207570 [64] 0.7208789 0.7210005 0.7211218 0.7212429 0.7213636 0.7214841 0.7216043 [71] 0.7217243 0.7218440 0.7219634 0.7220825 0.7222013 0.7223199 0.7224382 [78] 0.7225562 0.7226739 0.7227914 0.7229086 0.7230255 0.7231421 0.7232585 [85] 0.7233745 0.7234903 0.7236058 0.7237211 0.7238360 0.7239507 0.7240651 [92] 0.7241793 0.7242931 0.7244067 0.7245200 0.7246330 0.7247457 0.7248581 [99] 0.7249703 0.7250822 0.7251938 0.7253051 0.7254162 0.7255270 0.7256374 [106] 0.7257476 0.7258576 0.7259672 0.7260766 0.7261857 0.7262945 0.7264030 [113] 0.7265112 0.7266192 0.7267268 0.7268342 0.7269413 0.7270482 0.7271547 [120] 0.7272610 0.7273669 0.7274726 0.7275781 0.7276832 0.7277880 0.7278926 [127] 0.7279969 0.7281009 0.7282046 0.7283080 0.7284112 0.7285140 0.7286166 [134] 0.7287189 0.7288209 0.7289226 0.7290241 0.7291252 0.7292261 0.7293267 [141] 0.7294270 0.7295270 0.7296267 0.7297262 0.7298254 0.7299242 0.7300228 [148] 0.7301211 0.7302192 0.7303169 0.7304144 0.7305115 0.7306084 0.7307050 [155] 0.7308013 0.7308973 0.7309931 0.7310885 0.7311837 0.7312786 0.7313732 [162] 0.7314675 0.7315615 0.7316553 0.7317487 0.7318419 0.7319348 0.7320274 [169] 0.7321197 0.7322117 0.7323034 0.7323949 0.7324860 0.7325769 0.7326675 [176] 0.7327578 0.7328478 0.7329375 0.7330270 0.7331161 0.7332050 0.7332936 [183] 0.7333819 0.7334699 0.7335576 0.7336451 0.7337322 0.7338191 0.7339056 [190] 0.7339919 0.7340779 0.7341637 0.7342491 0.7343342 0.7344191 0.7345036 [197] 0.7345879 0.7346719 0.7347556 0.7348390 0.7349222 0.7350050 0.7350876 [204] 0.7351699 0.7352518 0.7353335 0.7354150 0.7354961 0.7355769 0.7356575 [211] 0.7357377 0.7358177 0.7358974 0.7359768 0.7360559 0.7361348 0.7362133 [218] 0.7362916 0.7363695 0.7364472 0.7365246 0.7366017 0.7366786 0.7367551 [225] 0.7368314 0.7369073 0.7369830 0.7370584 0.7371335 0.7372083 0.7372829 [232] 0.7373571 0.7374311 0.7375048 0.7375782 0.7376513 0.7377241 0.7377966 [239] 0.7378689 0.7379409 0.7380125 0.7380839 0.7381550 0.7382259 0.7382964 [246] 0.7383667 0.7384366 0.7385063 0.7385757 0.7386448 0.7387136 0.7387822 [253] 0.7388505 0.7389184 0.7389861 0.7390535 0.7391206 0.7391875 0.7392540 [260] 0.7393203 0.7393863 0.7394520 0.7395174 0.7395825 0.7396474 0.7397120 [267] 0.7397762 0.7398402 0.7399039 0.7399674 0.7400305 0.7400934 0.7401560 [274] 0.7402183 0.7402803 0.7403420 0.7404035 0.7404647 0.7405255 0.7405862 [281] 0.7406465 0.7407065 0.7407663 0.7408258 0.7408850 0.7409439 0.7410025 [288] 0.7410609 0.7411189 0.7411767 0.7412342 0.7412915 0.7413484 0.7414051 [295] 0.7414615 0.7415176 0.7415734 0.7416290 0.7416842 0.7417392 0.7417939 [302] 0.7418483 0.7419025 0.7419564 0.7420100 0.7420633 0.7421163 0.7421691 [309] 0.7422215 0.7422737 0.7423257 0.7423773 0.7424287 0.7424798 0.7425306 [316] 0.7425811 0.7426314 0.7426813 0.7427310 0.7427805 0.7428296 0.7428785 [323] 0.7429271 0.7429754 0.7430234 0.7430712 0.7431187 0.7431659 0.7432129 [330] 0.7432595 0.7433059 0.7433520 0.7433979 0.7434435 0.7434887 0.7435338 [337] 0.7435785 0.7436230 0.7436672 0.7437111 0.7437548 0.7437981 0.7438412 [344] 0.7438841 0.7439266 0.7439689 0.7440109 0.7440527 0.7440942 0.7441354 [351] 0.7441763 0.7442170 0.7442573 0.7442975 0.7443373 0.7443769 0.7444162 [358] 0.7444552 0.7444940 0.7445325 0.7445707 0.7446087 0.7446464 0.7446838 [365] 0.7447209 0.7447578 0.7447945 0.7448308 0.7448669 0.7449027 0.7449382 [372] 0.7449735 0.7450085 0.7450433 0.7450778 0.7451120 0.7451459 0.7451796 [379] 0.7452130 0.7452462 0.7452790 0.7453117 0.7453440 0.7453761 0.7454079 [386] 0.7454395 0.7454708 0.7455018 0.7455326 0.7455631 0.7455934 0.7456234 [393] 0.7456531 0.7456825 0.7457117 0.7457407 0.7457693 0.7457978 0.7458259 [400] 0.7458538 0.7458814 > mx [1] 0.7458814 > 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/16u9z1226406565.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/2dwfk1226406565.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/367ls1226406565.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/4nhri1226406565.tab") > > system("convert tmp/16u9z1226406565.ps tmp/16u9z1226406565.png") > system("convert tmp/2dwfk1226406565.ps tmp/2dwfk1226406565.png") > system("convert tmp/367ls1226406565.ps tmp/367ls1226406565.png") > > > proc.time() user system elapsed 1.072 0.537 1.199