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(95.1,97,112.7,102.9,97.4,111.4,87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91) > x <- c(117.1,118.7,126.5,127.5,134.6,131.8,135.9,142.7,141.7,153.4,145,137.7,148.3,152.2,169.4,168.6,161.1,174.1,179,190.6,190,181.6,174.8,180.5,196.8,193.8,197,216.3,221.4,217.9,229.7,227.4,204.2,196.6,198.8,207.5,190.7,201.6,210.5,223.5,223.8,231.2,244,234.7,250.2,265.7,287.6,283.3,295.4,312.3,333.8,347.7,383.2,407.1,413.6,362.7,321.9,239.4,191,159.7,163.4) > #'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.3370364 0.3371474 0.3372573 0.3373662 0.3374740 0.3375809 0.3376867 [8] 0.3377914 0.3378951 0.3379977 0.3380993 0.3381998 0.3382992 0.3383976 [15] 0.3384948 0.3385909 0.3386859 0.3387799 0.3388727 0.3389643 0.3390548 [22] 0.3391442 0.3392325 0.3393195 0.3394055 0.3394902 0.3395738 0.3396562 [29] 0.3397373 0.3398173 0.3398961 0.3399737 0.3400501 0.3401252 0.3401991 [36] 0.3402718 0.3403432 0.3404134 0.3404823 0.3405500 0.3406163 0.3406814 [43] 0.3407453 0.3408078 0.3408690 0.3409289 0.3409875 0.3410448 0.3411008 [50] 0.3411554 0.3412087 0.3412606 0.3413112 0.3413604 0.3414083 0.3414548 [57] 0.3414999 0.3415436 0.3415860 0.3416269 0.3416664 0.3417046 0.3417413 [64] 0.3417766 0.3418104 0.3418428 0.3418738 0.3419033 0.3419314 0.3419580 [71] 0.3419832 0.3420069 0.3420291 0.3420498 0.3420690 0.3420867 0.3421029 [78] 0.3421176 0.3421308 0.3421425 0.3421527 0.3421613 0.3421684 0.3421739 [85] 0.3421779 0.3421803 0.3421812 0.3421805 0.3421782 0.3421744 0.3421690 [92] 0.3421620 0.3421534 0.3421432 0.3421313 0.3421179 0.3421029 0.3420863 [99] 0.3420680 0.3420481 0.3420265 0.3420034 0.3419786 0.3419521 0.3419240 [106] 0.3418942 0.3418627 0.3418296 0.3417949 0.3417584 0.3417203 0.3416804 [113] 0.3416389 0.3415957 0.3415508 0.3415042 0.3414559 0.3414059 0.3413541 [120] 0.3413007 0.3412455 0.3411886 0.3411300 0.3410696 0.3410075 0.3409436 [127] 0.3408781 0.3408107 0.3407416 0.3406708 0.3405982 0.3405238 0.3404477 [134] 0.3403698 0.3402902 0.3402087 0.3401255 0.3400406 0.3399538 0.3398653 [141] 0.3397749 0.3396828 0.3395889 0.3394932 0.3393957 0.3392964 0.3391953 [148] 0.3390924 0.3389877 0.3388812 0.3387729 0.3386628 0.3385509 0.3384371 [155] 0.3383216 0.3382042 0.3380850 0.3379640 0.3378412 0.3377165 0.3375901 [162] 0.3374618 0.3373317 0.3371998 0.3370660 0.3369305 0.3367931 0.3366538 [169] 0.3365128 0.3363699 0.3362252 0.3360787 0.3359303 0.3357801 0.3356281 [176] 0.3354743 0.3353186 0.3351611 0.3350018 0.3348407 0.3346777 0.3345130 [183] 0.3343464 0.3341779 0.3340077 0.3338356 0.3336617 0.3334860 0.3333085 [190] 0.3331292 0.3329481 0.3327651 0.3325803 0.3323938 0.3322054 0.3320152 [197] 0.3318232 0.3316294 0.3314339 0.3312365 0.3310373 0.3308364 0.3306336 [204] 0.3304291 0.3302227 0.3300146 0.3298048 0.3295931 0.3293797 0.3291645 [211] 0.3289475 0.3287288 0.3285083 0.3282861 0.3280621 0.3278364 0.3276089 [218] 0.3273796 0.3271487 0.3269160 0.3266816 0.3264454 0.3262075 0.3259679 [225] 0.3257266 0.3254836 0.3252389 0.3249925 0.3247444 0.3244946 0.3242431 [232] 0.3239899 0.3237351 0.3234785 0.3232204 0.3229605 0.3226990 0.3224359 [239] 0.3221711 0.3219046 0.3216366 0.3213669 0.3210955 0.3208226 0.3205480 [246] 0.3202719 0.3199941 0.3197148 0.3194338 0.3191513 0.3188672 0.3185815 [253] 0.3182943 0.3180055 0.3177152 0.3174233 0.3171299 0.3168349 0.3165385 [260] 0.3162405 0.3159410 0.3156400 0.3153375 0.3150335 0.3147280 0.3144211 [267] 0.3141127 0.3138028 0.3134915 0.3131787 0.3128645 0.3125489 0.3122318 [274] 0.3119133 0.3115934 0.3112721 0.3109494 0.3106254 0.3102999 0.3099731 [281] 0.3096449 0.3093154 0.3089845 0.3086523 0.3083188 0.3079839 0.3076477 [288] 0.3073102 0.3069714 0.3066314 0.3062900 0.3059474 0.3056035 0.3052583 [295] 0.3049120 0.3045643 0.3042155 0.3038654 0.3035141 0.3031616 0.3028079 [302] 0.3024530 0.3020970 0.3017398 0.3013814 0.3010218 0.3006612 0.3002993 [309] 0.2999364 0.2995724 0.2992072 0.2988409 0.2984736 0.2981052 0.2977357 [316] 0.2973651 0.2969935 0.2966209 0.2962472 0.2958725 0.2954967 0.2951200 [323] 0.2947423 0.2943636 0.2939839 0.2936032 0.2932216 0.2928390 0.2924555 [330] 0.2920710 0.2916856 0.2912993 0.2909121 0.2905240 0.2901351 0.2897452 [337] 0.2893545 0.2889629 0.2885705 0.2881772 0.2877831 0.2873882 0.2869924 [344] 0.2865959 0.2861986 0.2858005 0.2854016 0.2850019 0.2846015 0.2842004 [351] 0.2837985 0.2833958 0.2829925 0.2825884 0.2821837 0.2817783 0.2813721 [358] 0.2809653 0.2805579 0.2801498 0.2797410 0.2793316 0.2789216 0.2785110 [365] 0.2780997 0.2776879 0.2772755 0.2768625 0.2764489 0.2760347 0.2756200 [372] 0.2752048 0.2747890 0.2743727 0.2739559 0.2735386 0.2731207 0.2727024 [379] 0.2722836 0.2718644 0.2714446 0.2710244 0.2706038 0.2701827 0.2697612 [386] 0.2693393 0.2689170 0.2684942 0.2680711 0.2676476 0.2672237 0.2667995 [393] 0.2663748 0.2659499 0.2655246 0.2650989 0.2646730 0.2642467 0.2638201 [400] 0.2633932 0.2629660 > mx [1] 0.3421812 > mxli [1] -1.14 > 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/19od71257802499.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/2llzf1257802499.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/33cod1257802500.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/4hug31257802500.tab") > > system("convert tmp/19od71257802499.ps tmp/19od71257802499.png") > system("convert tmp/2llzf1257802499.ps tmp/2llzf1257802499.png") > system("convert tmp/33cod1257802500.ps tmp/33cod1257802500.png") > > > proc.time() user system elapsed 0.815 0.545 5.826