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(1.2413,1.2758,1.2729,1.2695,1.2858,1.2741,1.2823,1.2588,1.2856,1.2619,1.2590,1.2865,1.2667,1.2505,1.2205,1.2220,1.1990,1.1583,1.1931,1.2028,1.1802,1.2084,1.1996,1.1870,1.2013,1.2120,1.2133,1.1866,1.2067,1.2240,1.2566,1.2608,1.3005,1.2955,1.2500,1.3158,1.3358,1.2817,1.2707,1.2595,1.3182,1.2665,1.2715,1.3041,1.3106,1.2911,1.2233,1.1438,0.9895,1.9903,0.9967,0.9708,0.9946,1.0441,1.0757,1.1461,1.1749,1.1926,1.2109) > x <- c(0.7461,0.7775,0.7790,0.7744,0.7905,0.7719,0.7811,0.7557,0.7637,0.7595,0.7471,0.7615,0.7487,0.7389,0.7337,0.7510,0.7382,0.7159,0.7542,0.7636,0.7433,0.7658,0.7627,0.7480,0.7692,0.7850,0.7913,0.7720,0.7880,0.8070,0.8268,0.8244,0.8487,0.8572,0.8214,0.8827,0.9216,0.8865,0.8816,0.8884,0.9466,0.9180,0.9337,0.9559,0.9626,0.9434,0.8639,0.7996,0.6680,0.6572,0.6928,0.6438,0.6454,0.6873,0.7265,0.7912,0.8114,0.8281,0.8393) > #'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.2564365 0.2564793 0.2565220 0.2565645 0.2566070 0.2566493 0.2566916 [8] 0.2567337 0.2567757 0.2568176 0.2568593 0.2569010 0.2569425 0.2569839 [15] 0.2570252 0.2570664 0.2571075 0.2571485 0.2571893 0.2572300 0.2572706 [22] 0.2573111 0.2573515 0.2573918 0.2574319 0.2574720 0.2575119 0.2575517 [29] 0.2575914 0.2576309 0.2576704 0.2577097 0.2577489 0.2577880 0.2578270 [36] 0.2578659 0.2579046 0.2579433 0.2579818 0.2580202 0.2580585 0.2580966 [43] 0.2581347 0.2581726 0.2582104 0.2582481 0.2582857 0.2583232 0.2583605 [50] 0.2583977 0.2584349 0.2584719 0.2585087 0.2585455 0.2585821 0.2586187 [57] 0.2586551 0.2586913 0.2587275 0.2587636 0.2587995 0.2588353 0.2588710 [64] 0.2589066 0.2589421 0.2589774 0.2590126 0.2590477 0.2590827 0.2591176 [71] 0.2591524 0.2591870 0.2592215 0.2592559 0.2592902 0.2593244 0.2593584 [78] 0.2593923 0.2594261 0.2594598 0.2594934 0.2595268 0.2595602 0.2595934 [85] 0.2596265 0.2596595 0.2596923 0.2597251 0.2597577 0.2597902 0.2598226 [92] 0.2598548 0.2598870 0.2599190 0.2599509 0.2599827 0.2600144 0.2600459 [99] 0.2600774 0.2601087 0.2601399 0.2601710 0.2602019 0.2602328 0.2602635 [106] 0.2602941 0.2603246 0.2603550 0.2603852 0.2604153 0.2604453 0.2604752 [113] 0.2605050 0.2605347 0.2605642 0.2605936 0.2606229 0.2606521 0.2606812 [120] 0.2607101 0.2607389 0.2607676 0.2607962 0.2608247 0.2608530 0.2608812 [127] 0.2609094 0.2609374 0.2609652 0.2609930 0.2610206 0.2610481 0.2610755 [134] 0.2611028 0.2611300 0.2611570 0.2611839 0.2612107 0.2612374 0.2612640 [141] 0.2612904 0.2613168 0.2613430 0.2613691 0.2613951 0.2614209 0.2614467 [148] 0.2614723 0.2614978 0.2615232 0.2615484 0.2615736 0.2615986 0.2616235 [155] 0.2616483 0.2616730 0.2616975 0.2617220 0.2617463 0.2617705 0.2617946 [162] 0.2618186 0.2618424 0.2618661 0.2618898 0.2619132 0.2619366 0.2619599 [169] 0.2619830 0.2620061 0.2620290 0.2620518 0.2620744 0.2620970 0.2621194 [176] 0.2621417 0.2621639 0.2621860 0.2622080 0.2622298 0.2622516 0.2622732 [183] 0.2622947 0.2623161 0.2623373 0.2623585 0.2623795 0.2624004 0.2624212 [190] 0.2624419 0.2624625 0.2624829 0.2625033 0.2625235 0.2625436 0.2625636 [197] 0.2625834 0.2626032 0.2626228 0.2626423 0.2626617 0.2626810 0.2627002 [204] 0.2627193 0.2627382 0.2627570 0.2627757 0.2627943 0.2628128 0.2628311 [211] 0.2628494 0.2628675 0.2628855 0.2629034 0.2629212 0.2629389 0.2629564 [218] 0.2629739 0.2629912 0.2630084 0.2630255 0.2630425 0.2630593 0.2630761 [225] 0.2630927 0.2631092 0.2631257 0.2631419 0.2631581 0.2631742 0.2631901 [232] 0.2632060 0.2632217 0.2632373 0.2632528 0.2632682 0.2632834 0.2632986 [239] 0.2633136 0.2633286 0.2633434 0.2633581 0.2633727 0.2633871 0.2634015 [246] 0.2634158 0.2634299 0.2634439 0.2634578 0.2634716 0.2634853 0.2634989 [253] 0.2635123 0.2635257 0.2635389 0.2635521 0.2635651 0.2635780 0.2635908 [260] 0.2636034 0.2636160 0.2636285 0.2636408 0.2636530 0.2636652 0.2636772 [267] 0.2636891 0.2637009 0.2637125 0.2637241 0.2637356 0.2637469 0.2637581 [274] 0.2637693 0.2637803 0.2637912 0.2638020 0.2638127 0.2638233 0.2638337 [281] 0.2638441 0.2638543 0.2638645 0.2638745 0.2638844 0.2638942 0.2639039 [288] 0.2639135 0.2639230 0.2639324 0.2639416 0.2639508 0.2639599 0.2639688 [295] 0.2639776 0.2639864 0.2639950 0.2640035 0.2640119 0.2640202 0.2640284 [302] 0.2640364 0.2640444 0.2640523 0.2640600 0.2640677 0.2640752 0.2640827 [309] 0.2640900 0.2640972 0.2641044 0.2641114 0.2641183 0.2641251 0.2641318 [316] 0.2641384 0.2641449 0.2641512 0.2641575 0.2641637 0.2641697 0.2641757 [323] 0.2641815 0.2641873 0.2641929 0.2641985 0.2642039 0.2642092 0.2642145 [330] 0.2642196 0.2642246 0.2642295 0.2642343 0.2642390 0.2642436 0.2642481 [337] 0.2642525 0.2642568 0.2642610 0.2642651 0.2642691 0.2642730 0.2642768 [344] 0.2642804 0.2642840 0.2642875 0.2642909 0.2642941 0.2642973 0.2643004 [351] 0.2643033 0.2643062 0.2643090 0.2643116 0.2643142 0.2643167 0.2643190 [358] 0.2643213 0.2643234 0.2643255 0.2643274 0.2643293 0.2643311 0.2643327 [365] 0.2643343 0.2643357 0.2643371 0.2643384 0.2643395 0.2643406 0.2643416 [372] 0.2643424 0.2643432 0.2643439 0.2643444 0.2643449 0.2643453 0.2643456 [379] 0.2643457 0.2643458 0.2643458 0.2643457 0.2643455 0.2643452 0.2643448 [386] 0.2643443 0.2643437 0.2643430 0.2643422 0.2643413 0.2643403 0.2643393 [393] 0.2643381 0.2643368 0.2643355 0.2643340 0.2643324 0.2643308 0.2643290 [400] 0.2643272 0.2643253 > mx [1] 0.2643458 > mxli [1] 1.79 > 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/1blrv1257503783.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/205iq1257503783.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/324tu1257503783.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/4oo8n1257503783.tab") > > system("convert tmp/1blrv1257503783.ps tmp/1blrv1257503783.png") > system("convert tmp/205iq1257503783.ps tmp/205iq1257503783.png") > system("convert tmp/324tu1257503783.ps tmp/324tu1257503783.png") > > > proc.time() user system elapsed 1.255 0.826 1.452