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(10144,10751,11752,13808,16203,17432,18014,16956,17982,19435,19990,20154,10327,9807,10862,13743,16458,18466,18810,17361,17411,18517,18525,17859,9499,9490,9255,10758,12375,14617,15427,14136,14308,15293,15679,16319,11196,11169,12158,14251,16237,19706,18960,18537,19103,19691,19464,17264,8957,9703,9166,9519,10535,11526,9630,7061,6021,4728,2657,1264) > x <- c(285,10144,10751,11752,13808,16203,17432,18014,16956,17982,19435,19990,20154,10327,9807,10862,13743,16458,18466,18810,17361,17411,18517,18525,17859,9499,9490,9255,10758,12375,14617,15427,14136,14308,15293,15679,16319,11196,11169,12158,14251,16237,19706,18960,18537,19103,19691,19464,17264,8957,9703,9166,9519,10535,11526,9630,7061,6021,4728,2657) > #'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.1099818 0.1101562 0.1103350 0.1105184 0.1107065 0.1108995 0.1110973 [8] 0.1113003 0.1115084 0.1117219 0.1119408 0.1121654 0.1123957 0.1126319 [15] 0.1128741 0.1131226 0.1133774 0.1136386 0.1139066 0.1141814 0.1144633 [22] 0.1147523 0.1150487 0.1153526 0.1156643 0.1159840 0.1163117 0.1166479 [29] 0.1169925 0.1173459 0.1177083 0.1180799 0.1184609 0.1188516 0.1192521 [36] 0.1196628 0.1200839 0.1205156 0.1209583 0.1214121 0.1218773 0.1223542 [43] 0.1228431 0.1233444 0.1238582 0.1243849 0.1249247 0.1254781 0.1260453 [50] 0.1266267 0.1272226 0.1278333 0.1284592 0.1291007 0.1297580 0.1304316 [57] 0.1311219 0.1318293 0.1325541 0.1332967 0.1340576 0.1348371 0.1356357 [64] 0.1364539 0.1372920 0.1381506 0.1390300 0.1399307 0.1408533 0.1417982 [71] 0.1427658 0.1437567 0.1447714 0.1458104 0.1468742 0.1479634 0.1490785 [78] 0.1502200 0.1513885 0.1525845 0.1538087 0.1550615 0.1563437 0.1576557 [85] 0.1589982 0.1603718 0.1617771 0.1632147 0.1646853 0.1661895 0.1677278 [92] 0.1693011 0.1709098 0.1725548 0.1742365 0.1759558 0.1777132 0.1795095 [99] 0.1813453 0.1832213 0.1851381 0.1870965 0.1890971 0.1911407 0.1932278 [106] 0.1953592 0.1975355 0.1997575 0.2020257 0.2043409 0.2067037 0.2091148 [113] 0.2115747 0.2140843 0.2166439 0.2192544 0.2219162 0.2246300 0.2273964 [120] 0.2302158 0.2330889 0.2360162 0.2389981 0.2420351 0.2451277 0.2482764 [127] 0.2514814 0.2547433 0.2580623 0.2614387 0.2648728 0.2683649 0.2719151 [134] 0.2755237 0.2791906 0.2829161 0.2867002 0.2905427 0.2944438 0.2984032 [141] 0.3024207 0.3064962 0.3106294 0.3148199 0.3190674 0.3233713 0.3277312 [148] 0.3321464 0.3366164 0.3411404 0.3457175 0.3503470 0.3550279 0.3597592 [155] 0.3645399 0.3693687 0.3742445 0.3791660 0.3841317 0.3891404 0.3941904 [162] 0.3992802 0.4044081 0.4095725 0.4147714 0.4200031 0.4252657 0.4305571 [169] 0.4358753 0.4412182 0.4465836 0.4519694 0.4573733 0.4627929 0.4682260 [176] 0.4736701 0.4791228 0.4845816 0.4900442 0.4955080 0.5009705 0.5064291 [183] 0.5118813 0.5173247 0.5227566 0.5281745 0.5335760 0.5389586 0.5443197 [190] 0.5496569 0.5549679 0.5602502 0.5655016 0.5707197 0.5759023 0.5810472 [197] 0.5861523 0.5912156 0.5962350 0.6012087 0.6061347 0.6110112 0.6158367 [204] 0.6206094 0.6253278 0.6299904 0.6345959 0.6391429 0.6436303 0.6480569 [211] 0.6524216 0.6567235 0.6609618 0.6651356 0.6692442 0.6732871 0.6772636 [218] 0.6811733 0.6850158 0.6887909 0.6924982 0.6961376 0.6997090 0.7032125 [225] 0.7066480 0.7100156 0.7133156 0.7165481 0.7197134 0.7228119 0.7258440 [232] 0.7288100 0.7317105 0.7345459 0.7373169 0.7400240 0.7426679 0.7452492 [239] 0.7477686 0.7502269 0.7526248 0.7549630 0.7572423 0.7594636 0.7616277 [246] 0.7637354 0.7657876 0.7677851 0.7697288 0.7716195 0.7734582 0.7752458 [253] 0.7769831 0.7786710 0.7803104 0.7819023 0.7834474 0.7849467 0.7864011 [260] 0.7878114 0.7891785 0.7905033 0.7917866 0.7930293 0.7942322 0.7953962 [267] 0.7965220 0.7976105 0.7986625 0.7996787 0.8006600 0.8016071 0.8025208 [274] 0.8034018 0.8042508 0.8050686 0.8058559 0.8066133 0.8073416 0.8080414 [281] 0.8087133 0.8093581 0.8099763 0.8105686 0.8111356 0.8116778 0.8121959 [288] 0.8126905 0.8131620 0.8136110 0.8140381 0.8144439 0.8148287 0.8151931 [295] 0.8155376 0.8158627 0.8161689 0.8164566 0.8167262 0.8169782 0.8172130 [302] 0.8174311 0.8176328 0.8178185 0.8179887 0.8181437 0.8182839 0.8184096 [309] 0.8185212 0.8186191 0.8187036 0.8187750 0.8188336 0.8188797 0.8189137 [316] 0.8189359 0.8189465 0.8189458 0.8189342 0.8189118 0.8188789 0.8188359 [323] 0.8187829 0.8187202 0.8186480 0.8185667 0.8184763 0.8183771 0.8182694 [330] 0.8181533 0.8180291 0.8178969 0.8177570 0.8176095 0.8174547 0.8172927 [337] 0.8171237 0.8169478 0.8167653 0.8165763 0.8163810 0.8161795 0.8159719 [344] 0.8157586 0.8155394 0.8153147 0.8150846 0.8148492 0.8146085 0.8143629 [351] 0.8141123 0.8138570 0.8135970 0.8133324 0.8130634 0.8127900 0.8125125 [358] 0.8122308 0.8119452 0.8116556 0.8113623 0.8110652 0.8107646 0.8104604 [365] 0.8101528 0.8098419 0.8095277 0.8092103 0.8088899 0.8085665 0.8082401 [372] 0.8079109 0.8075790 0.8072443 0.8069070 0.8065672 0.8062249 0.8058801 [379] 0.8055330 0.8051836 0.8048320 0.8044782 0.8041223 0.8037643 0.8034044 [386] 0.8030425 0.8026787 0.8023132 0.8019458 0.8015767 0.8012059 0.8008335 [393] 0.8004595 0.8000839 0.7997069 0.7993284 0.7989485 0.7985673 0.7981847 [400] 0.7978008 0.7974157 > mx [1] 0.8189465 > mxli [1] 1.16 > 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/15uxw1258126957.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/244b81258126957.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/3zar61258126957.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/49i0s1258126957.tab") > > system("convert tmp/15uxw1258126957.ps tmp/15uxw1258126957.png") > system("convert tmp/244b81258126957.ps tmp/244b81258126957.png") > system("convert tmp/3zar61258126957.ps tmp/3zar61258126957.png") > > > proc.time() user system elapsed 0.787 0.537 1.001