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(105.9,117.6,113.6,115.9,118.9,77.6,81.2,123.1,136.6,112.1,95.1,96.3,105.7,115,105.7,105.7,111.1,82.4,60,107.3,99.3,113.5,108.9,100.2,103.9,138.7,120.2,100.2,143.2,70.9,85.2,133,136.6,117.9,106.3,122.3,125.5,148.4,126.3,99.6,140.4,80.3,92.6,138.5,110.9,119.6,105,109,129.4,148.6,101.4,134.8,143.7,81.6,90.3,141.5,140.7,140.2,100.2,125.7,119.6,134.7,109,116.3,146.9,97.4,89.4,132.1,139.8,129,112.5,121.9,121.7,123.1,131.6,119.3,132.5,98.3,85.1,131.7,129.3,90.7,78.6,68.9,79.1) > x <- c(107.25,105.80,102.90,100.00,98.55,108.70,110.14,113.04,115.94,117.39,118.84,120.29,118.84,115.94,114.49,110.14,110.14,120.29,121.74,121.74,121.74,121.74,124.64,128.99,127.54,120.29,108.70,104.35,107.25,127.54,134.78,134.78,126.09,118.84,120.29,123.19,124.64,123.19,118.84,117.39,114.49,124.64,126.09,126.09,123.19,121.74,123.19,126.09,126.09,124.64,123.19,120.29,115.94,118.84,117.39,117.39,115.94,114.49,114.49,115.94,115.94,114.49,115.94,111.59,104.35,108.70,105.80,101.45,101.45,101.45,104.35,105.80,102.90,98.55,92.75,88.41,94.20,111.59,114.49,108.70,100.00,95.65,100.00,111.59,115.94) > #'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.1288385 -0.1288276 -0.1288166 -0.1288057 -0.1287947 -0.1287836 [7] -0.1287725 -0.1287614 -0.1287502 -0.1287390 -0.1287278 -0.1287165 [13] -0.1287052 -0.1286939 -0.1286825 -0.1286711 -0.1286596 -0.1286481 [19] -0.1286366 -0.1286250 -0.1286134 -0.1286017 -0.1285901 -0.1285783 [25] -0.1285666 -0.1285548 -0.1285429 -0.1285311 -0.1285192 -0.1285072 [31] -0.1284952 -0.1284832 -0.1284712 -0.1284591 -0.1284470 -0.1284348 [37] -0.1284226 -0.1284104 -0.1283981 -0.1283858 -0.1283734 -0.1283611 [43] -0.1283486 -0.1283362 -0.1283237 -0.1283112 -0.1282986 -0.1282860 [49] -0.1282734 -0.1282607 -0.1282480 -0.1282353 -0.1282225 -0.1282097 [55] -0.1281968 -0.1281839 -0.1281710 -0.1281581 -0.1281451 -0.1281320 [61] -0.1281190 -0.1281059 -0.1280928 -0.1280796 -0.1280664 -0.1280532 [67] -0.1280399 -0.1280266 -0.1280132 -0.1279999 -0.1279865 -0.1279730 [73] -0.1279595 -0.1279460 -0.1279325 -0.1279189 -0.1279053 -0.1278916 [79] -0.1278779 -0.1278642 -0.1278505 -0.1278367 -0.1278228 -0.1278090 [85] -0.1277951 -0.1277812 -0.1277672 -0.1277532 -0.1277392 -0.1277251 [91] -0.1277110 -0.1276969 -0.1276827 -0.1276685 -0.1276543 -0.1276401 [97] -0.1276258 -0.1276114 -0.1275971 -0.1275827 -0.1275682 -0.1275538 [103] -0.1275393 -0.1275248 -0.1275102 -0.1274956 -0.1274810 -0.1274663 [109] -0.1274516 -0.1274369 -0.1274221 -0.1274073 -0.1273925 -0.1273777 [115] -0.1273628 -0.1273478 -0.1273329 -0.1273179 -0.1273029 -0.1272878 [121] -0.1272727 -0.1272576 -0.1272425 -0.1272273 -0.1272121 -0.1271968 [127] -0.1271816 -0.1271663 -0.1271509 -0.1271355 -0.1271201 -0.1271047 [133] -0.1270892 -0.1270737 -0.1270582 -0.1270427 -0.1270271 -0.1270114 [139] -0.1269958 -0.1269801 -0.1269644 -0.1269486 -0.1269329 -0.1269170 [145] -0.1269012 -0.1268853 -0.1268694 -0.1268535 -0.1268375 -0.1268215 [151] -0.1268055 -0.1267894 -0.1267734 -0.1267572 -0.1267411 -0.1267249 [157] -0.1267087 -0.1266925 -0.1266762 -0.1266599 -0.1266436 -0.1266272 [163] -0.1266108 -0.1265944 -0.1265779 -0.1265615 -0.1265450 -0.1265284 [169] -0.1265118 -0.1264952 -0.1264786 -0.1264620 -0.1264453 -0.1264285 [175] -0.1264118 -0.1263950 -0.1263782 -0.1263614 -0.1263445 -0.1263276 [181] -0.1263107 -0.1262938 -0.1262768 -0.1262598 -0.1262427 -0.1262257 [187] -0.1262086 -0.1261914 -0.1261743 -0.1261571 -0.1261399 -0.1261226 [193] -0.1261054 -0.1260881 -0.1260708 -0.1260534 -0.1260360 -0.1260186 [199] -0.1260012 -0.1259837 -0.1259662 -0.1259487 -0.1259311 -0.1259136 [205] -0.1258960 -0.1258783 -0.1258607 -0.1258430 -0.1258252 -0.1258075 [211] -0.1257897 -0.1257719 -0.1257541 -0.1257362 -0.1257184 -0.1257005 [217] -0.1256825 -0.1256646 -0.1256466 -0.1256285 -0.1256105 -0.1255924 [223] -0.1255743 -0.1255562 -0.1255380 -0.1255199 -0.1255017 -0.1254834 [229] -0.1254652 -0.1254469 -0.1254286 -0.1254102 -0.1253919 -0.1253735 [235] -0.1253550 -0.1253366 -0.1253181 -0.1252996 -0.1252811 -0.1252626 [241] -0.1252440 -0.1252254 -0.1252067 -0.1251881 -0.1251694 -0.1251507 [247] -0.1251320 -0.1251132 -0.1250944 -0.1250756 -0.1250568 -0.1250379 [253] -0.1250190 -0.1250001 -0.1249812 -0.1249622 -0.1249432 -0.1249242 [259] -0.1249052 -0.1248861 -0.1248670 -0.1248479 -0.1248288 -0.1248096 [265] -0.1247904 -0.1247712 -0.1247520 -0.1247327 -0.1247134 -0.1246941 [271] -0.1246748 -0.1246554 -0.1246361 -0.1246166 -0.1245972 -0.1245778 [277] -0.1245583 -0.1245388 -0.1245192 -0.1244997 -0.1244801 -0.1244605 [283] -0.1244409 -0.1244212 -0.1244016 -0.1243819 -0.1243621 -0.1243424 [289] -0.1243226 -0.1243028 -0.1242830 -0.1242632 -0.1242433 -0.1242234 [295] -0.1242035 -0.1241836 -0.1241636 -0.1241437 -0.1241236 -0.1241036 [301] -0.1240836 -0.1240635 -0.1240434 -0.1240233 -0.1240031 -0.1239830 [307] -0.1239628 -0.1239426 -0.1239224 -0.1239021 -0.1238818 -0.1238615 [313] -0.1238412 -0.1238209 -0.1238005 -0.1237801 -0.1237597 -0.1237393 [319] -0.1237188 -0.1236983 -0.1236778 -0.1236573 -0.1236368 -0.1236162 [325] -0.1235956 -0.1235750 -0.1235544 -0.1235337 -0.1235130 -0.1234923 [331] -0.1234716 -0.1234509 -0.1234301 -0.1234093 -0.1233885 -0.1233677 [337] -0.1233469 -0.1233260 -0.1233051 -0.1232842 -0.1232633 -0.1232423 [343] -0.1232213 -0.1232003 -0.1231793 -0.1231583 -0.1231372 -0.1231161 [349] -0.1230950 -0.1230739 -0.1230528 -0.1230316 -0.1230104 -0.1229892 [355] -0.1229680 -0.1229468 -0.1229255 -0.1229042 -0.1228829 -0.1228616 [361] -0.1228402 -0.1228189 -0.1227975 -0.1227761 -0.1227547 -0.1227332 [367] -0.1227117 -0.1226903 -0.1226688 -0.1226472 -0.1226257 -0.1226041 [373] -0.1225825 -0.1225609 -0.1225393 -0.1225177 -0.1224960 -0.1224743 [379] -0.1224526 -0.1224309 -0.1224092 -0.1223874 -0.1223656 -0.1223438 [385] -0.1223220 -0.1223002 -0.1222783 -0.1222564 -0.1222345 -0.1222126 [391] -0.1221907 -0.1221688 -0.1221468 -0.1221248 -0.1221028 -0.1220808 [397] -0.1220587 -0.1220367 -0.1220146 -0.1219925 -0.1219704 > mx [1] 0.1288385 > 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/1kx2z1258123730.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/254qi1258123730.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/3qtdu1258123730.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/4cw2v1258123730.tab") > > system("convert tmp/1kx2z1258123730.ps tmp/1kx2z1258123730.png") > system("convert tmp/254qi1258123730.ps tmp/254qi1258123730.png") > system("convert tmp/3qtdu1258123730.ps tmp/3qtdu1258123730.png") > > > proc.time() user system elapsed 0.824 0.513 0.961