R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(98.1,101.1,111.1,93.3,100,108,70.4,75.4,105.5,112.3,102.5,93.5,86.7,95.2,103.8,97,95.5,101,67.5,64,106.7,100.6,101.2,93.1,84.2,85.8,91.8,92.4,80.3,79.7,62.5,57.1,100.8,100.7,86.2,83.2,71.7,77.5,89.8,80.3,78.7,93.8,57.6,60.6,91,85.3,77.4,77.3,68.3,69.9,81.7,75.1,69.9,84,54.3,60,89.9,77,85.3,77.6,69.2,75.5,85.7,72.2,79.9,85.3,52.2,61.2,82.4,85.4,78.2,70.2,70.2,69.3,77.5,66.1,69,75.3,58.2,59.7) > x <- c(98.6,98,106.8,96.7,100.2,107.7,92,98.4,107.4,117.7,105.7,97.5,99.9,98.2,104.5,100.8,101.5,103.9,99.6,98.4,112.7,118.4,108.1,105.4,114.6,106.9,115.9,109.8,101.8,114.2,110.8,108.4,127.5,128.6,116.6,127.4,105,108.3,125,111.6,106.5,130.3,115,116.1,134,126.5,125.8,136.4,114.9,110.9,125.5,116.8,116.8,125.5,104.2,115.1,132.8,123.3,124.8,122,117.4,117.9,137.4,114.6,124.7,129.6,109.4,120.9,134.9,136.3,133.2,127.2,122.7,120.5,137.8,119.1,124.3,134.3,121.7,125) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: Wessa P., (2007), Box-Cox Linearity Plot (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_boxcoxlin.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description > 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.1531959 -0.1531440 -0.1530919 -0.1530397 -0.1529874 -0.1529350 [7] -0.1528824 -0.1528297 -0.1527769 -0.1527239 -0.1526708 -0.1526176 [13] -0.1525642 -0.1525108 -0.1524572 -0.1524034 -0.1523496 -0.1522956 [19] -0.1522415 -0.1521872 -0.1521328 -0.1520783 -0.1520237 -0.1519690 [25] -0.1519141 -0.1518591 -0.1518039 -0.1517487 -0.1516933 -0.1516378 [31] -0.1515821 -0.1515264 -0.1514705 -0.1514144 -0.1513583 -0.1513020 [37] -0.1512456 -0.1511891 -0.1511324 -0.1510756 -0.1510187 -0.1509617 [43] -0.1509046 -0.1508473 -0.1507899 -0.1507323 -0.1506747 -0.1506169 [49] -0.1505590 -0.1505010 -0.1504428 -0.1503846 -0.1503262 -0.1502676 [55] -0.1502090 -0.1501502 -0.1500913 -0.1500323 -0.1499732 -0.1499139 [61] -0.1498545 -0.1497950 -0.1497354 -0.1496756 -0.1496158 -0.1495558 [67] -0.1494956 -0.1494354 -0.1493750 -0.1493146 -0.1492539 -0.1491932 [73] -0.1491324 -0.1490714 -0.1490103 -0.1489491 -0.1488878 -0.1488263 [79] -0.1487647 -0.1487030 -0.1486412 -0.1485793 -0.1485172 -0.1484551 [85] -0.1483928 -0.1483304 -0.1482678 -0.1482052 -0.1481424 -0.1480795 [91] -0.1480165 -0.1479534 -0.1478901 -0.1478268 -0.1477633 -0.1476997 [97] -0.1476360 -0.1475722 -0.1475082 -0.1474441 -0.1473799 -0.1473156 [103] -0.1472512 -0.1471867 -0.1471220 -0.1470573 -0.1469924 -0.1469274 [109] -0.1468622 -0.1467970 -0.1467317 -0.1466662 -0.1466006 -0.1465349 [115] -0.1464691 -0.1464032 -0.1463371 -0.1462710 -0.1462047 -0.1461383 [121] -0.1460718 -0.1460052 -0.1459385 -0.1458716 -0.1458047 -0.1457376 [127] -0.1456704 -0.1456031 -0.1455357 -0.1454682 -0.1454006 -0.1453328 [133] -0.1452650 -0.1451970 -0.1451289 -0.1450607 -0.1449924 -0.1449240 [139] -0.1448555 -0.1447868 -0.1447181 -0.1446492 -0.1445802 -0.1445111 [145] -0.1444420 -0.1443726 -0.1443032 -0.1442337 -0.1441641 -0.1440943 [151] -0.1440245 -0.1439545 -0.1438844 -0.1438143 -0.1437440 -0.1436736 [157] -0.1436031 -0.1435324 -0.1434617 -0.1433909 -0.1433200 -0.1432489 [163] -0.1431778 -0.1431065 -0.1430351 -0.1429637 -0.1428921 -0.1428204 [169] -0.1427486 -0.1426767 -0.1426047 -0.1425326 -0.1424603 -0.1423880 [175] -0.1423156 -0.1422431 -0.1421704 -0.1420977 -0.1420248 -0.1419519 [181] -0.1418788 -0.1418056 -0.1417324 -0.1416590 -0.1415855 -0.1415120 [187] -0.1414383 -0.1413645 -0.1412906 -0.1412166 -0.1411425 -0.1410683 [193] -0.1409940 -0.1409196 -0.1408451 -0.1407705 -0.1406958 -0.1406210 [199] -0.1405461 -0.1404711 -0.1403960 -0.1403208 -0.1402455 -0.1401701 [205] -0.1400945 -0.1400189 -0.1399432 -0.1398674 -0.1397915 -0.1397155 [211] -0.1396394 -0.1395632 -0.1394869 -0.1394105 -0.1393340 -0.1392574 [217] -0.1391807 -0.1391039 -0.1390270 -0.1389500 -0.1388729 -0.1387957 [223] -0.1387185 -0.1386411 -0.1385636 -0.1384860 -0.1384084 -0.1383306 [229] -0.1382527 -0.1381748 -0.1380967 -0.1380186 -0.1379404 -0.1378620 [235] -0.1377836 -0.1377051 -0.1376265 -0.1375478 -0.1374690 -0.1373901 [241] -0.1373111 -0.1372320 -0.1371528 -0.1370735 -0.1369942 -0.1369147 [247] -0.1368352 -0.1367555 -0.1366758 -0.1365960 -0.1365161 -0.1364361 [253] -0.1363560 -0.1362758 -0.1361955 -0.1361151 -0.1360347 -0.1359541 [259] -0.1358735 -0.1357928 -0.1357119 -0.1356310 -0.1355500 -0.1354689 [265] -0.1353878 -0.1353065 -0.1352252 -0.1351437 -0.1350622 -0.1349806 [271] -0.1348989 -0.1348171 -0.1347352 -0.1346532 -0.1345712 -0.1344891 [277] -0.1344068 -0.1343245 -0.1342421 -0.1341596 -0.1340771 -0.1339944 [283] -0.1339117 -0.1338289 -0.1337460 -0.1336630 -0.1335799 -0.1334967 [289] -0.1334135 -0.1333302 -0.1332467 -0.1331632 -0.1330797 -0.1329960 [295] -0.1329123 -0.1328284 -0.1327445 -0.1326605 -0.1325765 -0.1324923 [301] -0.1324081 -0.1323238 -0.1322394 -0.1321549 -0.1320703 -0.1319857 [307] -0.1319010 -0.1318162 -0.1317313 -0.1316463 -0.1315613 -0.1314761 [313] -0.1313909 -0.1313057 -0.1312203 -0.1311349 -0.1310494 -0.1309638 [319] -0.1308781 -0.1307924 -0.1307065 -0.1306206 -0.1305347 -0.1304486 [325] -0.1303625 -0.1302763 -0.1301900 -0.1301036 -0.1300172 -0.1299307 [331] -0.1298441 -0.1297574 -0.1296707 -0.1295839 -0.1294970 -0.1294100 [337] -0.1293230 -0.1292359 -0.1291487 -0.1290614 -0.1289741 -0.1288867 [343] -0.1287992 -0.1287117 -0.1286241 -0.1285364 -0.1284486 -0.1283608 [349] -0.1282729 -0.1281849 -0.1280968 -0.1280087 -0.1279205 -0.1278323 [355] -0.1277439 -0.1276555 -0.1275671 -0.1274785 -0.1273899 -0.1273012 [361] -0.1272125 -0.1271237 -0.1270348 -0.1269458 -0.1268568 -0.1267677 [367] -0.1266785 -0.1265893 -0.1265000 -0.1264107 -0.1263212 -0.1262317 [373] -0.1261422 -0.1260525 -0.1259629 -0.1258731 -0.1257833 -0.1256934 [379] -0.1256034 -0.1255134 -0.1254233 -0.1253332 -0.1252430 -0.1251527 [385] -0.1250623 -0.1249719 -0.1248815 -0.1247909 -0.1247003 -0.1246097 [391] -0.1245190 -0.1244282 -0.1243373 -0.1242464 -0.1241554 -0.1240644 [397] -0.1239733 -0.1238822 -0.1237910 -0.1236997 -0.1236083 > mx [1] 0.1531959 > 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/1uyl61194695650.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/2szs71194695650.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/3gsih1194695650.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 > 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/4exz31194695651.tab") > > system("convert tmp/1uyl61194695650.ps tmp/1uyl61194695650.png") > system("convert tmp/2szs71194695650.ps tmp/2szs71194695650.png") > system("convert tmp/3gsih1194695650.ps tmp/3gsih1194695650.png") > > > proc.time() user system elapsed 1.875 0.847 1.999