R version 2.8.1 (2008-12-22) 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(6.9,6.8,6.7,6.6,6.5,6.5,7.0,7.5,7.6,7.6,7.6,7.8,8.0,8.0,8.0,7.9,7.9,8.0,8.5,9.2,9.4,9.5,9.5,9.6,9.7,9.7,9.6,9.5,9.4,9.3,9.6,10.2,10.2,10.1,9.9,9.8,9.8,9.7,9.5,9.3,9.1,9.0,9.5,10.0,10.2,10.1,10.0,9.9,10.0,9.9,9.7,9.5,9.2,9.0,9.3,9.8,9.8,9.6,9.4,9.3,9.2,9.2,9.0,8.8,8.7,8.7,9.1,9.7,9.8,9.6,9.4,9.4,9.5,9.4,9.3,9.2,9.0,8.9,9.2,9.8,9.9,9.6,9.2,9.1,9.1,9.0,8.9,8.7,8.5,8.3,8.5,8.7,8.4,8.1,7.8,7.7,7.5,7.2,6.8,6.7,6.4,6.3,6.8,7.3,7.1,7.0,6.8,6.6,6.3,6.1,6.1,6.3,6.3,6.0,6.2,6.4,6.8,7.5,7.5,7.6,7.6,7.4,7.3,7.1,6.9,6.8,7.5,7.6,7.8,8.0,8.1,8.2,8.3,8.2,8.0,7.9,7.6,7.6,8.3,8.4,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.0,8.2,8.1,8.1,8.0,7.9,7.9) > x <- c(2.28,2.26,2.71,2.77,2.77,2.64,2.56,2.07,2.32,2.16,2.23,2.40,2.84,2.77,2.93,2.91,2.69,2.38,2.58,3.19,2.82,2.72,2.53,2.70,2.42,2.50,2.31,2.41,2.56,2.76,2.71,2.44,2.46,2.12,1.99,1.86,1.88,1.82,1.74,1.71,1.38,1.27,1.19,1.28,1.19,1.22,1.47,1.46,1.96,1.88,2.03,2.04,1.90,1.80,1.92,1.92,1.97,2.46,2.36,2.53,2.31,1.98,1.46,1.26,1.58,1.74,1.89,1.85,1.62,1.30,1.42,1.15,0.42,0.74,1.02,1.51,1.86,1.59,1.03,0.44,0.82,0.86,0.58,0.59,0.95,0.98,1.23,1.17,0.84,0.74,0.65,0.91,1.19,1.30,1.53,1.94,1.79,1.95,2.26,2.04,2.16,2.75,2.79,2.88,3.36,2.97,3.10,2.49,2.20,2.25,2.09,2.79,3.14,2.93,2.65,2.67,2.26,2.35,2.13,2.18,2.90,2.63,2.67,1.81,1.33,0.88,1.28,1.26,1.26,1.29,1.10,1.37,1.21,1.74,1.76,1.48,1.04,1.62,1.49,1.79,1.80,1.58,1.86,1.74,1.59,1.26,1.13,1.92,2.61,2.26,2.41,2.26,2.03,2.86,2.55,2.27,2.26,2.57,3.07,2.76,2.51,2.87,3.14,3.11,3.16,2.47,2.57,2.89,2.63,2.38,1.69,1.96,2.19,1.87,1.6,1.63,1.22,1.21,1.49,1.64) > #'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.2220800 -0.2225407 -0.2230024 -0.2234650 -0.2239284 -0.2243928 [7] -0.2248580 -0.2253240 -0.2257908 -0.2262584 -0.2267268 -0.2271959 [13] -0.2276658 -0.2281364 -0.2286076 -0.2290795 -0.2295520 -0.2300252 [19] -0.2304989 -0.2309732 -0.2314480 -0.2319234 -0.2323992 -0.2328756 [25] -0.2333523 -0.2338295 -0.2343071 -0.2347851 -0.2352634 -0.2357421 [31] -0.2362210 -0.2367003 -0.2371797 -0.2376594 -0.2381393 -0.2386194 [37] -0.2390996 -0.2395799 -0.2400603 -0.2405408 -0.2410213 -0.2415019 [43] -0.2419824 -0.2424629 -0.2429433 -0.2434236 -0.2439038 -0.2443839 [49] -0.2448638 -0.2453435 -0.2458229 -0.2463021 -0.2467810 -0.2472596 [55] -0.2477379 -0.2482158 -0.2486933 -0.2491704 -0.2496470 -0.2501232 [61] -0.2505988 -0.2510740 -0.2515485 -0.2520225 -0.2524959 -0.2529686 [67] -0.2534407 -0.2539121 -0.2543828 -0.2548527 -0.2553219 -0.2557902 [73] -0.2562578 -0.2567244 -0.2571903 -0.2576552 -0.2581191 -0.2585822 [79] -0.2590442 -0.2595053 -0.2599653 -0.2604243 -0.2608821 -0.2613389 [85] -0.2617946 -0.2622491 -0.2627024 -0.2631545 -0.2636055 -0.2640551 [91] -0.2645035 -0.2649506 -0.2653964 -0.2658409 -0.2662839 -0.2667257 [97] -0.2671660 -0.2676048 -0.2680423 -0.2684783 -0.2689128 -0.2693457 [103] -0.2697772 -0.2702071 -0.2706354 -0.2710622 -0.2714874 -0.2719109 [109] -0.2723328 -0.2727530 -0.2731716 -0.2735885 -0.2740036 -0.2744171 [115] -0.2748288 -0.2752387 -0.2756469 -0.2760533 -0.2764578 -0.2768606 [121] -0.2772615 -0.2776606 -0.2780578 -0.2784532 -0.2788466 -0.2792382 [127] -0.2796278 -0.2800156 -0.2804014 -0.2807852 -0.2811671 -0.2815471 [133] -0.2819250 -0.2823010 -0.2826749 -0.2830469 -0.2834169 -0.2837848 [139] -0.2841507 -0.2845146 -0.2848764 -0.2852361 -0.2855938 -0.2859495 [145] -0.2863030 -0.2866545 -0.2870039 -0.2873512 -0.2876965 -0.2880396 [151] -0.2883806 -0.2887195 -0.2890563 -0.2893910 -0.2897236 -0.2900540 [157] -0.2903824 -0.2907086 -0.2910326 -0.2913546 -0.2916744 -0.2919921 [163] -0.2923076 -0.2926211 -0.2929324 -0.2932415 -0.2935486 -0.2938535 [169] -0.2941562 -0.2944569 -0.2947554 -0.2950518 -0.2953460 -0.2956381 [175] -0.2959282 -0.2962161 -0.2965018 -0.2967855 -0.2970671 -0.2973465 [181] -0.2976238 -0.2978991 -0.2981722 -0.2984433 -0.2987123 -0.2989791 [187] -0.2992440 -0.2995067 -0.2997673 -0.3000259 -0.3002825 -0.3005370 [193] -0.3007894 -0.3010398 -0.3012882 -0.3015345 -0.3017788 -0.3020211 [199] -0.3022614 -0.3024996 -0.3027359 -0.3029702 -0.3032025 -0.3034328 [205] -0.3036611 -0.3038875 -0.3041119 -0.3043344 -0.3045549 -0.3047735 [211] -0.3049902 -0.3052050 -0.3054178 -0.3056287 -0.3058378 -0.3060449 [217] -0.3062502 -0.3064536 -0.3066552 -0.3068548 -0.3070527 -0.3072487 [223] -0.3074429 -0.3076352 -0.3078258 -0.3080145 -0.3082014 -0.3083866 [229] -0.3085700 -0.3087516 -0.3089314 -0.3091095 -0.3092859 -0.3094605 [235] -0.3096334 -0.3098045 -0.3099740 -0.3101418 -0.3103078 -0.3104722 [241] -0.3106349 -0.3107960 -0.3109554 -0.3111131 -0.3112692 -0.3114237 [247] -0.3115766 -0.3117278 -0.3118775 -0.3120255 -0.3121720 -0.3123169 [253] -0.3124602 -0.3126019 -0.3127422 -0.3128808 -0.3130180 -0.3131536 [259] -0.3132877 -0.3134202 -0.3135513 -0.3136809 -0.3138090 -0.3139357 [265] -0.3140608 -0.3141845 -0.3143068 -0.3144276 -0.3145470 -0.3146650 [271] -0.3147815 -0.3148967 -0.3150104 -0.3151228 -0.3152337 -0.3153433 [277] -0.3154515 -0.3155584 -0.3156639 -0.3157681 -0.3158709 -0.3159724 [283] -0.3160725 -0.3161714 -0.3162690 -0.3163652 -0.3164602 -0.3165539 [289] -0.3166463 -0.3167374 -0.3168273 -0.3169159 -0.3170033 -0.3170894 [295] -0.3171743 -0.3172580 -0.3173404 -0.3174217 -0.3175017 -0.3175806 [301] -0.3176582 -0.3177347 -0.3178100 -0.3178841 -0.3179571 -0.3180289 [307] -0.3180995 -0.3181690 -0.3182374 -0.3183046 -0.3183707 -0.3184357 [313] -0.3184996 -0.3185623 -0.3186240 -0.3186846 -0.3187441 -0.3188025 [319] -0.3188598 -0.3189161 -0.3189712 -0.3190254 -0.3190785 -0.3191305 [325] -0.3191815 -0.3192315 -0.3192804 -0.3193283 -0.3193752 -0.3194211 [331] -0.3194659 -0.3195098 -0.3195527 -0.3195946 -0.3196355 -0.3196754 [337] -0.3197143 -0.3197523 -0.3197893 -0.3198253 -0.3198604 -0.3198946 [343] -0.3199278 -0.3199600 -0.3199913 -0.3200217 -0.3200512 -0.3200797 [349] -0.3201074 -0.3201341 -0.3201599 -0.3201848 -0.3202088 -0.3202319 [355] -0.3202542 -0.3202755 -0.3202960 -0.3203156 -0.3203343 -0.3203522 [361] -0.3203692 -0.3203853 -0.3204006 -0.3204150 -0.3204286 -0.3204414 [367] -0.3204533 -0.3204644 -0.3204747 -0.3204841 -0.3204927 -0.3205005 [373] -0.3205075 -0.3205137 -0.3205191 -0.3205236 -0.3205274 -0.3205304 [379] -0.3205326 -0.3205340 -0.3205347 -0.3205345 -0.3205336 -0.3205319 [385] -0.3205295 -0.3205263 -0.3205223 -0.3205176 -0.3205121 -0.3205059 [391] -0.3204989 -0.3204912 -0.3204827 -0.3204736 -0.3204636 -0.3204530 [397] -0.3204416 -0.3204295 -0.3204167 -0.3204032 -0.3203890 > mx [1] 0.3205347 > mxli [1] 1.8 > 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/rcomp/tmp/1f0xu1257678041.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/rcomp/tmp/21e351257678041.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/rcomp/tmp/38umy1257678041.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/4ix8a1257678041.tab") > > system("convert tmp/1f0xu1257678041.ps tmp/1f0xu1257678041.png") > system("convert tmp/21e351257678041.ps tmp/21e351257678041.png") > system("convert tmp/38umy1257678041.ps tmp/38umy1257678041.png") > > > proc.time() user system elapsed 0.990 0.780 1.665