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(1.249,1.2991,1.3408,1.3119,1.3014,1.3201,1.2938,1.2694,1.2165,1.2037,1.2292,1.2256,1.2015,1.1786,1.1856,1.2103,1.1938,1.202,1.2271,1.277,1.265,1.2684,1.2811,1.2727,1.2611,1.2881,1.3213,1.2999,1.3074,1.3242,1.3516,1.3511,1.3419,1.3716,1.3622,1.3896,1.4227,1.4684,1.457,1.4718,1.4748,1.5527,1.575,1.5557,1.5553,1.577,1.4975,1.4369,1.3322,1.2732,1.3449,1.3239,1.2785,1.305,1.319,1.365,1.4016,1.4088,1.4268,1.4562) > x <- c(2,2,2,2,2,2,2,2,2,2,2,2,2,2,2.21,2.25,2.25,2.45,2.5,2.5,2.64,2.75,2.93,3,3.17,3.25,3.39,3.5,3.5,3.65,3.75,3.75,3.9,4,4,4,4,4,4,4,4,4,4,4,4,4.18,4.25,4.25,3.97,3.42,2.75,2.31,2,1.66,1.31,1.09,1,1,1,1) > #'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.007632318 0.008973061 0.010319565 0.011671823 0.013029830 0.014393578 [7] 0.015763060 0.017138269 0.018519195 0.019905830 0.021298165 0.022696189 [13] 0.024099893 0.025509265 0.026924293 0.028344966 0.029771271 0.031203195 [19] 0.032640725 0.034083845 0.035532542 0.036986799 0.038446602 0.039911933 [25] 0.041382777 0.042859114 0.044340927 0.045828197 0.047320905 0.048819032 [31] 0.050322555 0.051831456 0.053345711 0.054865299 0.056390197 0.057920382 [37] 0.059455829 0.060996514 0.062542412 0.064093497 0.065649743 0.067211122 [43] 0.068777608 0.070349172 0.071925784 0.073507417 0.075094039 0.076685621 [49] 0.078282131 0.079883537 0.081489808 0.083100909 0.084716807 0.086337469 [55] 0.087962859 0.089592943 0.091227683 0.092867043 0.094510987 0.096159477 [61] 0.097812473 0.099469938 0.101131831 0.102798113 0.104468742 0.106143679 [67] 0.107822879 0.109506302 0.111193904 0.112885642 0.114581471 0.116281347 [73] 0.117985225 0.119693058 0.121404801 0.123120406 0.124839825 0.126563012 [79] 0.128289918 0.130020493 0.131754688 0.133492452 0.135233736 0.136978488 [85] 0.138726657 0.140478190 0.142233035 0.143991140 0.145752449 0.147516911 [91] 0.149284469 0.151055070 0.152828657 0.154605176 0.156384569 0.158166781 [97] 0.159951755 0.161739432 0.163529756 0.165322667 0.167118108 0.168916019 [103] 0.170716341 0.172519015 0.174323980 0.176131176 0.177940543 0.179752019 [109] 0.181565543 0.183381054 0.185198489 0.187017787 0.188838885 0.190661720 [115] 0.192486230 0.194312351 0.196140019 0.197969172 0.199799746 0.201631675 [121] 0.203464897 0.205299347 0.207134960 0.208971671 0.210809417 0.212648131 [127] 0.214487748 0.216328204 0.218169434 0.220011371 0.221853950 0.223697106 [133] 0.225540773 0.227384886 0.229229379 0.231074186 0.232919242 0.234764481 [139] 0.236609836 0.238455244 0.240300637 0.242145951 0.243991120 0.245836079 [145] 0.247680762 0.249525104 0.251369039 0.253212504 0.255055432 0.256897760 [151] 0.258739422 0.260580355 0.262420493 0.264259773 0.266098130 0.267935502 [157] 0.269771825 0.271607035 0.273441069 0.275273864 0.277105359 0.278935490 [163] 0.280764196 0.282591415 0.284417086 0.286241147 0.288063538 0.289884197 [169] 0.291703066 0.293520084 0.295335191 0.297148329 0.298959439 0.300768462 [175] 0.302575340 0.304380017 0.306182434 0.307982534 0.309780263 0.311575562 [181] 0.313368378 0.315158655 0.316946338 0.318731373 0.320513706 0.322293285 [187] 0.324070055 0.325843966 0.327614965 0.329383001 0.331148022 0.332909980 [193] 0.334668823 0.336424503 0.338176970 0.339926177 0.341672076 0.343414619 [199] 0.345153760 0.346889453 0.348621652 0.350350313 0.352075390 0.353796839 [205] 0.355514618 0.357228684 0.358938994 0.360645507 0.362348182 0.364046977 [211] 0.365741854 0.367432773 0.369119695 0.370802582 0.372481397 0.374156101 [217] 0.375826660 0.377493037 0.379155196 0.380813104 0.382466726 0.384116029 [223] 0.385760980 0.387401546 0.389037697 0.390669400 0.392296625 0.393919343 [229] 0.395537524 0.397151140 0.398760161 0.400364562 0.401964315 0.403559392 [235] 0.405149770 0.406735422 0.408316324 0.409892453 0.411463783 0.413030293 [241] 0.414591961 0.416148764 0.417700681 0.419247693 0.420789778 0.422326918 [247] 0.423859093 0.425386286 0.426908477 0.428425652 0.429937791 0.431444880 [253] 0.432946903 0.434443845 0.435935691 0.437422427 0.438904040 0.440380517 [259] 0.441851846 0.443318013 0.444779009 0.446234823 0.447685443 0.449130860 [265] 0.450571065 0.452006049 0.453435802 0.454860319 0.456279590 0.457693609 [271] 0.459102370 0.460505865 0.461904091 0.463297042 0.464684712 0.466067098 [277] 0.467444196 0.468816002 0.470182515 0.471543730 0.472899646 0.474250261 [283] 0.475595575 0.476935586 0.478270293 0.479599697 0.480923798 0.482242597 [289] 0.483556095 0.484864292 0.486167192 0.487464796 0.488757107 0.490044127 [295] 0.491325860 0.492602310 0.493873481 0.495139376 0.496400000 0.497655359 [301] 0.498905457 0.500150301 0.501389895 0.502624247 0.503853362 0.505077248 [307] 0.506295911 0.507509359 0.508717600 0.509920641 0.511118490 0.512311156 [313] 0.513498648 0.514680975 0.515858145 0.517030169 0.518197055 0.519358815 [319] 0.520515457 0.521666993 0.522813433 0.523954788 0.525091068 0.526222286 [325] 0.527348453 0.528469579 0.529585678 0.530696761 0.531802841 0.532903929 [331] 0.534000039 0.535091183 0.536177374 0.537258625 0.538334950 0.539406362 [337] 0.540472875 0.541534502 0.542591257 0.543643154 0.544690208 0.545732432 [343] 0.546769842 0.547802451 0.548830275 0.549853328 0.550871626 0.551885182 [349] 0.552894013 0.553898133 0.554897559 0.555892305 0.556882387 0.557867821 [355] 0.558848622 0.559824806 0.560796390 0.561763389 0.562725819 0.563683697 [361] 0.564637039 0.565585860 0.566530178 0.567470008 0.568405368 0.569336274 [367] 0.570262742 0.571184790 0.572102433 0.573015688 0.573924573 0.574829104 [373] 0.575729299 0.576625173 0.577516744 0.578404029 0.579287046 0.580165810 [379] 0.581040339 0.581910650 0.582776761 0.583638688 0.584496449 0.585350060 [385] 0.586199540 0.587044904 0.587886171 0.588723358 0.589556481 0.590385558 [391] 0.591210606 0.592031643 0.592848685 0.593661750 0.594470856 0.595276018 [397] 0.596077255 0.596874584 0.597668021 0.598457585 0.599243291 > mx [1] 0.5992433 > 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/1gjy71257939361.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/20wju1257939361.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/3anq31257939361.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/46e9b1257939361.tab") > > system("convert tmp/1gjy71257939361.ps tmp/1gjy71257939361.png") > system("convert tmp/20wju1257939361.ps tmp/20wju1257939361.png") > system("convert tmp/3anq31257939361.ps tmp/3anq31257939361.png") > > > proc.time() user system elapsed 0.773 0.485 0.948