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(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,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,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,8,7.7,7.3,7.4,8.1) > x <- c(96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6) > #'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.2481270 -0.2482040 -0.2482810 -0.2483580 -0.2484349 -0.2485118 [7] -0.2485886 -0.2486655 -0.2487422 -0.2488190 -0.2488957 -0.2489724 [13] -0.2490490 -0.2491256 -0.2492021 -0.2492787 -0.2493551 -0.2494316 [19] -0.2495080 -0.2495844 -0.2496607 -0.2497370 -0.2498132 -0.2498895 [25] -0.2499656 -0.2500418 -0.2501179 -0.2501939 -0.2502700 -0.2503459 [31] -0.2504219 -0.2504978 -0.2505737 -0.2506495 -0.2507253 -0.2508010 [37] -0.2508767 -0.2509524 -0.2510280 -0.2511036 -0.2511792 -0.2512547 [43] -0.2513302 -0.2514056 -0.2514810 -0.2515563 -0.2516316 -0.2517069 [49] -0.2517821 -0.2518573 -0.2519324 -0.2520075 -0.2520826 -0.2521576 [55] -0.2522326 -0.2523075 -0.2523824 -0.2524573 -0.2525321 -0.2526069 [61] -0.2526816 -0.2527563 -0.2528309 -0.2529055 -0.2529801 -0.2530546 [67] -0.2531291 -0.2532035 -0.2532779 -0.2533523 -0.2534266 -0.2535008 [73] -0.2535751 -0.2536492 -0.2537234 -0.2537975 -0.2538715 -0.2539455 [79] -0.2540195 -0.2540934 -0.2541673 -0.2542411 -0.2543149 -0.2543886 [85] -0.2544623 -0.2545360 -0.2546096 -0.2546831 -0.2547567 -0.2548301 [91] -0.2549036 -0.2549770 -0.2550503 -0.2551236 -0.2551968 -0.2552701 [97] -0.2553432 -0.2554163 -0.2554894 -0.2555624 -0.2556354 -0.2557084 [103] -0.2557813 -0.2558541 -0.2559269 -0.2559997 -0.2560724 -0.2561450 [109] -0.2562177 -0.2562902 -0.2563628 -0.2564352 -0.2565077 -0.2565801 [115] -0.2566524 -0.2567247 -0.2567970 -0.2568692 -0.2569413 -0.2570134 [121] -0.2570855 -0.2571575 -0.2572295 -0.2573014 -0.2573733 -0.2574451 [127] -0.2575169 -0.2575886 -0.2576603 -0.2577320 -0.2578035 -0.2578751 [133] -0.2579466 -0.2580180 -0.2580894 -0.2581608 -0.2582321 -0.2583034 [139] -0.2583746 -0.2584457 -0.2585169 -0.2585879 -0.2586589 -0.2587299 [145] -0.2588008 -0.2588717 -0.2589425 -0.2590133 -0.2590841 -0.2591547 [151] -0.2592254 -0.2592959 -0.2593665 -0.2594370 -0.2595074 -0.2595778 [157] -0.2596481 -0.2597184 -0.2597887 -0.2598589 -0.2599290 -0.2599991 [163] -0.2600691 -0.2601391 -0.2602091 -0.2602790 -0.2603488 -0.2604186 [169] -0.2604884 -0.2605581 -0.2606277 -0.2606973 -0.2607669 -0.2608364 [175] -0.2609058 -0.2609752 -0.2610445 -0.2611138 -0.2611831 -0.2612523 [181] -0.2613214 -0.2613905 -0.2614596 -0.2615286 -0.2615975 -0.2616664 [187] -0.2617353 -0.2618040 -0.2618728 -0.2619415 -0.2620101 -0.2620787 [193] -0.2621472 -0.2622157 -0.2622842 -0.2623526 -0.2624209 -0.2624892 [199] -0.2625574 -0.2626256 -0.2626937 -0.2627618 -0.2628298 -0.2628978 [205] -0.2629657 -0.2630336 -0.2631014 -0.2631692 -0.2632369 -0.2633046 [211] -0.2633722 -0.2634397 -0.2635072 -0.2635747 -0.2636421 -0.2637095 [217] -0.2637768 -0.2638440 -0.2639112 -0.2639784 -0.2640455 -0.2641125 [223] -0.2641795 -0.2642464 -0.2643133 -0.2643801 -0.2644469 -0.2645136 [229] -0.2645803 -0.2646469 -0.2647135 -0.2647800 -0.2648465 -0.2649129 [235] -0.2649793 -0.2650456 -0.2651118 -0.2651780 -0.2652442 -0.2653103 [241] -0.2653763 -0.2654423 -0.2655082 -0.2655741 -0.2656400 -0.2657057 [247] -0.2657715 -0.2658371 -0.2659027 -0.2659683 -0.2660338 -0.2660993 [253] -0.2661647 -0.2662300 -0.2662953 -0.2663606 -0.2664258 -0.2664909 [259] -0.2665560 -0.2666210 -0.2666860 -0.2667509 -0.2668158 -0.2668806 [265] -0.2669454 -0.2670101 -0.2670747 -0.2671393 -0.2672039 -0.2672684 [271] -0.2673328 -0.2673972 -0.2674615 -0.2675258 -0.2675900 -0.2676542 [277] -0.2677183 -0.2677824 -0.2678464 -0.2679103 -0.2679742 -0.2680381 [283] -0.2681018 -0.2681656 -0.2682293 -0.2682929 -0.2683565 -0.2684200 [289] -0.2684834 -0.2685469 -0.2686102 -0.2686735 -0.2687368 -0.2688000 [295] -0.2688631 -0.2689262 -0.2689892 -0.2690522 -0.2691151 -0.2691780 [301] -0.2692408 -0.2693035 -0.2693662 -0.2694289 -0.2694915 -0.2695540 [307] -0.2696165 -0.2696789 -0.2697413 -0.2698036 -0.2698659 -0.2699281 [313] -0.2699902 -0.2700523 -0.2701144 -0.2701764 -0.2702383 -0.2703002 [319] -0.2703620 -0.2704238 -0.2704855 -0.2705471 -0.2706087 -0.2706703 [325] -0.2707318 -0.2707932 -0.2708546 -0.2709159 -0.2709772 -0.2710384 [331] -0.2710996 -0.2711607 -0.2712217 -0.2712827 -0.2713437 -0.2714046 [337] -0.2714654 -0.2715262 -0.2715869 -0.2716476 -0.2717082 -0.2717687 [343] -0.2718292 -0.2718897 -0.2719501 -0.2720104 -0.2720707 -0.2721309 [349] -0.2721911 -0.2722512 -0.2723112 -0.2723712 -0.2724312 -0.2724911 [355] -0.2725509 -0.2726107 -0.2726704 -0.2727301 -0.2727897 -0.2728492 [361] -0.2729087 -0.2729682 -0.2730276 -0.2730869 -0.2731462 -0.2732054 [367] -0.2732646 -0.2733237 -0.2733828 -0.2734418 -0.2735007 -0.2735596 [373] -0.2736184 -0.2736772 -0.2737359 -0.2737946 -0.2738532 -0.2739118 [379] -0.2739703 -0.2740287 -0.2740871 -0.2741454 -0.2742037 -0.2742619 [385] -0.2743201 -0.2743782 -0.2744363 -0.2744943 -0.2745522 -0.2746101 [391] -0.2746679 -0.2747257 -0.2747834 -0.2748411 -0.2748987 -0.2749563 [397] -0.2750138 -0.2750712 -0.2751286 -0.2751859 -0.2752432 > mx [1] 0.2752432 > 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/1qmh11261054596.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/2h4b21261054596.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/388br1261054596.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/4wghs1261054596.tab") > > try(system("convert tmp/1qmh11261054596.ps tmp/1qmh11261054596.png",intern=TRUE)) character(0) > try(system("convert tmp/2h4b21261054596.ps tmp/2h4b21261054596.png",intern=TRUE)) character(0) > try(system("convert tmp/388br1261054596.ps tmp/388br1261054596.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.773 0.496 1.000