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(43.5,37.7,36.8,24.4,31.3,43.9,53.6,48.9,30.9,31.8,41.3,43.7,54.1,47.8,36.7,30.8,31.9,61.7,73,64.7,24.2,33.9,32.4,63.2,71.8,60.4,48,44.5,44.9,70.9,72.7,59.5,35.9,40,43.6,57.2,75.8,57.7,47.7,42.3,43,68,70.6,54.2,38.6,40.3,49.2,68.5,75.9,63.2,49.8,37,48.8,74.9,75.3,66.9,44.1,39.8,56.6,77.1,78.5,70.6,54.2,47.2,55.1,74.5,88,80.8,54.4,55.2,73.8,85.3,98.7,86.1,62.5,58.6,67,88.4,96.5,87.1,61.2,62.5,85.2,101.7,113.7) > x <- c(200.7,146.5,143.6,141.5,137.5,138.7,135.5,136.4,112.1,109,123.8,151.2,139.2,115.7,147.6,126.1,122.8,137.3,142,137.4,89.4,108,117.7,127.3,121,104.1,119.5,116.7,96.1,125,118.8,114.9,79.3,90.5,87.8,109.4,88.9,97.4,112,86.8,82.9,105.2,89.1,85.5,87.1,85.2,88.2,104,96.4,82.3,114.1,88.9,93.6,101.8,96.6,93.7,68.4,68.7,81.2,85.1,75.4,71.6,83,72.3,90.2,89,84.9,90.9,46.6,55.4,88.7,76,76.9,72.1,90,92.3,78,93.9,84.5,80.4,60.5,75.3,91.5,105.2,92.7) > #'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.1898831 -0.1904824 -0.1910814 -0.1916800 -0.1922782 -0.1928760 [7] -0.1934734 -0.1940703 -0.1946668 -0.1952629 -0.1958585 -0.1964536 [13] -0.1970482 -0.1976423 -0.1982359 -0.1988289 -0.1994214 -0.2000134 [19] -0.2006047 -0.2011955 -0.2017857 -0.2023753 -0.2029642 -0.2035526 [25] -0.2041402 -0.2047272 -0.2053136 -0.2058992 -0.2064842 -0.2070684 [31] -0.2076520 -0.2082348 -0.2088168 -0.2093981 -0.2099786 -0.2105584 [37] -0.2111373 -0.2117154 -0.2122928 -0.2128693 -0.2134449 -0.2140197 [43] -0.2145936 -0.2151667 -0.2157388 -0.2163101 -0.2168804 -0.2174499 [49] -0.2180184 -0.2185859 -0.2191525 -0.2197181 -0.2202828 -0.2208464 [55] -0.2214091 -0.2219707 -0.2225313 -0.2230909 -0.2236494 -0.2242069 [61] -0.2247633 -0.2253186 -0.2258729 -0.2264260 -0.2269781 -0.2275290 [67] -0.2280788 -0.2286274 -0.2291749 -0.2297213 -0.2302664 -0.2308104 [73] -0.2313532 -0.2318948 -0.2324352 -0.2329744 -0.2335123 -0.2340490 [79] -0.2345845 -0.2351187 -0.2356516 -0.2361832 -0.2367136 -0.2372427 [85] -0.2377705 -0.2382969 -0.2388220 -0.2393458 -0.2398683 -0.2403894 [91] -0.2409092 -0.2414276 -0.2419446 -0.2424602 -0.2429745 -0.2434873 [97] -0.2439988 -0.2445088 -0.2450174 -0.2455246 -0.2460303 -0.2465346 [103] -0.2470374 -0.2475388 -0.2480387 -0.2485371 -0.2490340 -0.2495294 [109] -0.2500234 -0.2505158 -0.2510067 -0.2514961 -0.2519840 -0.2524703 [115] -0.2529551 -0.2534383 -0.2539200 -0.2544001 -0.2548786 -0.2553556 [121] -0.2558310 -0.2563048 -0.2567770 -0.2572476 -0.2577165 -0.2581839 [127] -0.2586496 -0.2591138 -0.2595762 -0.2600371 -0.2604963 -0.2609538 [133] -0.2614097 -0.2618640 -0.2623165 -0.2627674 -0.2632166 -0.2636641 [139] -0.2641100 -0.2645541 -0.2649966 -0.2654373 -0.2658763 -0.2663136 [145] -0.2667492 -0.2671831 -0.2676152 -0.2680456 -0.2684743 -0.2689012 [151] -0.2693264 -0.2697498 -0.2701714 -0.2705913 -0.2710095 -0.2714258 [157] -0.2718404 -0.2722532 -0.2726642 -0.2730735 -0.2734809 -0.2738866 [163] -0.2742904 -0.2746925 -0.2750927 -0.2754912 -0.2758878 -0.2762826 [169] -0.2766756 -0.2770667 -0.2774560 -0.2778435 -0.2782292 -0.2786130 [175] -0.2789950 -0.2793752 -0.2797535 -0.2801299 -0.2805045 -0.2808772 [181] -0.2812481 -0.2816171 -0.2819843 -0.2823495 -0.2827129 -0.2830745 [187] -0.2834341 -0.2837919 -0.2841478 -0.2845018 -0.2848540 -0.2852042 [193] -0.2855526 -0.2858990 -0.2862436 -0.2865862 -0.2869270 -0.2872659 [199] -0.2876028 -0.2879379 -0.2882710 -0.2886022 -0.2889315 -0.2892589 [205] -0.2895844 -0.2899080 -0.2902296 -0.2905493 -0.2908671 -0.2911830 [211] -0.2914969 -0.2918089 -0.2921190 -0.2924272 -0.2927334 -0.2930376 [217] -0.2933400 -0.2936404 -0.2939388 -0.2942353 -0.2945299 -0.2948225 [223] -0.2951132 -0.2954020 -0.2956887 -0.2959736 -0.2962564 -0.2965374 [229] -0.2968163 -0.2970934 -0.2973684 -0.2976415 -0.2979127 -0.2981819 [235] -0.2984491 -0.2987143 -0.2989776 -0.2992390 -0.2994984 -0.2997558 [241] -0.3000112 -0.3002647 -0.3005162 -0.3007657 -0.3010133 -0.3012589 [247] -0.3015025 -0.3017441 -0.3019838 -0.3022215 -0.3024573 -0.3026910 [253] -0.3029228 -0.3031526 -0.3033804 -0.3036063 -0.3038301 -0.3040520 [259] -0.3042719 -0.3044899 -0.3047058 -0.3049198 -0.3051318 -0.3053418 [265] -0.3055498 -0.3057558 -0.3059599 -0.3061620 -0.3063621 -0.3065602 [271] -0.3067563 -0.3069504 -0.3071426 -0.3073327 -0.3075209 -0.3077071 [277] -0.3078913 -0.3080735 -0.3082538 -0.3084320 -0.3086083 -0.3087825 [283] -0.3089548 -0.3091251 -0.3092934 -0.3094597 -0.3096241 -0.3097864 [289] -0.3099467 -0.3101051 -0.3102615 -0.3104159 -0.3105683 -0.3107187 [295] -0.3108671 -0.3110135 -0.3111579 -0.3113004 -0.3114409 -0.3115793 [301] -0.3117158 -0.3118503 -0.3119828 -0.3121133 -0.3122418 -0.3123684 [307] -0.3124929 -0.3126155 -0.3127361 -0.3128547 -0.3129713 -0.3130859 [313] -0.3131985 -0.3133091 -0.3134178 -0.3135244 -0.3136291 -0.3137318 [319] -0.3138325 -0.3139312 -0.3140280 -0.3141227 -0.3142155 -0.3143062 [325] -0.3143950 -0.3144818 -0.3145667 -0.3146495 -0.3147304 -0.3148093 [331] -0.3148862 -0.3149611 -0.3150340 -0.3151050 -0.3151740 -0.3152410 [337] -0.3153060 -0.3153690 -0.3154301 -0.3154892 -0.3155463 -0.3156015 [343] -0.3156546 -0.3157058 -0.3157550 -0.3158023 -0.3158476 -0.3158909 [349] -0.3159322 -0.3159716 -0.3160090 -0.3160444 -0.3160779 -0.3161094 [355] -0.3161389 -0.3161665 -0.3161921 -0.3162157 -0.3162374 -0.3162571 [361] -0.3162749 -0.3162907 -0.3163045 -0.3163164 -0.3163263 -0.3163343 [367] -0.3163403 -0.3163444 -0.3163465 -0.3163467 -0.3163449 -0.3163412 [373] -0.3163355 -0.3163279 -0.3163184 -0.3163069 -0.3162934 -0.3162780 [379] -0.3162607 -0.3162415 -0.3162203 -0.3161972 -0.3161721 -0.3161452 [385] -0.3161162 -0.3160854 -0.3160526 -0.3160180 -0.3159814 -0.3159428 [391] -0.3159024 -0.3158600 -0.3158158 -0.3157696 -0.3157215 -0.3156715 [397] -0.3156195 -0.3155657 -0.3155100 -0.3154524 -0.3153929 > mx [1] 0.3163467 > mxli [1] 1.69 > 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/1215d1226569862.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/2yx1t1226569862.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/3avwq1226569862.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/4byqv1226569862.tab") > > system("convert tmp/1215d1226569862.ps tmp/1215d1226569862.png") > system("convert tmp/2yx1t1226569862.ps tmp/2yx1t1226569862.png") > system("convert tmp/3avwq1226569862.ps tmp/3avwq1226569862.png") > > > proc.time() user system elapsed 1.028 0.532 1.167