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(100,111.8629088,94.1225572,67.79436315,146.0424236,125.6555043,142.8655602,130.0304429,110.0117843,132.789944,88.23529412,91.96700383,96.65128155,97.14720613,90.7345576,52.52872434,156.9085731,144.8787194,169.4294412,133.3840715,131.2776196,116.32623,89.15349111,85.08298144,89.38917804,103.0884808,85.34812923,45.9933222,152.823333,130.3692429,150.5008347,126.971423,123.2446234,126.5737013,100.2553275,91.76077777,100.2847884,121.6537366,97.28960031,62.54541884,154.9936168,147.8493568,147.3976235,156.8005499,126.8093882,131.7637239,99.20946676,87.34655799,100.7561622,110.5666307,76.46076795,56.51085142,124.9484435,118.2853776,136.4332711,128.6212315,100.7365217,111.7499754,93.43022685,83.3300599) > x <- c(100,96.66958808,91.06047327,89.04469763,82.90972831,84.04907975,91.76161262,90.09640666,85.97721297,99.82471516,70.90271691,83.87379492,99.21121823,92.81332165,95.3549518,89.65819457,86.76599474,88.25591586,101.2269939,88.25591586,96.3190184,100.4382121,74.84662577,88.08063103,100.6134969,102.1034181,98.94829097,89.39526731,92.90096407,92.28746713,104.1191937,92.98860649,95.79316389,102.716915,81.06923751,91.32340053,98.5977213,107.2743208,99.29886065,87.64241893,97.02015776,98.86064855,96.23137599,102.8045574,95.61787905,101.5775635,84.13672217,87.46713409,102.3663453,101.4022787,87.11656442,82.64680105,79.75460123,81.68273444,90.35933392,82.47151621,80.45574058,90.00876424,72.39263804,78.08939527) > #'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.3049875 0.3050299 0.3050722 0.3051144 0.3051565 0.3051985 0.3052404 [8] 0.3052823 0.3053240 0.3053656 0.3054071 0.3054485 0.3054899 0.3055311 [15] 0.3055722 0.3056133 0.3056542 0.3056950 0.3057358 0.3057764 0.3058169 [22] 0.3058574 0.3058977 0.3059380 0.3059781 0.3060182 0.3060581 0.3060980 [29] 0.3061377 0.3061774 0.3062169 0.3062564 0.3062957 0.3063350 0.3063742 [36] 0.3064132 0.3064522 0.3064911 0.3065298 0.3065685 0.3066071 0.3066455 [43] 0.3066839 0.3067222 0.3067603 0.3067984 0.3068364 0.3068743 0.3069121 [50] 0.3069497 0.3069873 0.3070248 0.3070622 0.3070995 0.3071367 0.3071737 [57] 0.3072107 0.3072476 0.3072844 0.3073211 0.3073577 0.3073942 0.3074306 [64] 0.3074669 0.3075031 0.3075392 0.3075752 0.3076111 0.3076469 0.3076826 [71] 0.3077182 0.3077537 0.3077891 0.3078244 0.3078596 0.3078948 0.3079298 [78] 0.3079647 0.3079995 0.3080342 0.3080688 0.3081034 0.3081378 0.3081721 [85] 0.3082063 0.3082405 0.3082745 0.3083084 0.3083422 0.3083760 0.3084096 [92] 0.3084431 0.3084766 0.3085099 0.3085431 0.3085763 0.3086093 0.3086423 [99] 0.3086751 0.3087078 0.3087405 0.3087730 0.3088055 0.3088378 0.3088701 [106] 0.3089022 0.3089343 0.3089663 0.3089981 0.3090299 0.3090615 0.3090931 [113] 0.3091246 0.3091559 0.3091872 0.3092184 0.3092494 0.3092804 0.3093113 [120] 0.3093421 0.3093727 0.3094033 0.3094338 0.3094642 0.3094945 0.3095247 [127] 0.3095548 0.3095848 0.3096147 0.3096445 0.3096742 0.3097038 0.3097333 [134] 0.3097627 0.3097920 0.3098212 0.3098503 0.3098793 0.3099082 0.3099371 [141] 0.3099658 0.3099944 0.3100229 0.3100514 0.3100797 0.3101079 0.3101361 [148] 0.3101641 0.3101920 0.3102199 0.3102476 0.3102753 0.3103029 0.3103303 [155] 0.3103577 0.3103849 0.3104121 0.3104392 0.3104661 0.3104930 0.3105198 [162] 0.3105465 0.3105731 0.3105995 0.3106259 0.3106522 0.3106784 0.3107045 [169] 0.3107305 0.3107564 0.3107823 0.3108080 0.3108336 0.3108591 0.3108845 [176] 0.3109099 0.3109351 0.3109602 0.3109853 0.3110102 0.3110351 0.3110598 [183] 0.3110845 0.3111091 0.3111335 0.3111579 0.3111822 0.3112063 0.3112304 [190] 0.3112544 0.3112783 0.3113021 0.3113258 0.3113494 0.3113729 0.3113963 [197] 0.3114196 0.3114429 0.3114660 0.3114890 0.3115120 0.3115348 0.3115576 [204] 0.3115802 0.3116028 0.3116252 0.3116476 0.3116699 0.3116921 0.3117141 [211] 0.3117361 0.3117580 0.3117798 0.3118015 0.3118232 0.3118447 0.3118661 [218] 0.3118874 0.3119087 0.3119298 0.3119509 0.3119718 0.3119927 0.3120134 [225] 0.3120341 0.3120547 0.3120752 0.3120956 0.3121159 0.3121361 0.3121562 [232] 0.3121762 0.3121961 0.3122159 0.3122357 0.3122553 0.3122749 0.3122943 [239] 0.3123137 0.3123330 0.3123522 0.3123712 0.3123902 0.3124091 0.3124279 [246] 0.3124467 0.3124653 0.3124838 0.3125023 0.3125206 0.3125389 0.3125570 [253] 0.3125751 0.3125931 0.3126110 0.3126287 0.3126465 0.3126641 0.3126816 [260] 0.3126990 0.3127163 0.3127336 0.3127507 0.3127678 0.3127848 0.3128017 [267] 0.3128184 0.3128351 0.3128517 0.3128683 0.3128847 0.3129010 0.3129173 [274] 0.3129334 0.3129495 0.3129654 0.3129813 0.3129971 0.3130128 0.3130284 [281] 0.3130439 0.3130594 0.3130747 0.3130900 0.3131051 0.3131202 0.3131352 [288] 0.3131501 0.3131649 0.3131796 0.3131942 0.3132087 0.3132232 0.3132375 [295] 0.3132518 0.3132660 0.3132800 0.3132940 0.3133080 0.3133218 0.3133355 [302] 0.3133491 0.3133627 0.3133762 0.3133895 0.3134028 0.3134160 0.3134291 [309] 0.3134422 0.3134551 0.3134679 0.3134807 0.3134934 0.3135060 0.3135185 [316] 0.3135309 0.3135432 0.3135554 0.3135676 0.3135796 0.3135916 0.3136035 [323] 0.3136153 0.3136270 0.3136386 0.3136502 0.3136616 0.3136730 0.3136842 [330] 0.3136954 0.3137065 0.3137176 0.3137285 0.3137393 0.3137501 0.3137608 [337] 0.3137714 0.3137819 0.3137923 0.3138026 0.3138128 0.3138230 0.3138331 [344] 0.3138431 0.3138530 0.3138628 0.3138725 0.3138822 0.3138917 0.3139012 [351] 0.3139106 0.3139199 0.3139291 0.3139383 0.3139473 0.3139563 0.3139652 [358] 0.3139740 0.3139827 0.3139913 0.3139999 0.3140083 0.3140167 0.3140250 [365] 0.3140332 0.3140414 0.3140494 0.3140574 0.3140653 0.3140731 0.3140808 [372] 0.3140884 0.3140959 0.3141034 0.3141108 0.3141181 0.3141253 0.3141324 [379] 0.3141395 0.3141465 0.3141533 0.3141601 0.3141669 0.3141735 0.3141801 [386] 0.3141865 0.3141929 0.3141993 0.3142055 0.3142116 0.3142177 0.3142237 [393] 0.3142296 0.3142354 0.3142412 0.3142468 0.3142524 0.3142579 0.3142633 [400] 0.3142687 0.3142739 > mx [1] 0.3142739 > 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/10k0r1258120611.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/2qez31258120611.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/3png01258120611.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/4073h1258120611.tab") > > system("convert tmp/10k0r1258120611.ps tmp/10k0r1258120611.png") > system("convert tmp/2qez31258120611.ps tmp/2qez31258120611.png") > system("convert tmp/3png01258120611.ps tmp/3png01258120611.png") > > > proc.time() user system elapsed 0.820 0.511 1.021