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(241.66,251.25,230.26,240.91,211.20,188.19,177.01,167.85,174.03,170.09,203.42,254.97,342.84,386.29,440.51,433.58,408.13,370.32,355.51,332.62,314.62,301.73,306.31,282.98,266.48,249.97,259.87,246.24,238.36,238.04,224.19,214.71,203.11,221.00,211.73,209.39,217.48,242.19,244.64,232.07,235.80,230.37,209.82,206.41,209.60,192.24,186.17,193.41,202.36,203.00,190.64,185.43,171.58,179.57,180.42,162.10,157.95,146.66,154.43,163.38,150.92,151.98,144.74,140.37,143.36,135.79,134.73,126.42,124.72,117.90,114.07,112.26,105.44,110.77,107.68,105.76,102.03,100.22,111.62,118.11,111.72,103.42,97.13,103.10,104.91,100.22,98.52,95.32,96.92,96.60,92.55,82.75,80.84,79.13,79.77,85.10,96.39,97.56,96.39,101.18,103.52,100.11,99.26,104.48,101.29,100.33,115.24,113.64,115.35,108.42,105.65,108.64,104.80,95.43,104.48,103.84,100.01) > x <- c(83.33,83.33,78.33,77.50,76.67,74.17,72.50,72.50,75.83,71.67,74.17,78.33,85.00,83.33,81.67,83.33,85.00,86.67,90.00,90.00,87.50,89.17,85.83,91.67,90.83,90.83,91.67,93.33,94.17,94.17,91.67,93.33,91.67,85.83,93.33,94.17,90.83,90.83,90.83,90.83,87.50,89.17,88.33,90.83,91.67,88.33,85.00,85.83,80.83,84.17,83.33,83.33,83.33,88.33,90.83,90.00,87.50,87.50,86.67,87.50,90.83,90.83,89.17,92.50,87.50,89.17,90.00,91.67,90.00,87.50,87.50,80.00,88.33,83.33,81.67,84.17,85.00,83.33,77.50,81.67,85.00,85.83,89.17,90.00,90.00,90.00,91.67,92.50,93.33,92.50,94.17,93.33,91.67,85.83,77.50,80.83,89.17,92.50,95.83,95.83,95.00,95.00,98.33,99.17,103.33,105.00,104.17,104.17,100.83,105.83,103.33,105.00,103.33,102.50,103.33,101.67,100.00) > #'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.2521351 -0.2522944 -0.2524535 -0.2526126 -0.2527716 -0.2529306 [7] -0.2530894 -0.2532482 -0.2534069 -0.2535655 -0.2537240 -0.2538825 [13] -0.2540409 -0.2541992 -0.2543574 -0.2545155 -0.2546735 -0.2548315 [19] -0.2549894 -0.2551472 -0.2553049 -0.2554625 -0.2556200 -0.2557775 [25] -0.2559349 -0.2560922 -0.2562494 -0.2564065 -0.2565635 -0.2567205 [31] -0.2568773 -0.2570341 -0.2571908 -0.2573474 -0.2575039 -0.2576603 [37] -0.2578166 -0.2579728 -0.2581290 -0.2582850 -0.2584410 -0.2585969 [43] -0.2587527 -0.2589084 -0.2590640 -0.2592195 -0.2593749 -0.2595302 [49] -0.2596855 -0.2598406 -0.2599956 -0.2601506 -0.2603054 -0.2604602 [55] -0.2606149 -0.2607695 -0.2609239 -0.2610783 -0.2612326 -0.2613868 [61] -0.2615409 -0.2616949 -0.2618488 -0.2620026 -0.2621563 -0.2623099 [67] -0.2624634 -0.2626168 -0.2627701 -0.2629233 -0.2630764 -0.2632295 [73] -0.2633824 -0.2635352 -0.2636879 -0.2638405 -0.2639930 -0.2641454 [79] -0.2642977 -0.2644499 -0.2646020 -0.2647540 -0.2649059 -0.2650577 [85] -0.2652093 -0.2653609 -0.2655124 -0.2656637 -0.2658150 -0.2659662 [91] -0.2661172 -0.2662682 -0.2664190 -0.2665697 -0.2667203 -0.2668709 [97] -0.2670213 -0.2671716 -0.2673218 -0.2674718 -0.2676218 -0.2677717 [103] -0.2679214 -0.2680711 -0.2682206 -0.2683700 -0.2685193 -0.2686685 [109] -0.2688176 -0.2689666 -0.2691155 -0.2692642 -0.2694129 -0.2695614 [115] -0.2697098 -0.2698581 -0.2700063 -0.2701544 -0.2703024 -0.2704502 [121] -0.2705979 -0.2707456 -0.2708931 -0.2710404 -0.2711877 -0.2713349 [127] -0.2714819 -0.2716288 -0.2717756 -0.2719223 -0.2720689 -0.2722153 [133] -0.2723617 -0.2725079 -0.2726540 -0.2728000 -0.2729458 -0.2730915 [139] -0.2732372 -0.2733827 -0.2735280 -0.2736733 -0.2738184 -0.2739634 [145] -0.2741083 -0.2742531 -0.2743978 -0.2745423 -0.2746867 -0.2748310 [151] -0.2749751 -0.2751191 -0.2752631 -0.2754068 -0.2755505 -0.2756940 [157] -0.2758375 -0.2759807 -0.2761239 -0.2762669 -0.2764098 -0.2765526 [163] -0.2766953 -0.2768378 -0.2769802 -0.2771225 -0.2772646 -0.2774067 [169] -0.2775486 -0.2776903 -0.2778320 -0.2779735 -0.2781148 -0.2782561 [175] -0.2783972 -0.2785382 -0.2786791 -0.2788198 -0.2789604 -0.2791009 [181] -0.2792412 -0.2793814 -0.2795215 -0.2796614 -0.2798012 -0.2799409 [187] -0.2800805 -0.2802199 -0.2803591 -0.2804983 -0.2806373 -0.2807762 [193] -0.2809149 -0.2810535 -0.2811920 -0.2813304 -0.2814686 -0.2816066 [199] -0.2817446 -0.2818824 -0.2820200 -0.2821576 -0.2822949 -0.2824322 [205] -0.2825693 -0.2827063 -0.2828431 -0.2829798 -0.2831164 -0.2832528 [211] -0.2833891 -0.2835253 -0.2836613 -0.2837972 -0.2839329 -0.2840685 [217] -0.2842039 -0.2843393 -0.2844744 -0.2846095 -0.2847444 -0.2848791 [223] -0.2850137 -0.2851482 -0.2852825 -0.2854167 -0.2855507 -0.2856846 [229] -0.2858184 -0.2859520 -0.2860855 -0.2862188 -0.2863520 -0.2864851 [235] -0.2866180 -0.2867507 -0.2868833 -0.2870158 -0.2871481 -0.2872803 [241] -0.2874123 -0.2875442 -0.2876760 -0.2878076 -0.2879390 -0.2880703 [247] -0.2882015 -0.2883325 -0.2884633 -0.2885941 -0.2887246 -0.2888551 [253] -0.2889853 -0.2891155 -0.2892454 -0.2893753 -0.2895050 -0.2896345 [259] -0.2897639 -0.2898931 -0.2900222 -0.2901511 -0.2902799 -0.2904086 [265] -0.2905371 -0.2906654 -0.2907936 -0.2909216 -0.2910495 -0.2911773 [271] -0.2913048 -0.2914323 -0.2915596 -0.2916867 -0.2918137 -0.2919405 [277] -0.2920672 -0.2921937 -0.2923201 -0.2924463 -0.2925724 -0.2926983 [283] -0.2928240 -0.2929496 -0.2930751 -0.2932004 -0.2933255 -0.2934505 [289] -0.2935754 -0.2937000 -0.2938246 -0.2939489 -0.2940732 -0.2941972 [295] -0.2943211 -0.2944449 -0.2945685 -0.2946919 -0.2948152 -0.2949383 [301] -0.2950613 -0.2951841 -0.2953067 -0.2954292 -0.2955516 -0.2956738 [307] -0.2957958 -0.2959177 -0.2960394 -0.2961609 -0.2962823 -0.2964036 [313] -0.2965247 -0.2966456 -0.2967663 -0.2968869 -0.2970074 -0.2971277 [319] -0.2972478 -0.2973678 -0.2974876 -0.2976072 -0.2977267 -0.2978460 [325] -0.2979652 -0.2980842 -0.2982031 -0.2983218 -0.2984403 -0.2985587 [331] -0.2986769 -0.2987949 -0.2989128 -0.2990305 -0.2991481 -0.2992655 [337] -0.2993827 -0.2994998 -0.2996167 -0.2997334 -0.2998500 -0.2999664 [343] -0.3000827 -0.3001988 -0.3003147 -0.3004305 -0.3005461 -0.3006616 [349] -0.3007768 -0.3008920 -0.3010069 -0.3011217 -0.3012363 -0.3013508 [355] -0.3014651 -0.3015792 -0.3016932 -0.3018070 -0.3019207 -0.3020341 [361] -0.3021475 -0.3022606 -0.3023736 -0.3024864 -0.3025990 -0.3027115 [367] -0.3028239 -0.3029360 -0.3030480 -0.3031598 -0.3032715 -0.3033830 [373] -0.3034943 -0.3036055 -0.3037164 -0.3038273 -0.3039379 -0.3040484 [379] -0.3041587 -0.3042689 -0.3043789 -0.3044887 -0.3045984 -0.3047079 [385] -0.3048172 -0.3049263 -0.3050353 -0.3051441 -0.3052528 -0.3053613 [391] -0.3054696 -0.3055777 -0.3056857 -0.3057935 -0.3059012 -0.3060087 [397] -0.3061160 -0.3062231 -0.3063301 -0.3064369 -0.3065435 > mx [1] 0.3065435 > 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/rcomp/tmp/1b6iq1257761229.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/200x91257761229.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/330t51257761229.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/4tc1m1257761229.tab") > > system("convert tmp/1b6iq1257761229.ps tmp/1b6iq1257761229.png") > system("convert tmp/200x91257761229.ps tmp/200x91257761229.png") > system("convert tmp/330t51257761229.ps tmp/330t51257761229.png") > > > proc.time() user system elapsed 1.000 0.870 1.729