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(100.00,96.67,91.06,89.04,82.91,84.05,91.76,90.10,85.98,99.82,70.90,83.87,99.21,92.81,95.35,89.66,86.77,88.26,101.23,88.26,96.32,100.44,74.85,88.08,100.61,102.10,98.95,89.40,92.90,92.29,104.12,92.99,95.79,102.72,81.07,91.32,98.60,107.27,99.30,87.64,97.02,98.86,96.23,102.80,95.62,101.58,84.14,87.47,102.37,101.40,87.12,82.65,79.75,81.68,90.36,82.47,80.46,90.01,72.39,78.09) > x <- c(100.00,111.86,94.12,67.79,146.04,125.66,142.87,130.03,110.01,132.79,88.24,91.97,96.65,97.15,90.73,52.53,156.91,144.88,169.43,133.38,131.28,116.33,89.15,85.08,89.39,103.09,85.35,45.99,152.82,130.37,150.50,126.97,123.24,126.57,100.26,91.76,100.28,121.65,97.29,62.55,154.99,147.85,147.40,156.80,126.81,131.76,99.21,87.35,100.76,110.57,76.46,56.51,124.95,118.29,136.43,128.62,100.74,111.75,93.43,83.33) > #'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.2377631 0.2381843 0.2386051 0.2390257 0.2394459 0.2398658 0.2402853 [8] 0.2407044 0.2411232 0.2415415 0.2419595 0.2423770 0.2427941 0.2432108 [15] 0.2436271 0.2440428 0.2444581 0.2448729 0.2452873 0.2457011 0.2461144 [22] 0.2465272 0.2469394 0.2473511 0.2477622 0.2481728 0.2485828 0.2489922 [29] 0.2494010 0.2498092 0.2502167 0.2506236 0.2510299 0.2514355 0.2518404 [36] 0.2522447 0.2526483 0.2530511 0.2534533 0.2538547 0.2542554 0.2546554 [43] 0.2550546 0.2554530 0.2558506 0.2562475 0.2566436 0.2570388 0.2574332 [50] 0.2578268 0.2582196 0.2586115 0.2590025 0.2593926 0.2597819 0.2601703 [57] 0.2605578 0.2609443 0.2613299 0.2617146 0.2620983 0.2624811 0.2628629 [64] 0.2632437 0.2636236 0.2640024 0.2643802 0.2647571 0.2651328 0.2655076 [71] 0.2658813 0.2662539 0.2666254 0.2669959 0.2673653 0.2677336 0.2681008 [78] 0.2684669 0.2688318 0.2691956 0.2695583 0.2699198 0.2702801 0.2706393 [85] 0.2709972 0.2713540 0.2717096 0.2720640 0.2724172 0.2727691 0.2731198 [92] 0.2734693 0.2738175 0.2741644 0.2745101 0.2748545 0.2751976 0.2755394 [99] 0.2758799 0.2762191 0.2765570 0.2768935 0.2772288 0.2775627 0.2778952 [106] 0.2782264 0.2785562 0.2788846 0.2792117 0.2795374 0.2798616 0.2801845 [113] 0.2805060 0.2808261 0.2811447 0.2814620 0.2817777 0.2820921 0.2824050 [120] 0.2827164 0.2830264 0.2833350 0.2836420 0.2839476 0.2842517 0.2845543 [127] 0.2848554 0.2851551 0.2854532 0.2857498 0.2860449 0.2863385 0.2866305 [134] 0.2869210 0.2872100 0.2874975 0.2877834 0.2880677 0.2883505 0.2886318 [141] 0.2889115 0.2891896 0.2894662 0.2897412 0.2900146 0.2902864 0.2905566 [148] 0.2908253 0.2910924 0.2913578 0.2916217 0.2918840 0.2921447 0.2924037 [155] 0.2926612 0.2929171 0.2931713 0.2934239 0.2936749 0.2939243 0.2941721 [162] 0.2944182 0.2946627 0.2949056 0.2951469 0.2953865 0.2956245 0.2958608 [169] 0.2960955 0.2963286 0.2965600 0.2967898 0.2970180 0.2972445 0.2974694 [176] 0.2976926 0.2979142 0.2981342 0.2983525 0.2985691 0.2987842 0.2989975 [183] 0.2992093 0.2994194 0.2996278 0.2998346 0.3000397 0.3002433 0.3004451 [190] 0.3006453 0.3008439 0.3010409 0.3012362 0.3014299 0.3016219 0.3018123 [197] 0.3020011 0.3021882 0.3023737 0.3025576 0.3027398 0.3029204 0.3030994 [204] 0.3032768 0.3034525 0.3036266 0.3037992 0.3039701 0.3041393 0.3043070 [211] 0.3044731 0.3046376 0.3048004 0.3049617 0.3051214 0.3052794 0.3054359 [218] 0.3055908 0.3057441 0.3058958 0.3060460 0.3061946 0.3063416 0.3064870 [225] 0.3066309 0.3067732 0.3069140 0.3070532 0.3071908 0.3073269 0.3074615 [232] 0.3075945 0.3077260 0.3078559 0.3079844 0.3081113 0.3082366 0.3083605 [239] 0.3084829 0.3086037 0.3087231 0.3088410 0.3089573 0.3090722 0.3091856 [246] 0.3092975 0.3094080 0.3095170 0.3096245 0.3097305 0.3098351 0.3099383 [253] 0.3100400 0.3101403 0.3102391 0.3103365 0.3104325 0.3105271 0.3106202 [260] 0.3107120 0.3108023 0.3108913 0.3109788 0.3110650 0.3111498 0.3112332 [267] 0.3113153 0.3113960 0.3114753 0.3115533 0.3116299 0.3117052 0.3117791 [274] 0.3118517 0.3119230 0.3119930 0.3120617 0.3121290 0.3121951 0.3122598 [281] 0.3123233 0.3123855 0.3124464 0.3125061 0.3125644 0.3126216 0.3126774 [288] 0.3127321 0.3127854 0.3128376 0.3128885 0.3129382 0.3129867 0.3130339 [295] 0.3130800 0.3131249 0.3131685 0.3132110 0.3132523 0.3132925 0.3133314 [302] 0.3133692 0.3134059 0.3134414 0.3134758 0.3135090 0.3135411 0.3135721 [309] 0.3136019 0.3136307 0.3136583 0.3136848 0.3137103 0.3137347 0.3137579 [316] 0.3137802 0.3138013 0.3138214 0.3138404 0.3138584 0.3138754 0.3138913 [323] 0.3139061 0.3139200 0.3139328 0.3139447 0.3139555 0.3139653 0.3139741 [330] 0.3139820 0.3139888 0.3139947 0.3139997 0.3140036 0.3140066 0.3140087 [337] 0.3140098 0.3140100 0.3140093 0.3140076 0.3140050 0.3140015 0.3139971 [344] 0.3139918 0.3139856 0.3139785 0.3139705 0.3139617 0.3139520 0.3139414 [351] 0.3139300 0.3139177 0.3139046 0.3138906 0.3138758 0.3138602 0.3138437 [358] 0.3138264 0.3138083 0.3137895 0.3137698 0.3137493 0.3137280 0.3137060 [365] 0.3136832 0.3136596 0.3136352 0.3136101 0.3135843 0.3135576 0.3135303 [372] 0.3135022 0.3134734 0.3134438 0.3134136 0.3133826 0.3133509 0.3133185 [379] 0.3132854 0.3132517 0.3132172 0.3131821 0.3131462 0.3131098 0.3130726 [386] 0.3130348 0.3129963 0.3129572 0.3129175 0.3128771 0.3128360 0.3127944 [393] 0.3127521 0.3127092 0.3126657 0.3126215 0.3125768 0.3125315 0.3124856 [400] 0.3124391 0.3123920 > mx [1] 0.31401 > mxli [1] 1.37 > 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/1f9yj1260968558.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/2if3d1260968558.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/3wp6u1260968558.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/4bd3o1260968558.tab") > > try(system("convert tmp/1f9yj1260968558.ps tmp/1f9yj1260968558.png",intern=TRUE)) character(0) > try(system("convert tmp/2if3d1260968558.ps tmp/2if3d1260968558.png",intern=TRUE)) character(0) > try(system("convert tmp/3wp6u1260968558.ps tmp/3wp6u1260968558.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.758 0.487 0.909