R version 2.8.0 (2008-10-20) 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(2752,2373,1415,2466,2318,2346,1644,1421,1423,1930,2694,4938,1727,1899,1364,1992,2051,2082,1746,1271,1363,1664,2179,2305,2098,2231,1407,1966,2293,2045,1532,1333,1583,1712,2641,2267,2126,2231,1517,2010,2628,2115,1829,1636,1787,2122,2620,2555,2337,2524,1801,2417,2389,2267,2135,1760,1905,2176,2344,2673,2766,2785,2003,2588,2739,2703,2464,1974,2164,2385,2936,2700,2855,2764,1808,2588,2600,2526,2259,1738,1902,2137,2460,2495,2525,2465,1828,2273,2377,2344,2071,1611,1671,2256,1983,1921,2027) > x <- c(2173,2363,2126,1905,2121,1983,1734,2074,2049,2406,2558,2251,2059,2397,1747,1707,2319,1631,1627,1791,2034,1997,2169,2028,2253,2218,1855,2187,1852,1570,1851,1954,1828,2251,2277,2085,2282,2266,1878,2267,2069,1746,2299,2360,2214,2825,2355,2333,3016,2155,2172,2150,2533,2058,2160,2259,2498,2695,2799,2945,2930,2318,2540,2570,2669,2450,2842,3439,2677,2979,2257,2842,2546,2455,2293,2379,2478,2054,2272,2351,2271,2542,2304,2194,2722,2395,2146,1894,2548,2087,2063,2481,2476,2212,2834,2148,2598) > #'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.3545803 0.3545905 0.3546002 0.3546092 0.3546177 0.3546256 0.3546329 [8] 0.3546396 0.3546457 0.3546512 0.3546561 0.3546604 0.3546642 0.3546673 [15] 0.3546698 0.3546718 0.3546731 0.3546739 0.3546740 0.3546736 0.3546725 [22] 0.3546709 0.3546686 0.3546657 0.3546623 0.3546582 0.3546535 0.3546483 [29] 0.3546424 0.3546359 0.3546288 0.3546211 0.3546128 0.3546038 0.3545943 [36] 0.3545841 0.3545734 0.3545620 0.3545500 0.3545374 0.3545242 0.3545104 [43] 0.3544960 0.3544809 0.3544653 0.3544490 0.3544321 0.3544145 0.3543964 [50] 0.3543776 0.3543583 0.3543383 0.3543176 0.3542964 0.3542745 0.3542521 [57] 0.3542289 0.3542052 0.3541809 0.3541559 0.3541303 0.3541040 0.3540772 [64] 0.3540497 0.3540216 0.3539929 0.3539635 0.3539335 0.3539029 0.3538716 [71] 0.3538397 0.3538072 0.3537741 0.3537403 0.3537059 0.3536709 0.3536352 [78] 0.3535989 0.3535620 0.3535244 0.3534862 0.3534473 0.3534079 0.3533677 [85] 0.3533270 0.3532856 0.3532436 0.3532009 0.3531576 0.3531137 0.3530691 [92] 0.3530239 0.3529781 0.3529316 0.3528845 0.3528367 0.3527883 0.3527393 [99] 0.3526896 0.3526392 0.3525883 0.3525367 0.3524844 0.3524315 0.3523780 [106] 0.3523238 0.3522690 0.3522135 0.3521574 0.3521006 0.3520432 0.3519852 [113] 0.3519265 0.3518672 0.3518072 0.3517465 0.3516853 0.3516234 0.3515608 [120] 0.3514976 0.3514337 0.3513692 0.3513041 0.3512383 0.3511718 0.3511048 [127] 0.3510370 0.3509686 0.3508996 0.3508299 0.3507596 0.3506886 0.3506170 [134] 0.3505447 0.3504718 0.3503982 0.3503240 0.3502491 0.3501736 0.3500974 [141] 0.3500206 0.3499431 0.3498650 0.3497863 0.3497068 0.3496268 0.3495461 [148] 0.3494647 0.3493827 0.3493000 0.3492167 0.3491327 0.3490481 0.3489629 [155] 0.3488769 0.3487904 0.3487032 0.3486153 0.3485268 0.3484376 0.3483478 [162] 0.3482573 0.3481662 0.3480745 0.3479821 0.3478890 0.3477953 0.3477009 [169] 0.3476059 0.3475103 0.3474139 0.3473170 0.3472194 0.3471211 0.3470222 [176] 0.3469227 0.3468225 0.3467216 0.3466201 0.3465180 0.3464152 0.3463117 [183] 0.3462076 0.3461029 0.3459975 0.3458915 0.3457848 0.3456775 0.3455695 [190] 0.3454609 0.3453516 0.3452417 0.3451312 0.3450200 0.3449081 0.3447956 [197] 0.3446825 0.3445687 0.3444543 0.3443392 0.3442235 0.3441071 0.3439901 [204] 0.3438725 0.3437542 0.3436353 0.3435157 0.3433955 0.3432746 0.3431531 [211] 0.3430310 0.3429082 0.3427848 0.3426607 0.3425360 0.3424107 0.3422847 [218] 0.3421581 0.3420308 0.3419029 0.3417744 0.3416453 0.3415154 0.3413850 [225] 0.3412539 0.3411222 0.3409899 0.3408569 0.3407233 0.3405890 0.3404541 [232] 0.3403186 0.3401825 0.3400457 0.3399083 0.3397702 0.3396316 0.3394923 [239] 0.3393523 0.3392118 0.3390706 0.3389287 0.3387863 0.3386432 0.3384995 [246] 0.3383552 0.3382102 0.3380646 0.3379184 0.3377716 0.3376242 0.3374761 [253] 0.3373274 0.3371781 0.3370281 0.3368776 0.3367264 0.3365746 0.3364221 [260] 0.3362691 0.3361154 0.3359612 0.3358063 0.3356508 0.3354946 0.3353379 [267] 0.3351805 0.3350226 0.3348640 0.3347048 0.3345450 0.3343846 0.3342235 [274] 0.3340619 0.3338997 0.3337368 0.3335733 0.3334093 0.3332446 0.3330793 [281] 0.3329134 0.3327469 0.3325798 0.3324121 0.3322438 0.3320749 0.3319054 [288] 0.3317353 0.3315646 0.3313933 0.3312214 0.3310489 0.3308758 0.3307022 [295] 0.3305279 0.3303530 0.3301775 0.3300015 0.3298248 0.3296476 0.3294697 [302] 0.3292913 0.3291123 0.3289327 0.3287525 0.3285718 0.3283904 0.3282085 [309] 0.3280259 0.3278428 0.3276592 0.3274749 0.3272900 0.3271046 0.3269186 [316] 0.3267320 0.3265449 0.3263571 0.3261688 0.3259799 0.3257905 0.3256005 [323] 0.3254099 0.3252187 0.3250269 0.3248346 0.3246418 0.3244483 0.3242543 [330] 0.3240597 0.3238646 0.3236689 0.3234727 0.3232758 0.3230785 0.3228805 [337] 0.3226820 0.3224830 0.3222834 0.3220832 0.3218825 0.3216812 0.3214794 [344] 0.3212770 0.3210741 0.3208706 0.3206666 0.3204620 0.3202569 0.3200512 [351] 0.3198450 0.3196383 0.3194310 0.3192231 0.3190148 0.3188059 0.3185964 [358] 0.3183864 0.3181759 0.3179649 0.3177533 0.3175412 0.3173285 0.3171153 [365] 0.3169016 0.3166874 0.3164726 0.3162573 0.3160415 0.3158252 0.3156083 [372] 0.3153909 0.3151730 0.3149546 0.3147356 0.3145162 0.3142962 0.3140757 [379] 0.3138547 0.3136332 0.3134112 0.3131886 0.3129656 0.3127420 0.3125180 [386] 0.3122934 0.3120683 0.3118428 0.3116167 0.3113901 0.3111630 0.3109355 [393] 0.3107074 0.3104788 0.3102498 0.3100202 0.3097901 0.3095596 0.3093286 [400] 0.3090971 0.3088651 > mx [1] 0.354674 > mxli [1] -1.82 > 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/freestat/rcomp/tmp/1jdxl1226420938.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/freestat/rcomp/tmp/2acs21226420938.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/freestat/rcomp/tmp/349041226420938.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/4433m1226420938.tab") > > system("convert tmp/1jdxl1226420938.ps tmp/1jdxl1226420938.png") > system("convert tmp/2acs21226420938.ps tmp/2acs21226420938.png") > system("convert tmp/349041226420938.ps tmp/349041226420938.png") > > > proc.time() user system elapsed 1.220 0.797 1.564