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(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) > x <- 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) > #'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.4077628 0.4077340 0.4077044 0.4076739 0.4076425 0.4076103 0.4075772 [8] 0.4075433 0.4075084 0.4074727 0.4074361 0.4073986 0.4073602 0.4073209 [15] 0.4072807 0.4072395 0.4071975 0.4071546 0.4071107 0.4070659 0.4070201 [22] 0.4069734 0.4069258 0.4068772 0.4068276 0.4067771 0.4067257 0.4066732 [29] 0.4066198 0.4065654 0.4065100 0.4064536 0.4063963 0.4063379 0.4062785 [36] 0.4062181 0.4061567 0.4060942 0.4060308 0.4059663 0.4059007 0.4058341 [43] 0.4057665 0.4056978 0.4056280 0.4055571 0.4054852 0.4054122 0.4053381 [50] 0.4052630 0.4051867 0.4051093 0.4050308 0.4049512 0.4048705 0.4047886 [57] 0.4047056 0.4046215 0.4045362 0.4044498 0.4043622 0.4042734 0.4041835 [64] 0.4040923 0.4040000 0.4039065 0.4038118 0.4037159 0.4036188 0.4035205 [71] 0.4034209 0.4033201 0.4032181 0.4031148 0.4030102 0.4029044 0.4027974 [78] 0.4026890 0.4025794 0.4024685 0.4023563 0.4022427 0.4021279 0.4020118 [85] 0.4018943 0.4017755 0.4016553 0.4015339 0.4014110 0.4012868 0.4011612 [92] 0.4010342 0.4009059 0.4007761 0.4006450 0.4005124 0.4003785 0.4002431 [99] 0.4001062 0.3999680 0.3998282 0.3996870 0.3995444 0.3994003 0.3992546 [106] 0.3991075 0.3989589 0.3988088 0.3986572 0.3985040 0.3983494 0.3981931 [113] 0.3980353 0.3978760 0.3977151 0.3975526 0.3973885 0.3972228 0.3970556 [120] 0.3968867 0.3967161 0.3965440 0.3963702 0.3961948 0.3960177 0.3958389 [127] 0.3956585 0.3954763 0.3952925 0.3951069 0.3949197 0.3947307 0.3945400 [134] 0.3943475 0.3941533 0.3939573 0.3937596 0.3935600 0.3933587 0.3931555 [141] 0.3929506 0.3927438 0.3925352 0.3923247 0.3921124 0.3918982 0.3916822 [148] 0.3914642 0.3912444 0.3910227 0.3907990 0.3905734 0.3903459 0.3901164 [155] 0.3898850 0.3896516 0.3894162 0.3891788 0.3889395 0.3886981 0.3884547 [162] 0.3882092 0.3879617 0.3877122 0.3874606 0.3872069 0.3869511 0.3866933 [169] 0.3864333 0.3861712 0.3859070 0.3856406 0.3853720 0.3851014 0.3848285 [176] 0.3845534 0.3842762 0.3839967 0.3837150 0.3834311 0.3831449 0.3828565 [183] 0.3825658 0.3822729 0.3819776 0.3816800 0.3813802 0.3810780 0.3807735 [190] 0.3804666 0.3801574 0.3798458 0.3795318 0.3792155 0.3788967 0.3785755 [197] 0.3782519 0.3779259 0.3775974 0.3772665 0.3769331 0.3765972 0.3762588 [204] 0.3759179 0.3755746 0.3752286 0.3748802 0.3745292 0.3741756 0.3738195 [211] 0.3734608 0.3730995 0.3727356 0.3723690 0.3719999 0.3716281 0.3712537 [218] 0.3708766 0.3704969 0.3701145 0.3697294 0.3693416 0.3689510 0.3685578 [225] 0.3681619 0.3677632 0.3673617 0.3669575 0.3665505 0.3661408 0.3657282 [232] 0.3653129 0.3648947 0.3644737 0.3640499 0.3636233 0.3631938 0.3627615 [239] 0.3623263 0.3618882 0.3614473 0.3610034 0.3605567 0.3601070 0.3596544 [246] 0.3591989 0.3587405 0.3582791 0.3578148 0.3573476 0.3568773 0.3564041 [253] 0.3559279 0.3554487 0.3549666 0.3544814 0.3539932 0.3535021 0.3530079 [260] 0.3525106 0.3520104 0.3515071 0.3510007 0.3504913 0.3499789 0.3494634 [267] 0.3489448 0.3484232 0.3478985 0.3473707 0.3468399 0.3463059 0.3457689 [274] 0.3452287 0.3446855 0.3441392 0.3435898 0.3430372 0.3424816 0.3419228 [281] 0.3413610 0.3407960 0.3402279 0.3396567 0.3390824 0.3385050 0.3379244 [288] 0.3373407 0.3367540 0.3361641 0.3355710 0.3349749 0.3343756 0.3337733 [295] 0.3331678 0.3325592 0.3319475 0.3313327 0.3307148 0.3300938 0.3294697 [302] 0.3288426 0.3282123 0.3275789 0.3269425 0.3263030 0.3256604 0.3250148 [309] 0.3243661 0.3237143 0.3230596 0.3224017 0.3217409 0.3210770 0.3204101 [316] 0.3197402 0.3190673 0.3183914 0.3177125 0.3170307 0.3163459 0.3156581 [323] 0.3149674 0.3142738 0.3135772 0.3128778 0.3121754 0.3114702 0.3107620 [330] 0.3100511 0.3093373 0.3086206 0.3079011 0.3071789 0.3064538 0.3057260 [337] 0.3049954 0.3042620 0.3035259 0.3027871 0.3020457 0.3013015 0.3005547 [344] 0.2998052 0.2990531 0.2982984 0.2975411 0.2967812 0.2960188 0.2952539 [351] 0.2944864 0.2937164 0.2929440 0.2921691 0.2913918 0.2906121 0.2898300 [358] 0.2890455 0.2882587 0.2874696 0.2866781 0.2858844 0.2850885 0.2842903 [365] 0.2834899 0.2826874 0.2818827 0.2810758 0.2802669 0.2794559 0.2786429 [372] 0.2778278 0.2770107 0.2761916 0.2753707 0.2745478 0.2737230 0.2728963 [379] 0.2720678 0.2712375 0.2704055 0.2695717 0.2687361 0.2678989 0.2670601 [386] 0.2662196 0.2653775 0.2645338 0.2636886 0.2628419 0.2619937 0.2611440 [393] 0.2602930 0.2594405 0.2585868 0.2577316 0.2568753 0.2560176 0.2551587 [400] 0.2542986 0.2534374 > mx [1] 0.4077628 > 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/html/freestat/rcomp/tmp/134331226420559.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/2bgcp1226420559.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/3xbwy1226420559.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/48nou1226420559.tab") > > system("convert tmp/134331226420559.ps tmp/134331226420559.png") > system("convert tmp/2bgcp1226420559.ps tmp/2bgcp1226420559.png") > system("convert tmp/3xbwy1226420559.ps tmp/3xbwy1226420559.png") > > > proc.time() user system elapsed 1.217 0.811 1.444