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(13.92,13.22,13.31,12.91,13.19,12.92,13.43,13.72,13.97,14.91,14.46,14.12,14.23,15.04,14.80,14.49,15.14,14.34,15.12,15.14,14.34,14.36,14.91,15.56,16.50,15.57,15.14,15.19,15.07,14.48,14.27,14.72,14.65,14.38,13.95,14.85,14.87,14.83,15.03,15.47,16.21,16.55,17.04,17.22,17.47,17.75,17.84,18.47,18.38,18.55,18.39,18.88,20.21,19.67,20.09,18.78,19.74,20.64,20.34,21.75,22.10,22.81,22.91,22.46,21.78,25.05,23.70,23.02,24.34,24.15,25.85,26.42,26.54,26.36,26.99,27.52,26.63,26.26,24.86,26.84,26.57,24.67,27.24,27.77,27.61,27.27,28.46,26.97,29.95,29.88,29.67,31.19,30.24,30.03,31.02,30.45,31.70,32.10,32.32,32.18,33.43,33.07,35.32,35.17,35.29,37.89,38.32,37.07,39.77,39.20,40.46,44.95,41.69,41.88,45.86) > x <- c(0.95,0.98,1.23,1.17,0.84,0.74,0.65,0.91,1.19,1.30,1.53,1.94,1.79,1.95,2.26,2.04,2.16,2.75,2.79,2.88,3.36,2.97,3.10,2.49,2.20,2.25,2.09,2.79,3.14,2.93,2.65,2.67,2.26,2.35,2.13,2.18,2.90,2.63,2.67,1.81,1.33,0.88,1.28,1.26,1.26,1.29,1.10,1.37,1.21,1.74,1.76,1.48,1.04,1.62,1.49,1.79,1.8,1.58,1.86,1.74,1.59,1.26,1.13,1.92,2.61,2.26,2.41,2.26,2.03,2.86,2.55,2.27,2.26,2.57,3.07,2.76,2.51,2.87,3.14,3.11,3.16,2.47,2.57,2.89,2.63,2.38,1.69,1.96,2.19,1.87,1.6,1.63,1.22,1.21,1.49,1.64,1.66,1.77,1.82,1.78,1.28,1.29,1.37,1.12,1.51,2.24,2.94,3.09,3.46,3.64,4.39,4.15,5.21,5.80,5.91) > #'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.2895414 0.2898110 0.2900814 0.2903525 0.2906244 0.2908971 0.2911707 [8] 0.2914450 0.2917202 0.2919963 0.2922732 0.2925510 0.2928297 0.2931093 [15] 0.2933898 0.2936713 0.2939536 0.2942370 0.2945213 0.2948066 0.2950929 [22] 0.2953803 0.2956686 0.2959580 0.2962484 0.2965400 0.2968326 0.2971262 [29] 0.2974211 0.2977170 0.2980141 0.2983123 0.2986117 0.2989123 0.2992140 [36] 0.2995170 0.2998212 0.3001267 0.3004334 0.3007414 0.3010506 0.3013612 [43] 0.3016731 0.3019863 0.3023009 0.3026168 0.3029341 0.3032527 0.3035728 [50] 0.3038943 0.3042172 0.3045416 0.3048674 0.3051948 0.3055236 0.3058539 [57] 0.3061857 0.3065191 0.3068540 0.3071905 0.3075285 0.3078682 0.3082095 [64] 0.3085523 0.3088969 0.3092430 0.3095909 0.3099404 0.3102916 0.3106446 [71] 0.3109992 0.3113556 0.3117138 0.3120737 0.3124354 0.3127988 0.3131641 [78] 0.3135312 0.3139002 0.3142710 0.3146436 0.3150182 0.3153946 0.3157729 [85] 0.3161531 0.3165353 0.3169193 0.3173054 0.3176934 0.3180834 0.3184753 [92] 0.3188693 0.3192653 0.3196633 0.3200633 0.3204654 0.3208695 0.3212758 [99] 0.3216840 0.3220944 0.3225069 0.3229215 0.3233382 0.3237570 0.3241780 [106] 0.3246012 0.3250265 0.3254539 0.3258836 0.3263154 0.3267494 0.3271856 [113] 0.3276241 0.3280648 0.3285076 0.3289528 0.3294001 0.3298497 0.3303016 [120] 0.3307558 0.3312122 0.3316708 0.3321318 0.3325950 0.3330606 0.3335284 [127] 0.3339985 0.3344710 0.3349457 0.3354227 0.3359021 0.3363838 0.3368678 [134] 0.3373541 0.3378428 0.3383338 0.3388271 0.3393227 0.3398207 0.3403210 [141] 0.3408236 0.3413286 0.3418359 0.3423455 0.3428575 0.3433718 0.3438884 [148] 0.3444073 0.3449286 0.3454521 0.3459780 0.3465062 0.3470367 0.3475695 [155] 0.3481046 0.3486420 0.3491817 0.3497236 0.3502679 0.3508144 0.3513631 [162] 0.3519141 0.3524674 0.3530229 0.3535806 0.3541405 0.3547027 0.3552670 [169] 0.3558335 0.3564022 0.3569731 0.3575461 0.3581213 0.3586986 0.3592780 [176] 0.3598595 0.3604431 0.3610288 0.3616165 0.3622063 0.3627981 0.3633919 [183] 0.3639877 0.3645855 0.3651852 0.3657869 0.3663905 0.3669960 0.3676034 [190] 0.3682127 0.3688238 0.3694368 0.3700515 0.3706681 0.3712864 0.3719064 [197] 0.3725282 0.3731516 0.3737767 0.3744035 0.3750319 0.3756619 0.3762934 [204] 0.3769265 0.3775612 0.3781973 0.3788349 0.3794739 0.3801143 0.3807562 [211] 0.3813993 0.3820438 0.3826896 0.3833367 0.3839850 0.3846345 0.3852852 [218] 0.3859370 0.3865899 0.3872439 0.3878989 0.3885550 0.3892120 0.3898700 [225] 0.3905289 0.3911887 0.3918493 0.3925107 0.3931728 0.3938358 0.3944994 [232] 0.3951636 0.3958285 0.3964940 0.3971600 0.3978265 0.3984935 0.3991610 [239] 0.3998288 0.4004970 0.4011655 0.4018343 0.4025033 0.4031725 0.4038419 [246] 0.4045113 0.4051809 0.4058505 0.4065200 0.4071896 0.4078590 0.4085283 [253] 0.4091974 0.4098663 0.4105349 0.4112033 0.4118712 0.4125388 0.4132060 [260] 0.4138727 0.4145388 0.4152044 0.4158694 0.4165337 0.4171973 0.4178602 [267] 0.4185223 0.4191836 0.4198440 0.4205035 0.4211620 0.4218196 0.4224760 [274] 0.4231314 0.4237856 0.4244387 0.4250905 0.4257411 0.4263903 0.4270382 [281] 0.4276847 0.4283297 0.4289732 0.4296152 0.4302556 0.4308944 0.4315316 [288] 0.4321670 0.4328006 0.4334325 0.4340625 0.4346907 0.4353169 0.4359411 [295] 0.4365634 0.4371836 0.4378017 0.4384177 0.4390314 0.4396430 0.4402523 [302] 0.4408593 0.4414640 0.4420663 0.4426662 0.4432636 0.4438585 0.4444509 [309] 0.4450408 0.4456280 0.4462125 0.4467944 0.4473735 0.4479499 0.4485235 [316] 0.4490942 0.4496621 0.4502271 0.4507891 0.4513482 0.4519043 0.4524573 [323] 0.4530072 0.4535541 0.4540978 0.4546383 0.4551756 0.4557097 0.4562406 [330] 0.4567681 0.4572923 0.4578132 0.4583307 0.4588448 0.4593555 0.4598626 [337] 0.4603663 0.4608665 0.4613632 0.4618563 0.4623458 0.4628317 0.4633139 [344] 0.4637925 0.4642674 0.4647386 0.4652061 0.4656699 0.4661299 0.4665861 [351] 0.4670385 0.4674870 0.4679318 0.4683727 0.4688097 0.4692428 0.4696720 [358] 0.4700973 0.4705187 0.4709361 0.4713496 0.4717591 0.4721646 0.4725661 [365] 0.4729636 0.4733571 0.4737465 0.4741319 0.4745133 0.4748906 0.4752638 [372] 0.4756330 0.4759981 0.4763591 0.4767160 0.4770689 0.4774176 0.4777622 [379] 0.4781027 0.4784391 0.4787714 0.4790996 0.4794236 0.4797436 0.4800594 [386] 0.4803711 0.4806787 0.4809822 0.4812816 0.4815768 0.4818679 0.4821550 [393] 0.4824379 0.4827167 0.4829914 0.4832621 0.4835286 0.4837911 0.4840495 [400] 0.4843039 0.4845541 > mx [1] 0.4845541 > 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/1caul1226434172.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/2bkqf1226434172.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/3491e1226434172.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/49q8n1226434172.tab") > > system("convert tmp/1caul1226434172.ps tmp/1caul1226434172.png") > system("convert tmp/2bkqf1226434172.ps tmp/2bkqf1226434172.png") > system("convert tmp/3491e1226434172.ps tmp/3491e1226434172.png") > > > proc.time() user system elapsed 1.253 0.824 1.584