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(100,100,93.5483871,88.17204301,89.24731183,91.39784946,92.47311828,91.39784946,88.17204301,87.09677419,84.94623656,92.47311828,93.5483871,93.5483871,91.39784946,90.32258065,91.39784946,93.5483871,93.5483871,92.47311828,91.39784946,89.24731183,86.02150538,88.17204301,87.09677419,87.09677419,86.02150538,84.94623656,84.94623656,86.02150538,86.02150538,84.94623656,86.02150538,82.79569892,77.41935484,80.64516129,78.49462366,75.2688172,75.2688172,75.2688172,77.41935484,78.49462366,76.34408602,73.11827957,68.8172043,65.59139785,69.89247312,82.79569892,84.94623656,80.64516129,74.19354839,70.96774194,74.19354839,82.79569892,86.02150538,86.02150538,82.79569892,78.49462366,79.56989247,87.09677419) > x <- c(100,114.242116,115.8697864,108.0366226,100.3051882,98.1688708,97.5584944,105.4933876,104.8830112,105.4933876,114.0386572,88.40284842,96.64292981,113.733469,110.681587,111.190234,103.1536114,102.2380468,102.4415056,115.4628688,107.9348932,113.5300102,116.8870804,90.13224822,101.2207528,117.0905392,120.0406918,113.3265514,109.155646,107.121058,107.121058,119.9389624,112.1057986,114.3438454,119.5320448,94.60834181,105.2899288,118.311292,122.0752798,116.276704,106.5106816,111.698881,114.5473042,116.3784334,117.7009156,116.6836216,120.4476094,96.54120041,105.595117,117.0905392,115.6663276,105.7985758,95.93082401,94.09969481,94.81180061,106.5106816,95.62563581,99.7965412,104.4760936,83.82502543) > #'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.2890301 -0.2891451 -0.2892600 -0.2893749 -0.2894898 -0.2896046 [7] -0.2897194 -0.2898341 -0.2899488 -0.2900634 -0.2901780 -0.2902925 [13] -0.2904070 -0.2905214 -0.2906357 -0.2907501 -0.2908643 -0.2909786 [19] -0.2910927 -0.2912069 -0.2913209 -0.2914350 -0.2915489 -0.2916628 [25] -0.2917767 -0.2918905 -0.2920043 -0.2921180 -0.2922317 -0.2923453 [31] -0.2924589 -0.2925724 -0.2926859 -0.2927993 -0.2929126 -0.2930260 [37] -0.2931392 -0.2932524 -0.2933656 -0.2934787 -0.2935917 -0.2937047 [43] -0.2938177 -0.2939306 -0.2940434 -0.2941562 -0.2942690 -0.2943817 [49] -0.2944943 -0.2946069 -0.2947194 -0.2948319 -0.2949444 -0.2950567 [55] -0.2951691 -0.2952813 -0.2953936 -0.2955057 -0.2956178 -0.2957299 [61] -0.2958419 -0.2959539 -0.2960658 -0.2961776 -0.2962894 -0.2964012 [67] -0.2965129 -0.2966245 -0.2967361 -0.2968476 -0.2969591 -0.2970705 [73] -0.2971819 -0.2972932 -0.2974045 -0.2975157 -0.2976268 -0.2977379 [79] -0.2978490 -0.2979600 -0.2980709 -0.2981818 -0.2982926 -0.2984034 [85] -0.2985141 -0.2986248 -0.2987354 -0.2988460 -0.2989565 -0.2990669 [91] -0.2991773 -0.2992877 -0.2993979 -0.2995082 -0.2996183 -0.2997285 [97] -0.2998385 -0.2999485 -0.3000585 -0.3001684 -0.3002782 -0.3003880 [103] -0.3004978 -0.3006074 -0.3007171 -0.3008266 -0.3009361 -0.3010456 [109] -0.3011550 -0.3012643 -0.3013736 -0.3014828 -0.3015920 -0.3017011 [115] -0.3018102 -0.3019192 -0.3020282 -0.3021371 -0.3022459 -0.3023547 [121] -0.3024634 -0.3025721 -0.3026807 -0.3027892 -0.3028977 -0.3030062 [127] -0.3031146 -0.3032229 -0.3033312 -0.3034394 -0.3035475 -0.3036556 [133] -0.3037637 -0.3038717 -0.3039796 -0.3040875 -0.3041953 -0.3043030 [139] -0.3044107 -0.3045184 -0.3046260 -0.3047335 -0.3048410 -0.3049484 [145] -0.3050557 -0.3051630 -0.3052703 -0.3053775 -0.3054846 -0.3055917 [151] -0.3056987 -0.3058056 -0.3059125 -0.3060193 -0.3061261 -0.3062328 [157] -0.3063395 -0.3064461 -0.3065527 -0.3066591 -0.3067656 -0.3068719 [163] -0.3069782 -0.3070845 -0.3071907 -0.3072968 -0.3074029 -0.3075089 [169] -0.3076149 -0.3077208 -0.3078266 -0.3079324 -0.3080381 -0.3081438 [175] -0.3082494 -0.3083550 -0.3084604 -0.3085659 -0.3086712 -0.3087766 [181] -0.3088818 -0.3089870 -0.3090921 -0.3091972 -0.3093022 -0.3094072 [187] -0.3095121 -0.3096169 -0.3097217 -0.3098264 -0.3099311 -0.3100357 [193] -0.3101402 -0.3102447 -0.3103491 -0.3104535 -0.3105578 -0.3106620 [199] -0.3107662 -0.3108703 -0.3109744 -0.3110784 -0.3111823 -0.3112862 [205] -0.3113900 -0.3114938 -0.3115975 -0.3117011 -0.3118047 -0.3119082 [211] -0.3120117 -0.3121151 -0.3122184 -0.3123217 -0.3124249 -0.3125281 [217] -0.3126312 -0.3127342 -0.3128372 -0.3129401 -0.3130429 -0.3131457 [223] -0.3132485 -0.3133511 -0.3134537 -0.3135563 -0.3136588 -0.3137612 [229] -0.3138636 -0.3139659 -0.3140681 -0.3141703 -0.3142724 -0.3143745 [235] -0.3144765 -0.3145785 -0.3146803 -0.3147821 -0.3148839 -0.3149856 [241] -0.3150872 -0.3151888 -0.3152903 -0.3153918 -0.3154932 -0.3155945 [247] -0.3156958 -0.3157970 -0.3158981 -0.3159992 -0.3161002 -0.3162012 [253] -0.3163021 -0.3164029 -0.3165037 -0.3166044 -0.3167051 -0.3168056 [259] -0.3169062 -0.3170066 -0.3171070 -0.3172074 -0.3173077 -0.3174079 [265] -0.3175080 -0.3176081 -0.3177082 -0.3178081 -0.3179081 -0.3180079 [271] -0.3181077 -0.3182074 -0.3183071 -0.3184067 -0.3185062 -0.3186057 [277] -0.3187051 -0.3188044 -0.3189037 -0.3190030 -0.3191021 -0.3192012 [283] -0.3193003 -0.3193992 -0.3194982 -0.3195970 -0.3196958 -0.3197945 [289] -0.3198932 -0.3199918 -0.3200903 -0.3201888 -0.3202872 -0.3203856 [295] -0.3204839 -0.3205821 -0.3206803 -0.3207784 -0.3208764 -0.3209744 [301] -0.3210723 -0.3211701 -0.3212679 -0.3213657 -0.3214633 -0.3215609 [307] -0.3216585 -0.3217559 -0.3218534 -0.3219507 -0.3220480 -0.3221452 [313] -0.3222424 -0.3223395 -0.3224365 -0.3225335 -0.3226304 -0.3227272 [319] -0.3228240 -0.3229207 -0.3230174 -0.3231140 -0.3232105 -0.3233070 [325] -0.3234034 -0.3234997 -0.3235960 -0.3236922 -0.3237884 -0.3238845 [331] -0.3239805 -0.3240765 -0.3241724 -0.3242682 -0.3243640 -0.3244597 [337] -0.3245553 -0.3246509 -0.3247464 -0.3248419 -0.3249373 -0.3250326 [343] -0.3251279 -0.3252231 -0.3253182 -0.3254133 -0.3255083 -0.3256033 [349] -0.3256981 -0.3257930 -0.3258877 -0.3259824 -0.3260770 -0.3261716 [355] -0.3262661 -0.3263606 -0.3264549 -0.3265493 -0.3266435 -0.3267377 [361] -0.3268318 -0.3269259 -0.3270199 -0.3271138 -0.3272077 -0.3273015 [367] -0.3273952 -0.3274889 -0.3275825 -0.3276761 -0.3277696 -0.3278630 [373] -0.3279564 -0.3280497 -0.3281429 -0.3282361 -0.3283292 -0.3284222 [379] -0.3285152 -0.3286081 -0.3287009 -0.3287937 -0.3288865 -0.3289791 [385] -0.3290717 -0.3291642 -0.3292567 -0.3293491 -0.3294415 -0.3295337 [391] -0.3296260 -0.3297181 -0.3298102 -0.3299022 -0.3299942 -0.3300861 [397] -0.3301779 -0.3302697 -0.3303614 -0.3304530 -0.3305446 > mx [1] 0.3305446 > 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/1y0se1257533084.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/2dlew1257533084.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/3cm0j1257533084.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/46bda1257533084.tab") > > system("convert tmp/1y0se1257533084.ps tmp/1y0se1257533084.png") > system("convert tmp/2dlew1257533084.ps tmp/2dlew1257533084.png") > system("convert tmp/3cm0j1257533084.ps tmp/3cm0j1257533084.png") > > > proc.time() user system elapsed 0.910 0.740 1.288