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(2.83,2.72,2.73,2.72,2.77,2.61,2.47,2.3,2.38,2.43,2.39,2.6,2.84,2.87,2.92,2.08,3.33,3.48,3.57,3.66,3.77,3.75,3.75,3.81,3.82,3.89,4.05,4.1,4.07,4.26,4.4,4.61,4.63,4.48,4.46,4.45,4.32,4.52,4.21,3.97,4.12,4.5,4.73,5.26,4.52,4.94,4.95,3.52,3.85,2.41,2.95,2.68,2.53,2.44,2.16,2.2,2.1,2.29,2.03,2.05,2.07) > x <- c(2.22,2.19,2.2,2.19,2.22,2.15,2.08,2,2.06,2.11,2.11,2.3,2.57,2.65,2.69,2.76,2.93,3.05,3.15,3.23,3.37,3.45,3.55,3.63,3.7,3.75,3.88,3.91,3.94,4.1,4.21,4.33,4.38,4.19,4.06,4.06,4.02,4.08,3.84,3.6,3.69,3.95,4.11,4.52,4.48,4.33,4.21,3.03,2.46,2.13,1.58,1.22,1.03,1.06,0.91,0.92,0.72,0.78,0.65,0.78,0.79) > #'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.6203762 0.6213022 0.6222319 0.6231653 0.6241023 0.6250430 0.6259875 [8] 0.6269356 0.6278874 0.6288428 0.6298020 0.6307649 0.6317315 0.6327018 [15] 0.6336758 0.6346534 0.6356348 0.6366199 0.6376086 0.6386011 0.6395972 [22] 0.6405971 0.6416006 0.6426078 0.6436186 0.6446332 0.6456514 0.6466733 [29] 0.6476988 0.6487280 0.6497608 0.6507972 0.6518373 0.6528810 0.6539283 [36] 0.6549792 0.6560336 0.6570917 0.6581533 0.6592185 0.6602872 0.6613595 [43] 0.6624353 0.6635145 0.6645973 0.6656835 0.6667732 0.6678664 0.6689629 [50] 0.6700629 0.6711663 0.6722730 0.6733831 0.6744965 0.6756132 0.6767332 [57] 0.6778565 0.6789831 0.6801129 0.6812458 0.6823820 0.6835213 0.6846637 [64] 0.6858093 0.6869579 0.6881096 0.6892643 0.6904219 0.6915826 0.6927462 [71] 0.6939127 0.6950821 0.6962543 0.6974293 0.6986071 0.6997876 0.7009709 [78] 0.7021568 0.7033454 0.7045366 0.7057303 0.7069266 0.7081253 0.7093266 [85] 0.7105302 0.7117362 0.7129445 0.7141552 0.7153680 0.7165831 0.7178004 [92] 0.7190197 0.7202412 0.7214646 0.7226901 0.7239175 0.7251468 0.7263779 [99] 0.7276108 0.7288455 0.7300819 0.7313199 0.7325595 0.7338006 0.7350433 [106] 0.7362873 0.7375328 0.7387796 0.7400277 0.7412770 0.7425275 0.7437790 [113] 0.7450317 0.7462853 0.7475399 0.7487954 0.7500517 0.7513087 0.7525665 [120] 0.7538249 0.7550839 0.7563434 0.7576034 0.7588638 0.7601246 0.7613856 [127] 0.7626468 0.7639082 0.7651697 0.7664312 0.7676927 0.7689540 0.7702152 [134] 0.7714762 0.7727369 0.7739972 0.7752570 0.7765164 0.7777752 0.7790334 [141] 0.7802909 0.7815476 0.7828035 0.7840584 0.7853124 0.7865654 0.7878173 [148] 0.7890680 0.7903174 0.7915656 0.7928123 0.7940576 0.7953014 0.7965437 [155] 0.7977842 0.7990231 0.8002601 0.8014953 0.8027286 0.8039598 0.8051890 [162] 0.8064161 0.8076409 0.8088635 0.8100838 0.8113016 0.8125170 0.8137298 [169] 0.8149401 0.8161476 0.8173524 0.8185544 0.8197536 0.8209497 0.8221429 [176] 0.8233330 0.8245200 0.8257038 0.8268843 0.8280615 0.8292353 0.8304056 [183] 0.8315724 0.8327357 0.8338953 0.8350511 0.8362033 0.8373516 0.8384960 [190] 0.8396365 0.8407730 0.8419054 0.8430337 0.8441579 0.8452778 0.8463934 [197] 0.8475047 0.8486116 0.8497140 0.8508119 0.8519053 0.8529941 0.8540782 [204] 0.8551576 0.8562323 0.8573022 0.8583672 0.8594273 0.8604824 0.8615326 [211] 0.8625777 0.8636178 0.8646527 0.8656824 0.8667070 0.8677262 0.8687402 [218] 0.8697489 0.8707522 0.8717500 0.8727425 0.8737294 0.8747109 0.8756867 [225] 0.8766570 0.8776217 0.8785807 0.8795341 0.8804817 0.8814236 0.8823597 [232] 0.8832900 0.8842145 0.8851332 0.8860459 0.8869528 0.8878537 0.8887488 [239] 0.8896378 0.8905208 0.8913979 0.8922689 0.8931339 0.8939928 0.8948456 [246] 0.8956923 0.8965330 0.8973675 0.8981958 0.8990181 0.8998341 0.9006440 [253] 0.9014478 0.9022453 0.9030366 0.9038218 0.9046007 0.9053734 0.9061399 [260] 0.9069002 0.9076543 0.9084021 0.9091437 0.9098791 0.9106082 0.9113312 [267] 0.9120479 0.9127583 0.9134626 0.9141606 0.9148524 0.9155380 0.9162174 [274] 0.9168906 0.9175577 0.9182185 0.9188732 0.9195217 0.9201640 0.9208003 [281] 0.9214303 0.9220543 0.9226722 0.9232839 0.9238896 0.9244892 0.9250828 [288] 0.9256704 0.9262519 0.9268274 0.9273969 0.9279605 0.9285181 0.9290697 [295] 0.9296155 0.9301553 0.9306893 0.9312175 0.9317397 0.9322562 0.9327669 [302] 0.9332718 0.9337710 0.9342645 0.9347522 0.9352343 0.9357107 0.9361815 [309] 0.9366467 0.9371063 0.9375604 0.9380089 0.9384519 0.9388895 0.9393216 [316] 0.9397483 0.9401696 0.9405855 0.9409960 0.9414013 0.9418013 0.9421960 [323] 0.9425855 0.9429698 0.9433489 0.9437229 0.9440918 0.9444556 0.9448143 [330] 0.9451680 0.9455168 0.9458605 0.9461994 0.9465333 0.9468624 0.9471866 [337] 0.9475060 0.9478206 0.9481305 0.9484356 0.9487361 0.9490319 0.9493231 [344] 0.9496097 0.9498917 0.9501692 0.9504422 0.9507108 0.9509749 0.9512346 [351] 0.9514899 0.9517409 0.9519875 0.9522299 0.9524680 0.9527019 0.9529316 [358] 0.9531572 0.9533787 0.9535960 0.9538093 0.9540185 0.9542238 0.9544251 [365] 0.9546224 0.9548158 0.9550054 0.9551911 0.9553730 0.9555511 0.9557254 [372] 0.9558961 0.9560630 0.9562263 0.9563859 0.9565419 0.9566943 0.9568432 [379] 0.9569886 0.9571305 0.9572689 0.9574039 0.9575355 0.9576638 0.9577887 [386] 0.9579102 0.9580285 0.9581435 0.9582553 0.9583639 0.9584694 0.9585716 [393] 0.9586708 0.9587669 0.9588599 0.9589498 0.9590368 0.9591208 0.9592018 [400] 0.9592799 0.9593550 > mx [1] 0.959355 > 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/12z9d1258041813.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/2756n1258041813.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/3mjar1258041813.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/4v1wz1258041813.tab") > > system("convert tmp/12z9d1258041813.ps tmp/12z9d1258041813.png") > system("convert tmp/2756n1258041813.ps tmp/2756n1258041813.png") > system("convert tmp/3mjar1258041813.ps tmp/3mjar1258041813.png") > > > proc.time() user system elapsed 0.776 0.504 0.918