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(114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6,89.1) > x <- c(1.2218,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.5751,1.5557,1.5553,1.577,1.4975,1.437,1.3322,1.2732,1.3449,1.3239,1.2785,1.305,1.319,1.365,1.4016,1.4088,1.4268) > #'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.1100188 0.1100782 0.1101377 0.1101972 0.1102566 0.1103161 0.1103755 [8] 0.1104350 0.1104944 0.1105538 0.1106132 0.1106726 0.1107320 0.1107914 [15] 0.1108508 0.1109102 0.1109696 0.1110290 0.1110883 0.1111477 0.1112070 [22] 0.1112664 0.1113257 0.1113850 0.1114443 0.1115036 0.1115629 0.1116222 [29] 0.1116815 0.1117408 0.1118000 0.1118593 0.1119185 0.1119778 0.1120370 [36] 0.1120962 0.1121554 0.1122146 0.1122738 0.1123330 0.1123922 0.1124514 [43] 0.1125105 0.1125697 0.1126288 0.1126880 0.1127471 0.1128062 0.1128653 [50] 0.1129244 0.1129835 0.1130426 0.1131016 0.1131607 0.1132197 0.1132788 [57] 0.1133378 0.1133968 0.1134558 0.1135148 0.1135738 0.1136328 0.1136917 [64] 0.1137507 0.1138096 0.1138685 0.1139275 0.1139864 0.1140453 0.1141042 [71] 0.1141630 0.1142219 0.1142807 0.1143396 0.1143984 0.1144572 0.1145160 [78] 0.1145748 0.1146336 0.1146924 0.1147512 0.1148099 0.1148686 0.1149274 [85] 0.1149861 0.1150448 0.1151035 0.1151621 0.1152208 0.1152795 0.1153381 [92] 0.1153967 0.1154553 0.1155139 0.1155725 0.1156311 0.1156897 0.1157482 [99] 0.1158067 0.1158653 0.1159238 0.1159823 0.1160408 0.1160992 0.1161577 [106] 0.1162161 0.1162746 0.1163330 0.1163914 0.1164498 0.1165081 0.1165665 [113] 0.1166248 0.1166832 0.1167415 0.1167998 0.1168581 0.1169164 0.1169746 [120] 0.1170329 0.1170911 0.1171493 0.1172075 0.1172657 0.1173239 0.1173820 [127] 0.1174402 0.1174983 0.1175564 0.1176145 0.1176726 0.1177306 0.1177887 [134] 0.1178467 0.1179047 0.1179627 0.1180207 0.1180787 0.1181367 0.1181946 [141] 0.1182525 0.1183104 0.1183683 0.1184262 0.1184841 0.1185419 0.1185997 [148] 0.1186575 0.1187153 0.1187731 0.1188309 0.1188886 0.1189463 0.1190040 [155] 0.1190617 0.1191194 0.1191771 0.1192347 0.1192923 0.1193499 0.1194075 [162] 0.1194651 0.1195227 0.1195802 0.1196377 0.1196952 0.1197527 0.1198102 [169] 0.1198676 0.1199250 0.1199825 0.1200399 0.1200972 0.1201546 0.1202119 [176] 0.1202692 0.1203265 0.1203838 0.1204411 0.1204983 0.1205556 0.1206128 [183] 0.1206700 0.1207271 0.1207843 0.1208414 0.1208985 0.1209556 0.1210127 [190] 0.1210698 0.1211268 0.1211838 0.1212408 0.1212978 0.1213547 0.1214117 [197] 0.1214686 0.1215255 0.1215824 0.1216392 0.1216961 0.1217529 0.1218097 [204] 0.1218665 0.1219232 0.1219800 0.1220367 0.1220934 0.1221501 0.1222067 [211] 0.1222633 0.1223200 0.1223765 0.1224331 0.1224897 0.1225462 0.1226027 [218] 0.1226592 0.1227157 0.1227721 0.1228285 0.1228849 0.1229413 0.1229977 [225] 0.1230540 0.1231103 0.1231666 0.1232229 0.1232791 0.1233353 0.1233916 [232] 0.1234477 0.1235039 0.1235600 0.1236161 0.1236722 0.1237283 0.1237844 [239] 0.1238404 0.1238964 0.1239524 0.1240083 0.1240643 0.1241202 0.1241761 [246] 0.1242319 0.1242878 0.1243436 0.1243994 0.1244552 0.1245109 0.1245666 [253] 0.1246223 0.1246780 0.1247337 0.1247893 0.1248449 0.1249005 0.1249561 [260] 0.1250116 0.1250671 0.1251226 0.1251781 0.1252335 0.1252889 0.1253443 [267] 0.1253997 0.1254550 0.1255103 0.1255656 0.1256209 0.1256761 0.1257314 [274] 0.1257865 0.1258417 0.1258969 0.1259520 0.1260071 0.1260621 0.1261172 [281] 0.1261722 0.1262272 0.1262822 0.1263371 0.1263920 0.1264469 0.1265018 [288] 0.1265566 0.1266114 0.1266662 0.1267210 0.1267757 0.1268304 0.1268851 [295] 0.1269398 0.1269944 0.1270490 0.1271036 0.1271581 0.1272127 0.1272672 [302] 0.1273216 0.1273761 0.1274305 0.1274849 0.1275393 0.1275936 0.1276479 [309] 0.1277022 0.1277565 0.1278107 0.1278649 0.1279191 0.1279732 0.1280273 [316] 0.1280814 0.1281355 0.1281895 0.1282436 0.1282975 0.1283515 0.1284054 [323] 0.1284593 0.1285132 0.1285670 0.1286209 0.1286747 0.1287284 0.1287821 [330] 0.1288358 0.1288895 0.1289432 0.1289968 0.1290504 0.1291039 0.1291575 [337] 0.1292110 0.1292645 0.1293179 0.1293713 0.1294247 0.1294781 0.1295314 [344] 0.1295847 0.1296380 0.1296912 0.1297444 0.1297976 0.1298508 0.1299039 [351] 0.1299570 0.1300101 0.1300631 0.1301161 0.1301691 0.1302221 0.1302750 [358] 0.1303279 0.1303807 0.1304335 0.1304863 0.1305391 0.1305919 0.1306446 [365] 0.1306972 0.1307499 0.1308025 0.1308551 0.1309077 0.1309602 0.1310127 [372] 0.1310651 0.1311176 0.1311700 0.1312224 0.1312747 0.1313270 0.1313793 [379] 0.1314315 0.1314838 0.1315359 0.1315881 0.1316402 0.1316923 0.1317444 [386] 0.1317964 0.1318484 0.1319004 0.1319523 0.1320042 0.1320561 0.1321079 [393] 0.1321597 0.1322115 0.1322632 0.1323150 0.1323666 0.1324183 0.1324699 [400] 0.1325215 0.1325730 > mx [1] 0.1325730 > 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/1fz4x1258296008.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/2e54i1258296008.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/3ykz31258296008.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/4n8c31258296009.tab") > > system("convert tmp/1fz4x1258296008.ps tmp/1fz4x1258296008.png") > system("convert tmp/2e54i1258296008.ps tmp/2e54i1258296008.png") > system("convert tmp/3ykz31258296008.ps tmp/3ykz31258296008.png") > > > proc.time() user system elapsed 0.764 0.490 1.442