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(9487,8700,9627,8947,9283,8829,9947,9628,9318,9605,8640,9214,9567,8547,9185,9470,9123,9278,10170,9434,9655,9429,8739,9552,9687,9019,9672,9206,9069,9788,10312,10105,9863,9656,9295,9946,9701,9049,10190,9706,9765,9893,9994,10433,10073,10112,9266,9820,10097,9115,10411,9678,10408,10153,10368,10581,10597,10680,9738,9556) > x <- c(1169,2154,2249,2687,4359,5382,4459,6398,4596,3024,1887,2070,1351,2218,2461,3028,4784,4975,4607,6249,4809,3157,1910,2228,1594,2467,2222,3607,4685,4962,5770,5480,5000,3228,1993,2288,1580,2111,2192,3601,4665,4876,5813,5589,5331,3075,2002,2306,1507,1992,2487,3490,4647,5594,5611,5788,6204,3013,1931,2549) > #'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.2543783 0.2551029 0.2558273 0.2565512 0.2572748 0.2579981 0.2587209 [8] 0.2594433 0.2601652 0.2608866 0.2616075 0.2623280 0.2630478 0.2637671 [15] 0.2644858 0.2652039 0.2659214 0.2666382 0.2673543 0.2680698 0.2687845 [22] 0.2694984 0.2702116 0.2709241 0.2716357 0.2723464 0.2730564 0.2737654 [29] 0.2744735 0.2751808 0.2758871 0.2765924 0.2772968 0.2780001 0.2787024 [36] 0.2794037 0.2801039 0.2808031 0.2815011 0.2821980 0.2828937 0.2835883 [43] 0.2842817 0.2849739 0.2856648 0.2863545 0.2870429 0.2877301 0.2884159 [50] 0.2891004 0.2897835 0.2904653 0.2911457 0.2918247 0.2925023 0.2931784 [57] 0.2938530 0.2945262 0.2951979 0.2958680 0.2965366 0.2972037 0.2978692 [64] 0.2985331 0.2991953 0.2998560 0.3005150 0.3011724 0.3018280 0.3024820 [71] 0.3031343 0.3037848 0.3044336 0.3050807 0.3057259 0.3063694 0.3070111 [78] 0.3076509 0.3082889 0.3089250 0.3095593 0.3101917 0.3108222 0.3114508 [85] 0.3120774 0.3127022 0.3133249 0.3139457 0.3145645 0.3151813 0.3157961 [92] 0.3164089 0.3170196 0.3176283 0.3182350 0.3188395 0.3194420 0.3200424 [99] 0.3206407 0.3212368 0.3218308 0.3224227 0.3230125 0.3236000 0.3241854 [106] 0.3247686 0.3253496 0.3259285 0.3265051 0.3270794 0.3276516 0.3282215 [113] 0.3287891 0.3293545 0.3299177 0.3304785 0.3310371 0.3315934 0.3321473 [120] 0.3326990 0.3332484 0.3337954 0.3343401 0.3348825 0.3354225 0.3359602 [127] 0.3364955 0.3370285 0.3375591 0.3380873 0.3386131 0.3391366 0.3396577 [134] 0.3401764 0.3406927 0.3412066 0.3417181 0.3422271 0.3427338 0.3432381 [141] 0.3437399 0.3442393 0.3447363 0.3452308 0.3457229 0.3462126 0.3466999 [148] 0.3471847 0.3476670 0.3481469 0.3486244 0.3490994 0.3495720 0.3500421 [155] 0.3505098 0.3509750 0.3514378 0.3518981 0.3523560 0.3528114 0.3532644 [162] 0.3537149 0.3541629 0.3546085 0.3550516 0.3554923 0.3559306 0.3563664 [169] 0.3567997 0.3572306 0.3576590 0.3580850 0.3585086 0.3589297 0.3593484 [176] 0.3597646 0.3601784 0.3605898 0.3609987 0.3614052 0.3618093 0.3622110 [183] 0.3626102 0.3630070 0.3634014 0.3637934 0.3641830 0.3645702 0.3649550 [190] 0.3653374 0.3657174 0.3660951 0.3664703 0.3668432 0.3672136 0.3675818 [197] 0.3679475 0.3683109 0.3686719 0.3690306 0.3693869 0.3697409 0.3700926 [204] 0.3704419 0.3707889 0.3711336 0.3714760 0.3718160 0.3721538 0.3724892 [211] 0.3728224 0.3731533 0.3734819 0.3738082 0.3741323 0.3744541 0.3747736 [218] 0.3750909 0.3754059 0.3757188 0.3760293 0.3763377 0.3766438 0.3769478 [225] 0.3772495 0.3775490 0.3778463 0.3781415 0.3784345 0.3787253 0.3790139 [232] 0.3793004 0.3795848 0.3798670 0.3801470 0.3804250 0.3807008 0.3809745 [239] 0.3812461 0.3815156 0.3817831 0.3820484 0.3823117 0.3825729 0.3828320 [246] 0.3830891 0.3833441 0.3835971 0.3838481 0.3840971 0.3843440 0.3845889 [253] 0.3848319 0.3850728 0.3853118 0.3855488 0.3857838 0.3860169 0.3862480 [260] 0.3864771 0.3867044 0.3869297 0.3871531 0.3873745 0.3875941 0.3878118 [267] 0.3880276 0.3882415 0.3884535 0.3886637 0.3888720 0.3890784 0.3892831 [274] 0.3894859 0.3896868 0.3898860 0.3900833 0.3902789 0.3904726 0.3906646 [281] 0.3908547 0.3910432 0.3912298 0.3914147 0.3915979 0.3917793 0.3919590 [288] 0.3921369 0.3923132 0.3924877 0.3926606 0.3928318 0.3930012 0.3931690 [295] 0.3933352 0.3934996 0.3936625 0.3938236 0.3939832 0.3941411 0.3942974 [302] 0.3944521 0.3946051 0.3947566 0.3949065 0.3950548 0.3952015 0.3953467 [309] 0.3954903 0.3956323 0.3957728 0.3959118 0.3960492 0.3961851 0.3963195 [316] 0.3964524 0.3965838 0.3967137 0.3968421 0.3969690 0.3970945 0.3972185 [323] 0.3973410 0.3974621 0.3975817 0.3976999 0.3978167 0.3979321 0.3980460 [330] 0.3981585 0.3982697 0.3983794 0.3984878 0.3985947 0.3987003 0.3988045 [337] 0.3989074 0.3990089 0.3991091 0.3992079 0.3993054 0.3994016 0.3994964 [344] 0.3995900 0.3996822 0.3997731 0.3998628 0.3999511 0.4000382 0.4001240 [351] 0.4002085 0.4002918 0.4003738 0.4004545 0.4005340 0.4006123 0.4006894 [358] 0.4007652 0.4008398 0.4009132 0.4009854 0.4010564 0.4011262 0.4011948 [365] 0.4012622 0.4013284 0.4013935 0.4014574 0.4015202 0.4015818 0.4016422 [372] 0.4017015 0.4017597 0.4018168 0.4018727 0.4019275 0.4019812 0.4020338 [379] 0.4020852 0.4021356 0.4021849 0.4022331 0.4022802 0.4023263 0.4023712 [386] 0.4024151 0.4024580 0.4024998 0.4025405 0.4025802 0.4026189 0.4026565 [393] 0.4026931 0.4027287 0.4027633 0.4027968 0.4028293 0.4028609 0.4028914 [400] 0.4029209 0.4029495 > mx [1] 0.4029495 > 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/rcomp/tmp/1x5le1257948878.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/2npw11257948878.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/3rxml1257948878.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/4d2if1257948878.tab") > > system("convert tmp/1x5le1257948878.ps tmp/1x5le1257948878.png") > system("convert tmp/2npw11257948878.ps tmp/2npw11257948878.png") > system("convert tmp/3rxml1257948878.ps tmp/3rxml1257948878.png") > > > proc.time() user system elapsed 0.784 0.505 5.726