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(101.26,101.08,100.00,98.02,96.76,97.84,107.03,110.09,110.45,110.09,107.03,107.21,106.49,106.13,105.23,103.24,102.16,102.52,111.89,113.33,113.15,110.27,107.21,107.57,106.85,106.31,104.50,103.42,103.24,103.24,111.71,112.79,111.71,105.95,101.98,100.36,101.08,98.92,95.86,94.77,92.07,89.91,100.00,101.80,97.66,94.95,91.89,92.61,93.15,91.53,88.83,88.29,84.50,86.13,95.14,96.22,93.33,91.17,90.45,92.97) > x <- c(77.21,81.52,100.00,87.41,64.23,71.41,51.22,48.64,55.06,63.65,54.83,40.83,83.69,74.18,85.44,79.01,67.92,80.67,53.28,54.31,57.99,60.25,58.05,34.12,95.26,89.41,106.63,83.90,83.21,75.88,58.09,54.10,57.26,67.79,56.72,34.51,91.31,80.10,97.17,78.26,77.23,82.16,65.17,55.56,59.97,75.42,59.51,38.84,93.18,91.74,93.80,101.36,79.60,83.25,64.49,54.04,62.03,70.43,49.78,35.72) > #'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.1809354 -0.1814655 -0.1819956 -0.1825258 -0.1830561 -0.1835865 [7] -0.1841169 -0.1846473 -0.1851777 -0.1857081 -0.1862386 -0.1867690 [13] -0.1872995 -0.1878298 -0.1883602 -0.1888905 -0.1894207 -0.1899508 [19] -0.1904809 -0.1910109 -0.1915407 -0.1920705 -0.1926001 -0.1931296 [25] -0.1936589 -0.1941880 -0.1947170 -0.1952458 -0.1957744 -0.1963028 [31] -0.1968310 -0.1973589 -0.1978866 -0.1984141 -0.1989413 -0.1994682 [37] -0.1999948 -0.2005211 -0.2010472 -0.2015729 -0.2020982 -0.2026233 [43] -0.2031479 -0.2036723 -0.2041962 -0.2047197 -0.2052429 -0.2057656 [49] -0.2062880 -0.2068099 -0.2073313 -0.2078523 -0.2083728 -0.2088929 [55] -0.2094124 -0.2099315 -0.2104501 -0.2109681 -0.2114856 -0.2120025 [61] -0.2125189 -0.2130348 -0.2135500 -0.2140647 -0.2145787 -0.2150922 [67] -0.2156050 -0.2161172 -0.2166288 -0.2171397 -0.2176499 -0.2181594 [73] -0.2186683 -0.2191765 -0.2196839 -0.2201906 -0.2206966 -0.2212019 [79] -0.2217063 -0.2222101 -0.2227130 -0.2232152 -0.2237165 -0.2242171 [85] -0.2247168 -0.2252157 -0.2257138 -0.2262110 -0.2267073 -0.2272028 [91] -0.2276974 -0.2281911 -0.2286839 -0.2291758 -0.2296667 -0.2301567 [97] -0.2306458 -0.2311339 -0.2316210 -0.2321072 -0.2325924 -0.2330765 [103] -0.2335597 -0.2340419 -0.2345230 -0.2350031 -0.2354821 -0.2359601 [109] -0.2364370 -0.2369129 -0.2373876 -0.2378613 -0.2383338 -0.2388052 [115] -0.2392755 -0.2397447 -0.2402127 -0.2406796 -0.2411453 -0.2416099 [121] -0.2420732 -0.2425354 -0.2429963 -0.2434561 -0.2439146 -0.2443719 [127] -0.2448280 -0.2452829 -0.2457364 -0.2461888 -0.2466398 -0.2470896 [133] -0.2475380 -0.2479852 -0.2484311 -0.2488757 -0.2493189 -0.2497608 [139] -0.2502014 -0.2506406 -0.2510785 -0.2515150 -0.2519502 -0.2523840 [145] -0.2528164 -0.2532473 -0.2536769 -0.2541051 -0.2545319 -0.2549572 [151] -0.2553812 -0.2558036 -0.2562247 -0.2566443 -0.2570624 -0.2574791 [157] -0.2578942 -0.2583079 -0.2587202 -0.2591309 -0.2595401 -0.2599479 [163] -0.2603541 -0.2607588 -0.2611619 -0.2615636 -0.2619637 -0.2623622 [169] -0.2627592 -0.2631547 -0.2635486 -0.2639409 -0.2643316 -0.2647208 [175] -0.2651084 -0.2654944 -0.2658788 -0.2662615 -0.2666427 -0.2670223 [181] -0.2674003 -0.2677766 -0.2681513 -0.2685244 -0.2688958 -0.2692656 [187] -0.2696338 -0.2700003 -0.2703652 -0.2707283 -0.2710899 -0.2714497 [193] -0.2718079 -0.2721644 -0.2725193 -0.2728724 -0.2732239 -0.2735736 [199] -0.2739217 -0.2742680 -0.2746127 -0.2749557 -0.2752969 -0.2756364 [205] -0.2759742 -0.2763103 -0.2766447 -0.2769773 -0.2773083 -0.2776374 [211] -0.2779649 -0.2782906 -0.2786145 -0.2789367 -0.2792572 -0.2795759 [217] -0.2798929 -0.2802081 -0.2805216 -0.2808333 -0.2811432 -0.2814514 [223] -0.2817578 -0.2820624 -0.2823653 -0.2826664 -0.2829657 -0.2832633 [229] -0.2835591 -0.2838531 -0.2841453 -0.2844357 -0.2847244 -0.2850113 [235] -0.2852964 -0.2855797 -0.2858612 -0.2861410 -0.2864189 -0.2866951 [241] -0.2869694 -0.2872420 -0.2875128 -0.2877818 -0.2880490 -0.2883145 [247] -0.2885781 -0.2888399 -0.2890999 -0.2893582 -0.2896146 -0.2898693 [253] -0.2901222 -0.2903732 -0.2906225 -0.2908700 -0.2911157 -0.2913596 [259] -0.2916017 -0.2918420 -0.2920805 -0.2923173 -0.2925522 -0.2927854 [265] -0.2930167 -0.2932463 -0.2934741 -0.2937001 -0.2939243 -0.2941467 [271] -0.2943674 -0.2945862 -0.2948033 -0.2950186 -0.2952321 -0.2954439 [277] -0.2956539 -0.2958621 -0.2960685 -0.2962731 -0.2964760 -0.2966771 [283] -0.2968765 -0.2970741 -0.2972699 -0.2974639 -0.2976562 -0.2978468 [289] -0.2980355 -0.2982226 -0.2984078 -0.2985914 -0.2987732 -0.2989532 [295] -0.2991315 -0.2993080 -0.2994828 -0.2996559 -0.2998273 -0.2999969 [301] -0.3001647 -0.3003309 -0.3004953 -0.3006580 -0.3008190 -0.3009783 [307] -0.3011359 -0.3012917 -0.3014459 -0.3015983 -0.3017490 -0.3018981 [313] -0.3020454 -0.3021911 -0.3023350 -0.3024773 -0.3026179 -0.3027568 [319] -0.3028940 -0.3030296 -0.3031635 -0.3032957 -0.3034263 -0.3035552 [325] -0.3036824 -0.3038080 -0.3039319 -0.3040542 -0.3041748 -0.3042938 [331] -0.3044112 -0.3045269 -0.3046410 -0.3047535 -0.3048643 -0.3049735 [337] -0.3050812 -0.3051872 -0.3052916 -0.3053943 -0.3054955 -0.3055951 [343] -0.3056931 -0.3057895 -0.3058844 -0.3059776 -0.3060693 -0.3061594 [349] -0.3062479 -0.3063349 -0.3064203 -0.3065041 -0.3065864 -0.3066671 [355] -0.3067463 -0.3068240 -0.3069001 -0.3069747 -0.3070478 -0.3071193 [361] -0.3071893 -0.3072578 -0.3073248 -0.3073903 -0.3074542 -0.3075167 [367] -0.3075777 -0.3076372 -0.3076952 -0.3077517 -0.3078068 -0.3078604 [373] -0.3079125 -0.3079631 -0.3080123 -0.3080600 -0.3081063 -0.3081512 [379] -0.3081946 -0.3082365 -0.3082770 -0.3083161 -0.3083538 -0.3083901 [385] -0.3084249 -0.3084583 -0.3084904 -0.3085210 -0.3085502 -0.3085780 [391] -0.3086045 -0.3086296 -0.3086532 -0.3086756 -0.3086965 -0.3087161 [397] -0.3087343 -0.3087512 -0.3087667 -0.3087809 -0.3087937 > mx [1] 0.3087937 > 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/1514o1258230570.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/2ff6q1258230570.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/375fs1258230570.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/48css1258230570.tab") > > system("convert tmp/1514o1258230570.ps tmp/1514o1258230570.png") > system("convert tmp/2ff6q1258230570.ps tmp/2ff6q1258230570.png") > system("convert tmp/375fs1258230570.ps tmp/375fs1258230570.png") > > > proc.time() user system elapsed 0.799 0.498 0.931